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

   1 martin 1.79 //%LICENSE////////////////////////////////////////////////////////////////
   2 martin 1.80 //
   3 martin 1.79 // Licensed to The Open Group (TOG) under one or more contributor license
   4             // agreements.  Refer to the OpenPegasusNOTICE.txt file distributed with
   5             // this work for additional information regarding copyright ownership.
   6             // Each contributor licenses this file to you under the OpenPegasus Open
   7             // Source License; you may not use this file except in compliance with the
   8             // License.
   9 martin 1.80 //
  10 martin 1.79 // Permission is hereby granted, free of charge, to any person obtaining a
  11             // copy of this software and associated documentation files (the "Software"),
  12             // to deal in the Software without restriction, including without limitation
  13             // the rights to use, copy, modify, merge, publish, distribute, sublicense,
  14             // and/or sell copies of the Software, and to permit persons to whom the
  15             // Software is furnished to do so, subject to the following conditions:
  16 martin 1.80 //
  17 martin 1.79 // The above copyright notice and this permission notice shall be included
  18             // in all copies or substantial portions of the Software.
  19 martin 1.80 //
  20 martin 1.79 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  21 martin 1.80 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  22 martin 1.79 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
  23             // IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
  24             // CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
  25             // TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
  26             // SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  27 martin 1.80 //
  28 martin 1.79 //////////////////////////////////////////////////////////////////////////
  29 kumpf  1.69 //
  30 s.manicka 1.72 //%////////////////////////////////////////////////////////////////////////////
  31 karl      1.1  
  32                ///////////////////////////////////////////////////////////////////////////////
  33 karl      1.5  //  Interop Provider - This provider services those classes from the
  34 a.dunfey  1.64 //  DMTF Interop schema in an implementation compliant with the SMI-S v1.1
  35                //  Server Profile
  36 karl      1.1  //
  37 a.dunfey  1.64 //  Please see PG_ServerProfile20.mof in the directory
  38                //  $(PEGASUS_ROOT)/Schemas/Pegasus/InterOp/VER20 for retails regarding the
  39                //  classes supported by this control provider.
  40 david.dillard 1.32 //
  41 kumpf         1.69 //  Interop forces all creates to the PEGASUS_NAMESPACENAME_INTEROP
  42                    //  namespace. There is a test on each operation that returns
  43 a.dunfey      1.64 //  the Invalid Class CIMDError
  44                    //  This is a control provider and as such uses the Tracer functions
  45                    //  for data and function traces.  Since we do not expect high volume
  46                    //  use we added a number of traces to help diagnostics.
  47 karl          1.1  ///////////////////////////////////////////////////////////////////////////////
  48                    
  49                    #include <Pegasus/Common/Config.h>
  50                    #include <Pegasus/Common/PegasusVersion.h>
  51                    
  52                    #include <cctype>
  53                    #include <iostream>
  54                    
  55                    #include "InteropProvider.h"
  56 a.dunfey      1.64 #include "InteropProviderUtils.h"
  57                    #include "InteropConstants.h"
  58                    
  59 karl          1.8  #include <Pegasus/Common/StatisticalData.h>
  60 venkat.puvvada 1.77 #include <Pegasus/Common/StringConversion.h>
  61 marek          1.81.2.2 #include <Pegasus/Common/ArrayIterator.h>
  62 karl           1.1      
  63                         PEGASUS_USING_STD;
  64 a.dunfey       1.65     PEGASUS_NAMESPACE_BEGIN
  65 karl           1.1      
  66 a.dunfey       1.64     /*****************************************************************************
  67                          *
  68                          * The following are constants representing property names for the classes
  69                          * managed by the Interop Provider. Where multiple classes have properties of
  70                          * the same name, there will be a common CIMName object defined, and a macro
  71                          * defined that points to the common CIMName object, but whose macro name
  72                          * reflects the class in which the property is used.
  73                          *
  74                          *****************************************************************************/
  75 karl           1.1      
  76 tony           1.6      //
  77 a.dunfey       1.64     // Constructor for the InteropProvider control provider
  78 tony           1.6      //
  79 marek          1.81.2.1 InteropProvider::InteropProvider(
  80                             CIMRepository * rep,
  81                             ProviderRegistrationManager *provRegManager):
  82                                 repository(rep),
  83                                 providerRegistrationManager(provRegManager),
  84                                 hostName(System::getHostName()),
  85                                 providerInitialized(false),
  86                                 updateProfileCache(0),
  87                                 profileIds(Array<String>()),
  88                                 conformingElements(Array<CIMNameArray>()),
  89                                 elementNamespaces(Array<CIMNamespaceArray>())
  90 a.dunfey       1.64     {
  91                             PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,"InteropProvider::InteropProvider");
  92 tony           1.6      
  93 venkat.puvvada 1.77         ConfigManager *configManager = ConfigManager::getInstance();
  94                         #ifdef PEGASUS_ENABLE_SLP
  95                             enableSLP = ConfigManager::parseBooleanValue(
  96                                 configManager->getCurrentValue("slp"));
  97                         #else
  98                             enableSLP = false;
  99                         #endif
 100                         
 101                             httpPort = configManager->getCurrentValue("httpPort");
 102                             if (httpPort.size() == 0)
 103                             {
 104                                 Uint32 portNumberHttp = System::lookupPort(
 105                                     WBEM_HTTP_SERVICE_NAME, WBEM_DEFAULT_HTTP_PORT);
 106                                 char buffer[32];
 107                                 Uint32 n;
 108                                 const char *output = Uint32ToString(buffer, portNumberHttp, n);
 109                                 httpPort.assign(output, n);
 110                             }
 111                         
 112                             httpsPort = configManager->getCurrentValue("httpsPort");
 113                             if (httpsPort.size() == 0)
 114 venkat.puvvada 1.77         {
 115                                 Uint32 portNumberHttps = System::lookupPort(
 116                                     WBEM_HTTPS_SERVICE_NAME, WBEM_DEFAULT_HTTPS_PORT);
 117                                 char buffer[32];
 118                                 Uint32 n;
 119                                 const char *output = Uint32ToString(buffer, portNumberHttps, n);
 120                                 httpsPort.assign(output, n);
 121                             }
 122                         
 123                         
 124 a.dunfey       1.65     #ifndef PEGASUS_DISABLE_PERFINST
 125                             try
 126                             {
 127                                 initProvider();
 128 w.white        1.34         }
 129 marek          1.71         catch(const Exception &)
 130 a.dunfey       1.64         {
 131 a.dunfey       1.65             // Provider initialization may fail if the repository is not
 132                                 // populated
 133 karl           1.26         }
 134 a.dunfey       1.65     #endif
 135 kumpf          1.69     
 136 a.dunfey       1.64         PEG_METHOD_EXIT();
 137 karl           1.26     }
 138                         
 139 a.dunfey       1.64     //
 140                         // Local version of getInstance to be used by other functions in the the
 141                         // provider. Returns a single instance. Note that it always returns an
 142                         // instance. If none was found, it is uninialitized.
 143                         //
 144                         CIMInstance InteropProvider::localGetInstance(
 145                             const OperationContext & context,
 146                             const CIMObjectPath & instanceName,
 147                             const CIMPropertyList & propertyList)
 148 karl           1.52     {
 149 a.dunfey       1.64         PEG_METHOD_ENTER(TRC_CONTROLPROVIDER, "InteropProvider::localGetInstance");
 150 karl           1.40     
 151 marek          1.67         PEG_TRACE((TRC_CONTROLPROVIDER, Tracer::LEVEL4,
 152 a.dunfey       1.64             "%s getInstance. instanceName= %s , PropertyList= %s",
 153                                 thisProvider,
 154                                 (const char *)instanceName.toString().getCString(),
 155 marek          1.67             (const char *)propertyListToString(propertyList).getCString()));
 156 karl           1.40     
 157 a.dunfey       1.64         // Test if we're looking for something outside of our namespace. This will
 158                             // happen during associators calls from PG_RegisteredProfile instances
 159                             // through the PG_ElementConformsToProfile association
 160                             CIMNamespaceName opNamespace = instanceName.getNameSpace();
 161                             CIMName opClass = instanceName.getClassName();
 162                             if(opNamespace != PEGASUS_NAMESPACENAME_INTEROP &&
 163 venkat.puvvada 1.75             opClass != PEGASUS_CLASSNAME_PG_ELEMENTCONFORMSTOPROFILE
 164                                 // Get CIM_IndicationService instance from IndicationService.
 165                         #ifdef PEGASUS_ENABLE_DMTF_INDICATION_PROFILE_SUPPORT
 166                                 || opClass == PEGASUS_CLASSNAME_CIM_INDICATIONSERVICE
 167                         #endif
 168                                 )
 169 a.dunfey       1.64         {
 170                                 AutoMutex mut(interopMut);
 171 marek          1.70             CIMInstance gotInstance = cimomHandle.getInstance(
 172                                                                  context,
 173                                                                  opNamespace,
 174 kumpf          1.81                                              instanceName,
 175                                                                  false,
 176                                                                  false,
 177                                                                  false,
 178 marek          1.70                                              propertyList);
 179                                 PEG_METHOD_EXIT();
 180                                 return gotInstance;
 181 a.dunfey       1.64         }
 182 marek          1.81.2.1     TARGET_CLASS classEnum  = translateClassInput(opClass);
 183 a.dunfey       1.64         CIMInstance retInstance;
 184 marek          1.81.2.1     switch(classEnum)
 185 tony           1.6          {
 186 marek          1.81.2.1         case PG_SOFTWAREIDENTITY:
 187 tony           1.6              {
 188 marek          1.81.2.1             retInstance = getSoftwareIdentityInstance(instanceName);
 189                                     normalizeInstance(
 190                                         retInstance, instanceName, false, false, propertyList);
 191                                 }
 192                                 break;
 193 marek          1.81.2.2         case PG_NAMESPACE:
 194                                 {
 195                                     retInstance = getNameSpaceInstance(instanceName);
 196                                     normalizeInstance(
 197                                         retInstance, instanceName, false, false, propertyList);
 198                                 }
 199                                 break;
 200 marek          1.81.2.1         // ATTN: Implement getIntstance for all other classes. Currently
 201                                 // this method calls localEnumerateInstances() to select instance
 202                                 // which is too expensive.
 203                                 default:
 204                                 {
 205                                     // Create reference from host, namespace, class components of
 206                                     // instance name
 207                                     CIMObjectPath ref;
 208                                     ref.setHost(instanceName.getHost());
 209                                     ref.setClassName(opClass);
 210                                     ref.setNameSpace(opNamespace);
 211                         
 212                                     // Enumerate instances for this class. Returns all instances
 213                                     // Note that this returns paths setup and instances already
 214                                     // filtered per the input criteria.
 215                                     Array<CIMInstance> instances =  localEnumerateInstances(
 216                                         context,
 217                                         ref,
 218                                         propertyList);
 219 marek          1.81.2.2             ConstArrayIterator<CIMInstance> instancesIter(instances);
 220 karl           1.8      
 221 marek          1.81.2.1             // deliver a single instance if found.
 222                                     bool found = false;
 223 marek          1.81.2.2             for(Uint32 i = 0; i < instancesIter.size(); i++)
 224 marek          1.81.2.1             {
 225 marek          1.81.2.2                 CIMObjectPath currentInstRef = instancesIter[i].getPath();
 226 marek          1.81.2.1                 currentInstRef.setHost(instanceName.getHost());
 227                                         currentInstRef.setNameSpace(instanceName.getNameSpace());
 228                                         if(instanceName == currentInstRef)
 229                                         {
 230 marek          1.81.2.2                     retInstance = instancesIter[i];
 231 marek          1.81.2.1                     found = true;
 232                                             break;
 233                                         }
 234                                     }
 235 marek          1.81.2.2 
 236 marek          1.81.2.1             PEG_METHOD_EXIT();
 237                                     if (!found)
 238                                     { 
 239                                         throw CIMObjectNotFoundException(instanceName.toString());
 240                                     }
 241                                 }
 242 karl           1.8          }
 243 a.dunfey       1.64         return retInstance;
 244 tony           1.6      }
 245 karl           1.11     
 246 marek          1.81.2.2 Array<CIMInstance> InteropProvider::getReferencedInstances(
 247                             const Array<CIMInstance> &refs,
 248                             const String targetRole,
 249                             const OperationContext & context,
 250                             const CIMPropertyList & propertyList)
 251                         {
 252                             PEG_METHOD_ENTER(TRC_CONTROLPROVIDER, 
 253                                 "InteropProvider::getReferencedObjects");
 254                         
 255                             Array<CIMInstance> referencedInstances;
 256                             Array<CIMInstance> classInstances;
 257                             CIMName prevClassName;
 258                         
 259                             ConstArrayIterator<CIMInstance> refsIter(refs);
 260                             for(Uint32 i = 0; i < refsIter.size(); i++)
 261                             {
 262                                 CIMInstance thisRef = refsIter[i];
 263                                 CIMObjectPath thisTarget = getRequiredValue<CIMObjectPath>(
 264                                     thisRef,
 265                                     targetRole);
 266                         
 267 marek          1.81.2.2         // Test if we're looking for something outside of our namespace. This 
 268                                 // will happen during associators calls from PG_RegisteredProfile 
 269                                 // instances through the PG_ElementConformsToProfile association
 270                                 CIMNamespaceName opNamespace = thisTarget.getNameSpace();
 271                                 CIMName opClass = thisTarget.getClassName();
 272                         
 273                                 if(opNamespace != PEGASUS_NAMESPACENAME_INTEROP &&
 274                                     opClass != PEGASUS_CLASSNAME_PG_ELEMENTCONFORMSTOPROFILE
 275                                     // Get CIM_IndicationService instance from IndicationService.
 276                         #ifdef PEGASUS_ENABLE_DMTF_INDICATION_PROFILE_SUPPORT
 277                                     || opClass == PEGASUS_CLASSNAME_CIM_INDICATIONSERVICE
 278                         #endif
 279                                     ) 
 280                                 {
 281                                     AutoMutex mut(interopMut);
 282                                     CIMInstance gotInstance = cimomHandle.getInstance(
 283                                         context,
 284                                         opNamespace,
 285                                         thisTarget,
 286                                         false,
 287                                         false,
 288 marek          1.81.2.2                 false,
 289                                         propertyList);
 290                                     referencedInstances.append(gotInstance);
 291                                     continue;
 292                                 }
 293                         
 294                                 TARGET_CLASS classEnum  = translateClassInput(opClass);
 295                                 CIMInstance retInstance;
 296                                 switch(classEnum)
 297                                 {
 298                                     case PG_SOFTWAREIDENTITY:
 299                                     {
 300                                         CIMInstance retInstance = 
 301                                             getSoftwareIdentityInstance(thisTarget);
 302                                         normalizeInstance(
 303                                             retInstance, thisTarget, false, false, propertyList);
 304                                         retInstance.setPath(thisTarget);
 305                                         referencedInstances.append(retInstance);
 306                                     }
 307                                     break;
 308                                     case PG_NAMESPACE:
 309 marek          1.81.2.2             {
 310                                         CIMInstance retInstance = getNameSpaceInstance(thisTarget);
 311                                         normalizeInstance(
 312                                             retInstance, thisTarget, false, false, propertyList);
 313                                         retInstance.setPath(thisTarget);
 314                                         referencedInstances.append(retInstance);
 315                                     }
 316                                     break;
 317                                     default:
 318                                     {
 319                                         if( opClass != prevClassName )
 320                                         {
 321                                             CIMObjectPath ref;
 322                                             ref.setHost(thisTarget.getHost());
 323                                             ref.setClassName(thisTarget.getClassName());
 324                                             ref.setNameSpace(thisTarget.getNameSpace());
 325                                             classInstances = localEnumerateInstances(
 326                                                 context,
 327                                                 ref,
 328                                                 propertyList);
 329                                             ArrayIterator<CIMInstance> instsIter(classInstances);
 330 marek          1.81.2.2                     for(Uint32 n = 0; n < instsIter.size(); n++)
 331                                             {
 332                                                 CIMObjectPath tmpInst = instsIter[n].getPath();
 333                                                 tmpInst.setHost(thisTarget.getHost());
 334                                                 tmpInst.setNameSpace(thisTarget.getNameSpace());
 335                                                 instsIter[n].setPath(tmpInst);
 336                                             }
 337                                             prevClassName = opClass;
 338                                         }
 339                                         ConstArrayIterator<CIMInstance> instsConstIter(classInstances);
 340                                         for(Uint32 j = 0; j < instsConstIter.size(); j++)
 341                                         {
 342                                             if(thisTarget == instsConstIter[j].getPath())
 343                                             {
 344                                                 referencedInstances.append(instsConstIter[j]);
 345                                                 break;
 346                                             }
 347                                         }
 348                                     }
 349                                     break;
 350                                 }
 351 marek          1.81.2.2     }
 352                             PEG_METHOD_EXIT();
 353                             return referencedInstances;
 354                         }
 355 a.dunfey       1.64     
 356                         //
 357                         // Local version of enumerateInstances to be used by other functions in the
 358                         // provider. Note that this delivers instances as a group rather than one
 359                         // at a time. This design point may need to be revisited if this provider
 360                         // is used in environments such that returning segmented responses would have
 361                         // significant performance advantages. For now, that doesn't seem to be the
 362                         // case.
 363                         //
 364                         Array<CIMInstance> InteropProvider::localEnumerateInstances(
 365                             const OperationContext & context,
 366                             const CIMObjectPath & ref,
 367                             const CIMPropertyList& propertyList)
 368 david.dillard  1.32     {
 369 a.dunfey       1.64         PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,
 370                                 "InteropProvider::localEnumerateInstances()");
 371                             const CIMName & className = ref.getClassName();
 372 marek          1.67         PEG_TRACE((TRC_CONTROLPROVIDER, Tracer::LEVEL4,
 373 a.dunfey       1.64             "%s enumerateInstances. referenc= %s , PropertyList= %s",
 374                                 thisProvider,
 375                                 (const char *)className.getString().getCString(),
 376 marek          1.67             (const char *)propertyListToString(propertyList).getCString()));
 377 david.dillard  1.32     
 378 a.dunfey       1.64         // Verify that ClassName is correct and get its enum value
 379                             TARGET_CLASS classEnum  = translateClassInput(className);
 380 tony           1.6      
 381 kumpf          1.81         Array<CIMInstance> instances;
 382 a.dunfey       1.64         switch(classEnum)
 383                             {
 384                                 case PG_OBJECTMANAGER:
 385                                 {
 386                                     instances.append(getObjectManagerInstance());
 387                                     break;
 388                                 }
 389                                 case PG_CIMXMLCOMMUNICATIONMECHANISM:
 390                                 {
 391                                     instances = enumCIMXMLCommunicationMechanismInstances();
 392                                     break;
 393                                 }
 394                                 case PG_NAMESPACEINMANAGER:
 395                                 {
 396                                     instances = enumNamespaceInManagerInstances();
 397                                     break;
 398                                 }
 399                                 case PG_COMMMECHANISMFORMANAGER:
 400                                 {
 401                                     instances = enumCommMechanismForManagerInstances();
 402                                     break;
 403 a.dunfey       1.64             }
 404                                 case PG_NAMESPACE:
 405                                 {
 406                                     instances = enumNamespaceInstances();
 407                                     break;
 408                                 }
 409                                 case PG_REGISTEREDPROFILE:
 410                                 {
 411                                     instances = enumRegisteredProfileInstances();
 412                                     break;
 413                                 }
 414                                 case PG_REGISTEREDSUBPROFILE:
 415                                 {
 416                                     instances = enumRegisteredSubProfileInstances();
 417                                     break;
 418                                 }
 419                                 case PG_REFERENCEDPROFILE:
 420                                 {
 421                                     instances = enumReferencedProfileInstances();
 422                                     break;
 423                                 }
 424 a.dunfey       1.64             case PG_ELEMENTCONFORMSTOPROFILE:
 425                                 {
 426                                     instances = enumElementConformsToProfileInstances(context,
 427                                         ref.getNameSpace());
 428                                     break;
 429                                 }
 430 s.manicka      1.72             case PG_ELEMENTCONFORMSTOPROFILE_RP_RP:
 431                                 {
 432                                     instances = enumElementConformsToProfileRPRPInstances(
 433                                         context,
 434                                         ref.getNameSpace());
 435                                     break;
 436                                 }
 437 a.dunfey       1.64             case PG_SUBPROFILEREQUIRESPROFILE:
 438                                 {
 439                                     instances = enumSubProfileRequiresProfileInstances();
 440                                     break;
 441                                 }
 442                                 case PG_SOFTWAREIDENTITY:
 443                                 {
 444                                     instances = enumSoftwareIdentityInstances();
 445                                     break;
 446                                 }
 447                                 case PG_ELEMENTSOFTWAREIDENTITY:
 448                                 {
 449                                     instances = enumElementSoftwareIdentityInstances();
 450                                     break;
 451                                 }
 452                                 case PG_INSTALLEDSOFTWAREIDENTITY:
 453                                 {
 454                                     instances = enumInstalledSoftwareIdentityInstances();
 455                                     break;
 456                                 }
 457                                 case PG_COMPUTERSYSTEM:
 458 a.dunfey       1.64             {
 459                                     instances.append(getComputerSystemInstance());
 460                                     break;
 461                                 }
 462                                 case PG_HOSTEDOBJECTMANAGER:
 463                                 {
 464                                     instances.append(getHostedObjectManagerInstance());
 465                                     break;
 466                                 }
 467                                 case PG_HOSTEDACCESSPOINT:
 468                                 {
 469                                     instances = enumHostedAccessPointInstances();
 470                                     break;
 471                                 }
 472 kavita.gupta   1.73             //We don't support enumerate CIM_Namespace instances. PG_Namespace is
 473                                 //supported.
 474                                 case CIM_NAMESPACE:
 475                                 {
 476                                     break;
 477                                 }
 478 venkat.puvvada 1.74             case PG_PROVIDERPROFILECAPABILITIES:
 479                                 {
 480                                     instances = enumProviderProfileCapabilityInstances(false, false);
 481                                     break;
 482                                 }
 483 venkat.puvvada 1.75     
 484                         #ifdef PEGASUS_ENABLE_DMTF_INDICATION_PROFILE_SUPPORT
 485                                 case PG_ELEMENTCAPABILITIES:
 486                                 {
 487                                     instances = enumElementCapabilityInstances(context);
 488                                     break;
 489                                 }
 490                                 case PG_HOSTEDINDICATIONSERVICE:
 491                                 {
 492                                     instances = enumHostedIndicationServiceInstances(context);
 493                                     break;
 494                                 }
 495                                 case PG_SERVICEAFFECTSELEMENT:
 496                                 {
 497                                     instances = enumServiceAffectsElementInstances(context);
 498                                     break;
 499                                 }
 500                         #endif
 501 a.dunfey       1.64             default:
 502                                     PEG_METHOD_EXIT();
 503                                     throw CIMNotSupportedException(className.getString() +
 504                                       " not supported by Interop Provider enumerate");
 505                             }
 506 karl           1.41     
 507 a.dunfey       1.64         // Filter and deliver the resulting instances
 508                             for (Uint32 i = 0 ; i < instances.size() ; i++)
 509                             {
 510                                 normalizeInstance(instances[i], ref, false,
 511                                     false, propertyList);
 512                             }
 513 tony           1.6      
 514 a.dunfey       1.64         PEG_METHOD_EXIT();
 515                             return instances;
 516 tony           1.6      }
 517 karl           1.55     
 518 a.dunfey       1.64     //
 519                         // Class that determines whether or not the origin class in an association
 520                         // operation is valid for the given association class, and also determines
 521                         // the origin and target "roles". These values generally correspond to the
 522                         // role and resultRole parameter of an associators/associatorNames operation.
 523                         //
 524                         bool InteropProvider::validAssocClassForObject(
 525 s.manicka      1.72         const OperationContext & context,
 526 kumpf          1.81         const CIMName & assocClass,
 527 s.manicka      1.72         const CIMObjectPath & objectName,
 528 a.dunfey       1.64         const CIMNamespaceName & opNamespace,
 529 kumpf          1.81         String & originProperty,
 530 s.manicka      1.72         String & targetProperty)
 531 a.dunfey       1.64     {
 532                             PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,
 533                                 "InteropProvider::validAssocClassForObject()");
 534                             TARGET_CLASS assocClassEnum = translateClassInput(assocClass);
 535                             TARGET_CLASS originClassEnum;
 536 s.manicka      1.72         CIMName originClass = objectName.getClassName();
 537 a.dunfey       1.64         // If the association class is PG_ElementConformsToProfile, we'll have to
 538                             // do some special processing in case the origin instance for the operation
 539                             // is managed by another provider.
 540                             if(assocClassEnum == PG_ELEMENTCONFORMSTOPROFILE)
 541                             {
 542                                 // Test if the origin is an element managed by another provider
 543                                 // that has implemented a registered profile.
 544                                 if(opNamespace != PEGASUS_NAMESPACENAME_INTEROP ||
 545                                     (originClass != PEGASUS_CLASSNAME_PG_REGISTEREDPROFILE &&
 546 s.manicka      1.72                  originClass != PEGASUS_CLASSNAME_PG_OBJECTMANAGER ))
 547 a.dunfey       1.64             {
 548                                     //
 549                                     // Search the cached conformingElements list for the originClass,
 550                                     // returning false if it is not found
 551                                     //
 552                                     bool found = false;
 553 karl           1.1      
 554 a.dunfey       1.64                 PEGASUS_ASSERT(conformingElements.size() ==
 555                                         elementNamespaces.size());
 556                                     for(Uint32 i = 0, n = conformingElements.size(); i < n; ++i)
 557                                     {
 558                                         CIMNameArray & elementList = conformingElements[i];
 559                                         CIMNamespaceArray & namespaceList = elementNamespaces[i];
 560                                         PEGASUS_ASSERT(elementList.size() == namespaceList.size());
 561                                         for(Uint32 j = 0, m = elementList.size(); j < m; ++j)
 562                                         {
 563                                             CIMName & curElement = elementList[j];
 564                                             if((curElement == originClass ||
 565                                               curElement.getString().find(PEGASUS_DYNAMIC) == 0) &&
 566                                               opNamespace == namespaceList[j])
 567                                             {
 568                                                 found = true;
 569                                                 break;
 570                                             }
 571                                         }
 572                                         if(found)
 573                                             break;
 574                                     }
 575 karl           1.28     
 576 a.dunfey       1.64                 if(!found)
 577 marek          1.70                 {
 578                                         PEG_METHOD_EXIT();
 579 a.dunfey       1.64                     return false;
 580 marek          1.70                 }
 581 a.dunfey       1.64             }
 582                             }
 583                             else
 584                             {
 585                                 // Otherwise, just get the enum value representing the origin class
 586                                 // for this operation
 587                                 originClassEnum = translateClassInput(originClass);
 588                             }
 589 karl           1.1      
 590 a.dunfey       1.64         CIMName expectedTargetRole;
 591                             CIMName expectedOriginRole;
 592 tony           1.6      
 593 s.manicka      1.72         Array<CIMName> propNames;
 594                             String profileName;
 595                             CIMPropertyList propertyList;
 596                             CIMInstance tmpInstance;
 597                             Uint32 index;
 598                             propNames.clear();
 599 kumpf          1.81     
 600 a.dunfey       1.64         //
 601                             // Set the target and origin role values. Note that if these values are
 602                             // not set following the switch block, that implies that the origin class
 603                             // is not valid for the supplied association class.
 604                             //
 605                             switch(assocClassEnum)
 606 tony           1.6          {
 607 a.dunfey       1.64           case PG_NAMESPACEINMANAGER:
 608                                   if(originClassEnum == PG_OBJECTMANAGER)
 609                                   {
 610                                       expectedTargetRole = PROPERTY_DEPENDENT;
 611                                       expectedOriginRole = PROPERTY_ANTECEDENT;
 612                                   }
 613                                   else if(originClassEnum == PG_NAMESPACE)
 614                                   {
 615                                       expectedTargetRole = PROPERTY_ANTECEDENT;
 616                                       expectedOriginRole = PROPERTY_DEPENDENT;
 617                                   }
 618                                   break;
 619                               case PG_COMMMECHANISMFORMANAGER:
 620                                   if(originClassEnum == PG_OBJECTMANAGER)
 621                                   {
 622                                       expectedTargetRole = PROPERTY_DEPENDENT;
 623                                       expectedOriginRole = PROPERTY_ANTECEDENT;
 624                                   }
 625                                   else if(originClassEnum == PG_CIMXMLCOMMUNICATIONMECHANISM)
 626                                   {
 627                                       expectedTargetRole = PROPERTY_ANTECEDENT;
 628 a.dunfey       1.64                   expectedOriginRole = PROPERTY_DEPENDENT;
 629                                   }
 630                                   break;
 631                               case PG_ELEMENTCONFORMSTOPROFILE:
 632                                   if(originClass.equal(PEGASUS_CLASSNAME_PG_REGISTEREDPROFILE))
 633                                   {
 634                                       expectedTargetRole =
 635                                           ELEMENTCONFORMSTOPROFILE_PROPERTY_MANAGEDELEMENT;
 636                                       expectedOriginRole =
 637                                           ELEMENTCONFORMSTOPROFILE_PROPERTY_CONFORMANTSTANDARD;
 638                                   }
 639                                   else
 640                                   {
 641                                       expectedTargetRole =
 642                                           ELEMENTCONFORMSTOPROFILE_PROPERTY_CONFORMANTSTANDARD;
 643                                       expectedOriginRole =
 644                                           ELEMENTCONFORMSTOPROFILE_PROPERTY_MANAGEDELEMENT;
 645                                   }
 646                                   break;
 647 s.manicka      1.72           case PG_ELEMENTCONFORMSTOPROFILE_RP_RP:
 648                                   propNames.append(CIMName("RegisteredName"));
 649                                   propertyList = CIMPropertyList(propNames);
 650                                   tmpInstance = localGetInstance(
 651 kumpf          1.81                   context,
 652 s.manicka      1.72                   objectName,
 653                                       propertyList);
 654 venkat.puvvada 1.74               if (!tmpInstance.isUninitialized())
 655 s.manicka      1.72               {
 656 venkat.puvvada 1.74                   index = tmpInstance.findProperty("RegisteredName");
 657                                       if (index != PEG_NOT_FOUND)
 658 s.manicka      1.72                   {
 659 kumpf          1.81                       const CIMValue &tmpVal =
 660 venkat.puvvada 1.74                           tmpInstance.getProperty(index).getValue();
 661                                           if (!tmpVal.isNull())
 662                                           {
 663                                               tmpVal.get(profileName);
 664                                           }
 665 s.manicka      1.72                   }
 666                                   }
 667                                   if (String::compareNoCase(profileName, String("SMI-S")) == 0)
 668                                   {
 669                                       expectedTargetRole =
 670                                           ELEMENTCONFORMSTOPROFILE_PROPERTY_MANAGEDELEMENT;
 671                                       expectedOriginRole =
 672                                           ELEMENTCONFORMSTOPROFILE_PROPERTY_CONFORMANTSTANDARD;
 673                                   }
 674                                   else
 675                                   {
 676                                       expectedTargetRole =
 677                                           ELEMENTCONFORMSTOPROFILE_PROPERTY_CONFORMANTSTANDARD;
 678                                       expectedOriginRole =
 679                                           ELEMENTCONFORMSTOPROFILE_PROPERTY_MANAGEDELEMENT;
 680                                   }
 681                                   break;
 682 a.dunfey       1.64           case PG_SUBPROFILEREQUIRESPROFILE:
 683                                   if(originClassEnum == PG_REGISTEREDPROFILE)
 684                                   {
 685                                       expectedTargetRole = PROPERTY_DEPENDENT;
 686                                       expectedOriginRole = PROPERTY_ANTECEDENT;
 687                                   }
 688                                   else if(originClassEnum == PG_REGISTEREDSUBPROFILE)
 689                                   {
 690                                       expectedTargetRole = PROPERTY_ANTECEDENT;
 691                                       expectedOriginRole = PROPERTY_DEPENDENT;
 692                                   }
 693                                   break;
 694 s.manicka      1.72           case PG_REFERENCEDPROFILE:
 695                                   if (originClassEnum == PG_REGISTEREDSUBPROFILE)
 696                                   {
 697                                       expectedTargetRole = PROPERTY_ANTECEDENT;
 698                                       expectedOriginRole = PROPERTY_DEPENDENT;
 699                                   }
 700                                   else if (originClassEnum == PG_REGISTEREDPROFILE)
 701                                   {
 702                                       if ((targetProperty.size() != 0) &&
 703                                           (originProperty.size() != 0) &&
 704                                           String::equalNoCase(targetProperty, originProperty))
 705                                       {
 706                                           return false;
 707                                       }
 708                                       if (targetProperty.size() != 0)
 709                                       {
 710                                           if (!(String::equalNoCase(targetProperty, "Antecedent") ||
 711                                               String::equalNoCase(targetProperty, "Dependent") ))
 712                                           {
 713                                               return false;
 714                                           }
 715 s.manicka      1.72                   }
 716                                       if (originProperty.size() != 0)
 717                                       {
 718                                           if (!(String::equalNoCase(originProperty, "Antecedent") ||
 719                                               String::equalNoCase(originProperty, "Dependent") ))
 720                                           {
 721                                               return false;
 722                                           }
 723                                       }
 724                                       if (String::equalNoCase(originProperty, "Antecedent") &&
 725                                           targetProperty.size() == 0)
 726                                       {
 727                                           targetProperty = String("Dependent");
 728                                       }
 729                                       if (String::equalNoCase(originProperty, "Dependent") &&
 730                                           targetProperty.size() == 0)
 731                                       {
 732                                           targetProperty = String("Antecedent");
 733                                       }
 734                                       if (String::equalNoCase(targetProperty, "Antecedent") &&
 735                                           originProperty.size() == 0)
 736 s.manicka      1.72                   {
 737                                           originProperty = String("Dependent");
 738                                       }
 739                                       if (String::equalNoCase(targetProperty, "Dependent") &&
 740                                           originProperty.size() == 0)
 741                                       {
 742                                           originProperty = String("Antecedent");
 743                                       }
 744                                       return true;
 745                                   }
 746                                   break;
 747 a.dunfey       1.64           case PG_ELEMENTSOFTWAREIDENTITY:
 748                                   if(originClassEnum == PG_SOFTWAREIDENTITY)
 749                                   {
 750                                       expectedTargetRole = PROPERTY_DEPENDENT;
 751                                       expectedOriginRole = PROPERTY_ANTECEDENT;
 752                                   }
 753                                   else if(originClassEnum == PG_REGISTEREDPROFILE ||
 754                                       originClassEnum == PG_REGISTEREDSUBPROFILE)
 755                                   {
 756                                       expectedTargetRole = PROPERTY_ANTECEDENT;
 757                                       expectedOriginRole = PROPERTY_DEPENDENT;
 758                                   }
 759                                   break;
 760                               case PG_INSTALLEDSOFTWAREIDENTITY:
 761                                   if(originClassEnum == PG_SOFTWAREIDENTITY)
 762                                   {
 763                                       expectedTargetRole = INSTALLEDSOFTWAREIDENTITY_PROPERTY_SYSTEM;
 764                                       expectedOriginRole =
 765                                           INSTALLEDSOFTWAREIDENTITY_PROPERTY_INSTALLEDSOFTWARE;
 766                                   }
 767                                   else if(originClassEnum == PG_COMPUTERSYSTEM)
 768 a.dunfey       1.64               {
 769                                       expectedTargetRole =
 770                                           INSTALLEDSOFTWAREIDENTITY_PROPERTY_INSTALLEDSOFTWARE;
 771                                       expectedOriginRole = INSTALLEDSOFTWAREIDENTITY_PROPERTY_SYSTEM;
 772                                   }
 773                                   break;
 774                               case PG_HOSTEDACCESSPOINT:
 775                                   if(originClassEnum == PG_COMPUTERSYSTEM)
 776                                   {
 777                                       expectedTargetRole = PROPERTY_DEPENDENT;
 778                                       expectedOriginRole = PROPERTY_ANTECEDENT;
 779                                   }
 780                                   else if(originClassEnum == PG_CIMXMLCOMMUNICATIONMECHANISM)
 781                                   {
 782                                       expectedTargetRole = PROPERTY_ANTECEDENT;
 783                                       expectedOriginRole = PROPERTY_DEPENDENT;
 784                                   }
 785                               case PG_HOSTEDOBJECTMANAGER:
 786                                   if(originClassEnum == PG_COMPUTERSYSTEM)
 787                                   {
 788                                       expectedTargetRole = PROPERTY_DEPENDENT;
 789 a.dunfey       1.64                   expectedOriginRole = PROPERTY_ANTECEDENT;
 790                                   }
 791                                   else if(originClassEnum == PG_OBJECTMANAGER)
 792                                   {
 793                                       expectedTargetRole = PROPERTY_ANTECEDENT;
 794                                       expectedOriginRole = PROPERTY_DEPENDENT;
 795                                   }
 796                                   break;
 797 venkat.puvvada 1.75     #ifdef PEGASUS_ENABLE_DMTF_INDICATION_PROFILE_SUPPORT
 798                               case PG_HOSTEDINDICATIONSERVICE:
 799                                   if(originClassEnum == PG_COMPUTERSYSTEM)
 800                                   {
 801                                       expectedTargetRole = PROPERTY_DEPENDENT;
 802                                       expectedOriginRole = PROPERTY_ANTECEDENT;
 803                                   }
 804                                   break;
 805                         #endif
 806 a.dunfey       1.64           default:
 807                                   break;
 808 tony           1.6          }
 809 a.dunfey       1.64     
 810 karl           1.5          //
 811 a.dunfey       1.64         // The rest of this method checks to see if target role and origin roles
 812                             // were found for the association and origin class combination and, if
 813                             // found, checks against the input target and origin roles if provided.
 814                             // Failure for any of these tests points to an invalid association
 815                             // traversal request.
 816 karl           1.5          //
 817 a.dunfey       1.64         if(expectedTargetRole.isNull() ||
 818                                 expectedOriginRole.isNull())
 819 tony           1.6          {
 820                                 PEG_METHOD_EXIT();
 821 a.dunfey       1.64             return false;
 822 tony           1.6          }
 823                         
 824 a.dunfey       1.64         if(targetProperty.size() == 0)
 825 karl           1.5          {
 826 a.dunfey       1.64             targetProperty = expectedTargetRole.getString();
 827 karl           1.5          }
 828 a.dunfey       1.64         else if(!expectedTargetRole.equal(targetProperty))
 829 karl           1.48         {
 830 a.dunfey       1.64             PEG_METHOD_EXIT();
 831                                 return false;
 832 karl           1.48         }
 833 david.dillard  1.32     
 834 a.dunfey       1.64         if(originProperty.size() == 0)
 835 tony           1.6          {
 836 a.dunfey       1.64             originProperty = expectedOriginRole.getString();
 837 tony           1.6          }
 838 a.dunfey       1.64         else if(!expectedOriginRole.equal(originProperty))
 839 tony           1.6          {
 840                                 PEG_METHOD_EXIT();
 841 a.dunfey       1.64             return false;
 842 tony           1.6          }
 843 kumpf          1.69     
 844 tony           1.6          PEG_METHOD_EXIT();
 845 a.dunfey       1.64         return true;
 846 karl           1.5      }
 847 karl           1.28     
 848 a.dunfey       1.64     //
 849                         // Local version of the references operation. It validates the input
 850                         // parameters, setting the origin and target property values if not set
 851                         // already, and then performs an enumeration on the association class. It then
 852                         // filters the results of that enumeration to see if one of the reference
 853                         // properties matches the objectName parameter passed into the method. If so,
 854                         // then it is added to the array of association instances to be returned.
 855                         //
 856                         Array<CIMInstance> InteropProvider::localReferences(
 857                             const OperationContext & context,
 858                             const CIMObjectPath & objectName,
 859                             const CIMName & assocClass,
 860                             String & originProperty,
 861                             String & targetProperty,
 862                             const CIMPropertyList & propertyList,
 863                             const CIMName & targetClass)
 864 karl           1.5      {
 865 tony           1.6          PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,
 866 a.dunfey       1.64             "InteropProvider::localReferences()");
 867 karl           1.5      
 868 a.dunfey       1.64         Array<CIMInstance> instances;
 869                             CIMName originClass = objectName.getClassName();
 870                         
 871                             Array<CIMName> targetSubclasses;
 872                             CIMNamespaceName lastTargetNamespace;
 873                             CIMNamespaceName originNamespace(objectName.getNameSpace());
 874                         
 875                             // Check that the association traversal request is valid
 876 s.manicka      1.72         if (validAssocClassForObject(
 877 kumpf          1.81             context,
 878                                 assocClass,
 879 s.manicka      1.72             objectName,
 880 kumpf          1.81             originNamespace,
 881                                 originProperty,
 882 s.manicka      1.72             targetProperty))
 883 a.dunfey       1.64         {
 884                                 // retrieve all of the association class instances
 885                                 Array<CIMInstance> localInstances = localEnumerateInstances(context,
 886                                     CIMObjectPath(hostName, originNamespace,
 887                                         assocClass));
 888                                 // Filter the association class instances based on the origin instance
 889                                 // and other input parameters.
 890                                 for(Uint32 i = 0, n = localInstances.size(); i < n; ++i)
 891                                 {
 892                                     CIMInstance & currentInstance = localInstances[i];
 893                                     CIMObjectPath originPath = getRequiredValue<CIMObjectPath>(
 894                                         currentInstance, originProperty);
 895                                     originPath.setNameSpace(objectName.getNameSpace());
 896                                     originPath.setHost(objectName.getHost());
 897                                     // Only include instances where the origin instance is present in
 898                                     // the association.
 899                                     if(originPath.identical(objectName))
 900 karl           1.5                  {
 901 a.dunfey       1.64                     if(!targetClass.isNull())
 902 karl           1.5                      {
 903 a.dunfey       1.64                         // Have to check if the target reference is of the
 904                                             // targetClass type. We first must determine all the
 905                                             // possible subclasses of the targetClass in the target
 906                                             // namespace.
 907                                             CIMObjectPath targetPath = getRequiredValue<CIMObjectPath>(
 908                                                 currentInstance, targetProperty);
 909                         
 910                                             CIMNamespaceName targetNamespace(
 911                                                 targetPath.getNameSpace());
 912                                             if(targetNamespace.isNull())
 913                                             {
 914                                                 targetNamespace = originNamespace;
 915                                                 targetPath.setNameSpace(targetNamespace);
 916                                             }
 917                                             if(targetNamespace != lastTargetNamespace)
 918                                             {
 919                                                 try
 920                                                 {
 921                                                     targetSubclasses = repository->enumerateClassNames(
 922                                                         targetNamespace, targetClass, true);
 923                                                 }
 924 a.dunfey       1.64                             catch(...)
 925                                                 {
 926                                                     // If an exception was thrown during enumeration,
 927                                                     // then the base class didn't exist in the
 928                                                     // namespace, so the target instance retrieved
 929                                                     // must not match the targetClass parameter.
 930                                                     continue;
 931                                                 }
 932                                                 targetSubclasses.append(targetClass);
 933                                                 lastTargetNamespace = targetNamespace;
 934                                             }
 935 david.dillard  1.32     
 936 a.dunfey       1.64                         // Try to find the targetPath's class in the search space
 937                                             CIMName targetPathClass = targetPath.getClassName();
 938                                             for(Uint32 j = 0, m = targetSubclasses.size(); j < m; ++j)
 939                                             {
 940                                                 if(targetPathClass == targetSubclasses[j])
 941                                                 {
 942                                                     instances.append(currentInstance);
 943                                                     break;
 944                                                 }
 945                                             }
 946                                         }
 947                                         else
 948 karl           1.46                     {
 949 a.dunfey       1.64                         instances.append(currentInstance);
 950 karl           1.46                     }
 951 tony           1.6                  }
 952 karl           1.1              }
 953 karl           1.46         }
 954                         
 955                             PEG_METHOD_EXIT();
 956 a.dunfey       1.64         return instances;
 957 karl           1.1      }
 958                         
 959 a.dunfey       1.64     
 960                         //
 961                         // Builds an instance of the class named className. Gets Class defintion and
 962                         // fills in the correct properties from the class.  This requires a repository
 963                         // getClass request for each instance built. The skeleton is built by
 964                         // creating the instance and copying qualifiers and properties from
 965                         // the class. Finally the instance is cloned to separate it from the
 966                         // original objects.
 967                         // NOTE: This is very inefficient for anything larger than a few instances.
 968                         // We should separate the get from the createSkeleton.
 969                         // @param className CIMName of the class for which the instance is to be built
 970                         // @return CIMInstance of this class with properties complete.
 971                         // @exception passes on any exceptions received from the repository request.
 972                         //
 973                         CIMInstance InteropProvider::buildInstanceSkeleton(
 974                               const CIMNamespaceName & nameSpace,
 975                               const CIMName& className,
 976 kumpf          1.78           Boolean includeQualifiers,
 977 a.dunfey       1.64           CIMClass& returnedClass)
 978 karl           1.1      {
 979 tony           1.6          PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,
 980 a.dunfey       1.64             "InteropProvider::_buildInstanceSkeleton()");
 981                             // get class with lo = false, qualifier = true classorig = true
 982                             returnedClass = repository->getClass(nameSpace,
 983                                 className, false, true, true);
 984 kumpf          1.78         CIMInstance skeleton = returnedClass.buildInstance(
 985                                 includeQualifiers, true, CIMPropertyList());
 986 karl           1.46     
 987                             PEG_METHOD_EXIT();
 988 a.dunfey       1.64         return skeleton;
 989 karl           1.1      }
 990                         
 991 karl           1.46     
 992 a.dunfey       1.64     CIMInstance InteropProvider::buildDependencyInstance(
 993                             const String & antecedentId,
 994                             const CIMName & antecedentClass,
 995                             const String & dependentId,
 996                             const CIMName & dependentClass,
 997                             const CIMClass & dependencyClass)
 998 karl           1.1      {
 999 a.dunfey       1.64         Array<CIMKeyBinding> dependentKeys;
1000 karl           1.52     
1001 a.dunfey       1.64         dependentKeys.append(CIMKeyBinding(
1002                                 COMMON_PROPERTY_INSTANCEID,
1003                                 dependentId,CIMKeyBinding::STRING));
1004 karl           1.46     
1005 a.dunfey       1.64         return buildDependencyInstanceFromPaths(
1006                                 buildDependencyReference(hostName, antecedentId, antecedentClass),
1007                                 buildDependencyReference(hostName, dependentId, dependentClass),
1008                                 dependencyClass);
1009 tony           1.6      }
1010 karl           1.46     
1011 a.dunfey       1.65     void InteropProvider::initProvider()
1012                         {
1013                             if(providerInitialized)
1014                                 return;
1015                             // Placed METHOD_ENTER trace statement after checking whether the
1016                             // provider is initialized because this method will be called for every
1017                             // operation through the InteropProvider, and this method is only
1018                             // interesting the first time it is successfully run.
1019                             PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,
1020                                 "InteropProvider::initProvider()");
1021                         
1022                             AutoMutex lock(interopMut);
1023                             if(!providerInitialized)
1024                             {
1025                                 //
1026                                 // Initialize the object manager instance for the CIM Server, and
1027                                 // retrieve the object manager's name property. This is retrieved once
1028                                 // and stored for use in constructing other instances requiring its
1029                                 // value.
1030                                 //
1031                                 CIMInstance objectManager = getObjectManagerInstance();
1032 a.dunfey       1.65             objectManager.getProperty(objectManager.findProperty(
1033                                     OM_PROPERTY_NAME)).getValue().get(objectManagerName);
1034                         
1035                                 //
1036 karl           1.66             // Determine whether the CIMOM should be gathering statistical data
1037 a.dunfey       1.65             // based on the GatherStatisticalData property in the object manager.
1038                                 //
1039                                 Uint32 gatherDataIndex = objectManager.findProperty(
1040                                     OM_PROPERTY_GATHERSTATISTICALDATA);
1041                                 if(gatherDataIndex != PEG_NOT_FOUND)
1042                                 {
1043                                     CIMConstProperty gatherDataProp =
1044                                         objectManager.getProperty(gatherDataIndex);
1045                                     if (gatherDataProp.getType() == CIMTYPE_BOOLEAN)
1046                                     {
1047                                         CIMValue gatherDataVal  = gatherDataProp.getValue();
1048                                         if (!gatherDataVal.isNull())
1049                                         {
1050                                             Boolean gatherData;
1051                                             gatherDataVal.get(gatherData);
1052 kumpf          1.69                         if (gatherData == true)
1053 a.dunfey       1.65                         {
1054                                                 StatisticalData* sd = StatisticalData::current();
1055                                                 sd->setCopyGSD(true);
1056                                             }
1057                                         }
1058                                     }
1059                                 }
1060                         
1061                                 // Cache this class definition for use later.
1062                                 profileCapabilitiesClass = repository->getClass(
1063                                     PEGASUS_NAMESPACENAME_INTEROP,
1064 karl           1.66                 PEGASUS_CLASSNAME_PG_PROVIDERPROFILECAPABILITIES,
1065 venkat.puvvada 1.74                 false,
1066                                     true,
1067                                     false);
1068 karl           1.66     
1069 a.dunfey       1.65             providerClassifications.append(Uint16(5)); // "Instrumentation"
1070                         
1071 venkat.puvvada 1.74             // initialize namespaces.
1072                                 initializeNamespaces();
1073                         
1074                                 // Now cache the Registration info used for ElementConformsToProfile
1075                                 cacheProfileRegistrationInfo();
1076                         
1077                                 providerInitialized = true;
1078                             }
1079                             PEG_METHOD_EXIT();
1080                         }
1081                         
1082                         //
1083                         // Initialize the namespaces so that all namespaces with the
1084                         // CIM_ElementConformsToProfile class also have the
1085                         // PG_ElementConformsToProfile class. Needed in order to implement
1086                         // the cross-namespace ElementConformsToProfile association in both
1087                         // directions.
1088                         //
1089                         void InteropProvider::initializeNamespaces()
1090                         {
1091                             Array<CIMNamespaceName> namespaceNames =  repository->enumerateNameSpaces();
1092 venkat.puvvada 1.74         // get the PG_ElementConformstoProfile class without the qualifiers
1093                             // and then add just the required ASSOCIATION qualifier, so that
1094                             // resolveclass doesn't fail for the test/EmbeddedInstance/Dynamic
1095                             // namespace, which uses the CIM25 schema that doesn't include any
1096                             // of the new qualifiers added to this class in later versions of
1097                             // the CIMSchema.
1098                             CIMClass conformsClass = repository->getClass(
1099                                 PEGASUS_NAMESPACENAME_INTEROP,
1100                                 PEGASUS_CLASSNAME_PG_ELEMENTCONFORMSTOPROFILE,
1101                                 true,
1102                                 false);
1103                             conformsClass.addQualifier(
1104                                 CIMQualifier(CIMName("ASSOCIATION"), CIMValue(true)));
1105                             CIMClass profileClass = repository->getClass(
1106                                 PEGASUS_NAMESPACENAME_INTEROP,
1107                                 PEGASUS_CLASSNAME_PG_REGISTEREDPROFILE,
1108                                 true,
1109                                 false);
1110                             for(Uint32 i = 0, n = namespaceNames.size(); i < n; ++i)
1111                             {
1112                                 // Check if the PG_ElementConformsToProfile class is present
1113 venkat.puvvada 1.74             CIMNamespaceName & currentNamespace = namespaceNames[i];
1114                                 CIMClass tmpCimClass;
1115                                 CIMClass tmpPgClass;
1116                                 CIMClass tmpPgProfileClass;
1117                                 try
1118                                 {
1119                                     // Look for these classes in the same try-block since the
1120                                     // second depends on the first
1121                                     tmpCimClass = repository->getClass(
1122                                         currentNamespace,
1123                                         PEGASUS_CLASSNAME_CIM_ELEMENTCONFORMSTOPROFILE);
1124                                     tmpPgClass = repository->getClass(
1125                                         currentNamespace,
1126                                         PEGASUS_CLASSNAME_PG_ELEMENTCONFORMSTOPROFILE);
1127                                 }
1128                                 catch(const Exception &)
1129                                 {
1130                                 }
1131                                 try
1132                                 {
1133                                     tmpPgProfileClass = repository->getClass(
1134 venkat.puvvada 1.74                     currentNamespace,
1135                                         PEGASUS_CLASSNAME_PG_REGISTEREDPROFILE);
1136                                 }
1137                                 catch(const Exception &)
1138                                 {
1139                                     // Note: if any of the above three classes aren't found,
1140                                     // an exception will be thrown, which we can ignore since it's
1141                                     // an expected case
1142                                     // TBD: Log trace message?
1143                                 }
1144                         
1145                                 // If the CIM_ElementConformsToProfile class is present, but
1146                                 // the PG_ElementConformsToProfile or PG_RegisteredProfile
1147                                 // class is not, then add it to that namespace.
1148 a.dunfey       1.65             //
1149 venkat.puvvada 1.74             // Note that we don't have to check for the
1150                                 // CIM_RegisteredProfile class because if the
1151                                 // CIM_ElementConformsToProfile class is present, the
1152                                 // CIM_RegisteredProfile class must also be present.
1153                                 if(!tmpCimClass.isUninitialized())
1154 a.dunfey       1.65             {
1155 venkat.puvvada 1.74                 if(tmpPgClass.isUninitialized())
1156 a.dunfey       1.65                 {
1157 venkat.puvvada 1.74                     CIMClass newclass = conformsClass.clone();
1158                                         CIMObjectPath newPath = conformsClass.getPath();
1159                                         newPath.setNameSpace(currentNamespace);
1160                                         newclass.setPath(newPath);
1161                                         repository->createClass(
1162                                             currentNamespace,
1163                                             newclass);
1164 a.dunfey       1.65                 }
1165 venkat.puvvada 1.74                 if(tmpPgProfileClass.isUninitialized())
1166 a.dunfey       1.65                 {
1167 venkat.puvvada 1.74                     CIMClass newclass = profileClass.clone();
1168                                         CIMObjectPath newPath = profileClass.getPath();
1169                                         newPath.setNameSpace(currentNamespace);
1170                                         newclass.setPath(newPath);
1171                                         repository->createClass(
1172                                             currentNamespace,
1173                                             newclass);
1174 a.dunfey       1.65                 }
1175                                 }
1176                             }
1177                         }
1178                         
1179                         PEGASUS_NAMESPACE_END
1180 a.dunfey       1.64     // END OF FILE

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2