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

  1 martin 1.8 //%LICENSE////////////////////////////////////////////////////////////////
  2 martin 1.9 //
  3 martin 1.8 // 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.9 //
 10 martin 1.8 // 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.9 //
 17 martin 1.8 // The above copyright notice and this permission notice shall be included
 18            // in all copies or substantial portions of the Software.
 19 martin 1.9 //
 20 martin 1.8 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
 21 martin 1.9 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
 22 martin 1.8 // 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.9 //
 28 martin 1.8 //////////////////////////////////////////////////////////////////////////
 29 kumpf  1.4 //
 30 s.manicka 1.5 //%////////////////////////////////////////////////////////////////////////////
 31 a.dunfey  1.1 
 32               
 33               ///////////////////////////////////////////////////////////////////////////////
 34               //  Interop Provider - This provider services those classes from the
 35               //  DMTF Interop schema in an implementation compliant with the SMI-S v1.1
 36               //  Server Profile
 37               //
 38               //  Please see PG_ServerProfile20.mof in the directory
 39               //  $(PEGASUS_ROOT)/Schemas/Pegasus/InterOp/VER20 for retails regarding the
 40               //  classes supported by this control provider.
 41               //
 42 kumpf     1.10 //  Interop forces all creates to the PEGASUS_NAMESPACENAME_INTEROP
 43                //  namespace. There is a test on each operation that returns
 44 a.dunfey  1.1  //  the Invalid Class CIMDError
 45                //  This is a control provider and as such uses the Tracer functions
 46                //  for data and function traces.  Since we do not expect high volume
 47                //  use we added a number of traces to help diagnostics.
 48                ///////////////////////////////////////////////////////////////////////////////
 49                
 50                #include "InteropProvider.h"
 51                #include "InteropProviderUtils.h"
 52                #include "InteropConstants.h"
 53                
 54                PEGASUS_USING_STD;
 55 a.dunfey  1.2  PEGASUS_NAMESPACE_BEGIN
 56 a.dunfey  1.1  
 57                //
 58                // Given the two references in the association, this function creates an
 59                // instance of the PG_ElementConformsToProfile class.
 60                //
 61                CIMInstance buildElementConformsToProfile(
 62                    const CIMObjectPath & currentProfile,
 63                    const CIMObjectPath & currentElement,
 64                    const CIMClass & elementConformsClass)
 65                {
 66                    Array<CIMName> elementPropArray;
 67                    elementPropArray.append(
 68                        ELEMENTCONFORMSTOPROFILE_PROPERTY_CONFORMANTSTANDARD);
 69                    elementPropArray.append(
 70                        ELEMENTCONFORMSTOPROFILE_PROPERTY_MANAGEDELEMENT);
 71                    CIMPropertyList elementPropList(elementPropArray);
 72                
 73                    CIMInstance tmpInstance =
 74                        elementConformsClass.buildInstance(false, false,
 75                            elementPropList);
 76                    setPropertyValue(tmpInstance,
 77 a.dunfey  1.1          ELEMENTCONFORMSTOPROFILE_PROPERTY_CONFORMANTSTANDARD,
 78                        currentProfile);
 79                    setPropertyValue(tmpInstance,
 80                        ELEMENTCONFORMSTOPROFILE_PROPERTY_MANAGEDELEMENT,
 81                        currentElement);
 82                    tmpInstance.setPath(tmpInstance.buildPath(
 83                        elementConformsClass));
 84                    return tmpInstance;
 85                }
 86                
 87 s.manicka 1.5  Array<CIMInstance> InteropProvider::enumElementConformsToProfileRPRPInstances(
 88 kumpf     1.10     const OperationContext & opContext,
 89 s.manicka 1.5      const CIMNamespaceName & opNamespace)
 90                {
 91                    CIMClass elementConformsClass = repository->getClass(
 92                        PEGASUS_NAMESPACENAME_INTEROP,
 93                        PEGASUS_CLASSNAME_PG_ELEMENTCONFORMSTOPROFILE_RP_RP,
 94                        false, true, false);
 95                
 96                    Array<CIMInstance> instances;
 97                    CIMObjectPath smisVersionProfile, profRegProfile;
 98                
 99                    if (opNamespace == PEGASUS_NAMESPACENAME_INTEROP)
100                    {
101 kumpf     1.10         //Add associations between the 1.2 SMIS-Version profile and all
102                        //the version 1.2.0 profiles and subprofiles.
103 s.manicka 1.5          smisVersionProfile = buildDependencyReference(
104                            hostName,
105                            buildProfileInstanceId(SNIA_NAME, "SMI-S", SNIA_VER_120),
106                            PEGASUS_CLASSNAME_PG_REGISTEREDPROFILE);
107                
108 kumpf     1.10         Array<CIMInstance> profileInstances =
109 s.manicka 1.5              enumRegisteredProfileInstances();
110 kumpf     1.10         Array<CIMInstance> subprofileInstances =
111 s.manicka 1.5              enumRegisteredSubProfileInstances();
112                        profileInstances.appendArray(subprofileInstances);
113                        Array<CIMInstance> profilesForVersion = getProfilesForVersion(
114 venkat.puvvada 1.12             profileInstances, SNIA_NUM, 1, 2, 0);
115 s.manicka      1.5          for (Uint32 i = 0, n = profilesForVersion.size(); i < n; ++i)
116                             {
117                                 instances.append(buildElementConformsToProfile(
118                                     smisVersionProfile,
119 kumpf          1.10                 profilesForVersion[i].getPath(),
120 s.manicka      1.5                  elementConformsClass));
121                             }
122                         }
123                         return instances;
124                     }
125                     
126 a.dunfey       1.1  //
127                     // Enumerates all of the ElementConformsToProfile association instances.
128                     //
129                     Array<CIMInstance> InteropProvider::enumElementConformsToProfileInstances(
130                         const OperationContext & opContext, const CIMNamespaceName & opNamespace)
131                     {
132                         CIMClass elementConformsClass = repository->getClass(
133                             PEGASUS_NAMESPACENAME_INTEROP,
134                             PEGASUS_CLASSNAME_PG_ELEMENTCONFORMSTOPROFILE,
135                             false, true, false);
136                     
137                         AutoMutex holder(interopMut);
138                         Array<CIMInstance> instances;
139                         verifyCachedInfo();
140                         // Loop through the cached profile Id's and related info about its
141                         // conforming elements.
142 kumpf          1.4      for (Uint32 i = 0, n = profileIds.size(); i < n; ++i)
143 a.dunfey       1.1      {
144                             String & profileId = profileIds[i];
145                             Array<CIMName> & elementList = conformingElements[i];
146                             Array<CIMNamespaceName> & namespaceList = elementNamespaces[i];
147                             Array<CIMObjectPath> conformingElementPaths;
148 kumpf          1.4          for (Uint32 j = 0, m = elementList.size(); j < m; ++j)
149 a.dunfey       1.1          {
150                                 CIMName & currentElement = elementList[j];
151                                 CIMNamespaceName & currentNamespace = namespaceList[j];
152                     
153 kumpf          1.4              if (opNamespace == PEGASUS_NAMESPACENAME_INTEROP ||
154 a.dunfey       1.1                  opNamespace == currentNamespace)
155                                 {
156                                     String currentElementStr(currentElement.getString());
157 kumpf          1.4                  if (currentElementStr.find(PEGASUS_DYNAMIC) == 0)
158 a.dunfey       1.1                  {
159                                         // If the provider profile registration did not provide a
160                                         // list of conforming elements (presumably because there is
161                                         // no such definite list), then the provider is required
162                                         // to provide instances of ElementConformsToProfile in the
163                                         // vendor namespace, so we do not generate instances.
164 kumpf          1.4                      if (opNamespace != PEGASUS_NAMESPACENAME_INTEROP)
165 a.dunfey       1.1                      {
166                                             continue;
167                                         }
168                                         CIMName subclassName(
169                                             currentElementStr.subString(PEGASUS_DYNAMIC_LEN));
170                                         Array<CIMInstance> elementConformsInstances =
171                                             cimomHandle.enumerateInstances(opContext,
172                                             currentNamespace, subclassName, true, false, false,
173                                             true, CIMPropertyList());
174                     
175                                         // Retrieve the Conforming Element
176 kumpf          1.4                      for (Uint32 k = 0, x = elementConformsInstances.size();
177 a.dunfey       1.1                          k < x; ++k)
178                                         {
179                                             CIMInstance & currentInstance =
180                                                 elementConformsInstances[k];
181                     
182 kumpf          1.4                          // NOCHKSRC
183 a.dunfey       1.1                          // Make sure that the current instance points to the
184                                             // current profile ID.
185                                             CIMObjectPath profilePath =
186                                                 getRequiredValue<CIMObjectPath>(
187                                                     elementConformsInstances[k],
188                                                     ELEMENTCONFORMSTOPROFILE_PROPERTY_CONFORMANTSTANDARD);
189 kumpf          1.4                          // DOCHKSRC
190 a.dunfey       1.1                          const Array<CIMKeyBinding> & keys =
191                                                 profilePath.getKeyBindings();
192 kumpf          1.4                          if (keys.size() != 1)
193 a.dunfey       1.1                              continue;
194 kumpf          1.4                          if (keys.size() == 1 && keys[0].getValue() == profileId)
195 a.dunfey       1.1                          {
196 kumpf          1.4                              // NOCHKSRC
197 a.dunfey       1.1                              conformingElementPaths.append(
198                                                     getRequiredValue<CIMObjectPath>(
199                                                     currentInstance,
200                                                     ELEMENTCONFORMSTOPROFILE_PROPERTY_MANAGEDELEMENT));
201 kumpf          1.4                              // DOCHKSRC
202 a.dunfey       1.1                          }
203                                         }
204                                     }
205                                     else
206                                     {
207                                         // All of the instances of the current element in the
208                                         // corresponding namespace conform to the current profile.
209                                         Array<CIMObjectPath> paths =
210                                             cimomHandle.enumerateInstanceNames(opContext,
211                                                 currentNamespace, currentElement);
212                                         // Set the namespace in the paths just in case
213 kumpf          1.4                      for (Uint32 k = 0, x = paths.size();
214 a.dunfey       1.1                          k < x; ++k)
215                                         {
216                                             CIMObjectPath & curPath = paths[k];
217                                             curPath.setNameSpace(currentNamespace);
218                                             curPath.setHost(hostName);
219                                         }
220                                         conformingElementPaths.appendArray(paths);
221                                     }
222                                 }
223                             }
224                     
225                             // Create the object path for the RegisteredProfile using the given
226                             // profileId.
227                             CIMObjectPath profilePath = buildDependencyReference(
228                                 hostName, profileIds[i], PEGASUS_CLASSNAME_PG_REGISTEREDPROFILE);
229                     
230                             // Build all of the ElementConformsToProfile instances for the current
231                             // profile.
232 kumpf          1.4          for (Uint32 k = 0, x = conformingElementPaths.size(); k < x; ++k)
233 a.dunfey       1.1          {
234                                 instances.append(buildElementConformsToProfile(profilePath,
235                                     conformingElementPaths[k], elementConformsClass));
236                             }
237                         }
238                     
239                         // Now add the default instance: the association between the Server Profile
240                         // and the ObjectManager (if we're in the Interop namespace)
241 kumpf          1.4      if (opNamespace == PEGASUS_NAMESPACENAME_INTEROP)
242 a.dunfey       1.1      {
243 s.manicka      1.5          // Build up the Object Path for the server profile version 1.1.0
244                             CIMObjectPath serverProfile = buildDependencyReference(
245                                 hostName,
246 a.dunfey       1.1              buildProfileInstanceId(SNIA_NAME, "Server", SNIA_VER_110),
247                                 PEGASUS_CLASSNAME_PG_REGISTEREDPROFILE);
248                             // Retrieve the Object Manager instance
249                             CIMInstance objManager = getObjectManagerInstance();
250                     
251 s.manicka      1.5          instances.append(
252                                 buildElementConformsToProfile(
253                                     serverProfile,
254 kumpf          1.10                 objManager.getPath(),
255 s.manicka      1.5                  elementConformsClass));
256                     
257                             // Build up the Object Path for the server profile ver 1.2.0
258                             // and add the elementconformstoprofile association instance
259                             serverProfile = buildDependencyReference(
260                                 hostName,
261                                 buildProfileInstanceId(SNIA_NAME, "Server", SNIA_VER_120),
262                                 PEGASUS_CLASSNAME_PG_REGISTEREDPROFILE);
263                             instances.append(
264                                 buildElementConformsToProfile(
265                                     serverProfile,
266 kumpf          1.10                 objManager.getPath(),
267 s.manicka      1.5                  elementConformsClass));
268 kumpf          1.10 
269 a.dunfey       1.1      }
270 venkat.puvvada 1.14 
271                     #ifdef PEGASUS_ENABLE_DMTF_INDICATION_PROFILE_SUPPORT
272                         // Now add the  association between the Indication profile
273                         // and IndicationService
274                         if (opNamespace == PEGASUS_NAMESPACENAME_INTEROP)
275                         {
276                             CIMObjectPath serverProfile = buildDependencyReference(
277                                 hostName,
278                                 buildProfileInstanceId(DMTF_NAME, "Indications", DMTF_VER_100),
279                                 PEGASUS_CLASSNAME_PG_REGISTEREDPROFILE);
280                             // Retrieve the IndicationService instance
281                             Array<CIMInstance> indService =
282                                 enumIndicationServiceInstances(OperationContext());
283                     
284                             instances.append(
285                                 buildElementConformsToProfile(
286                                     serverProfile,
287                                     indService[0].getPath(),
288                                     elementConformsClass));
289                         }
290                     #endif
291 venkat.puvvada 1.14 
292 s.manicka      1.5      return instances;
293                     }
294                     
295                     //Method that filters the registered profile or registered subprofile instances
296 venkat.puvvada 1.12 //whose versions are greater or equal to the given version.
297 s.manicka      1.5  Array<CIMInstance> InteropProvider::getProfilesForVersion(
298                         Array<CIMInstance>& profiles,
299 venkat.puvvada 1.12     Uint16 regOrg,
300                         Uint32 majorVer,
301                         Uint32 minorVer,
302                         Uint32 updateVer)
303 s.manicka      1.5  {
304 venkat.puvvada 1.12     static const String SMISProfileName("SMI-S");
305 venkat.puvvada 1.13     static const String SNIAIndicationProfileName("Indication");
306                         static const String DMTFIndicationProfileName("Indications");
307 venkat.puvvada 1.12     static const String ServerProfileName("Server");
308                         static const String SoftwareProfileName("Software");
309                     
310 s.manicka      1.5      Array<CIMInstance> instances;
311                         instances.clear();
312                         for (Uint32 i = 0, n = profiles.size(); i < n; ++i)
313                         {
314                             String versionNumber;
315                             String profileName;
316 venkat.puvvada 1.12         Uint16 regOrgNo;
317                     
318 s.manicka      1.5          Uint32 index = profiles[i].findProperty("RegisteredVersion");
319                             if (index != PEG_NOT_FOUND)
320                             {
321                                 const CIMValue &tmpVal = profiles[i].getProperty(index).getValue();
322                                 if (!tmpVal.isNull())
323                                 {
324                                   tmpVal.get(versionNumber);
325                                 }
326                             }
327                             index = profiles[i].findProperty("RegisteredName");
328                             if (index != PEG_NOT_FOUND)
329                             {
330                                 const CIMValue &tmpVal = profiles[i].getProperty(index).getValue();
331                                 if (!tmpVal.isNull())
332                                 {
333                                     tmpVal.get(profileName);
334                                 }
335                             }
336 venkat.puvvada 1.12         index = profiles[i].findProperty("RegisteredOrganization");
337                             if (index != PEG_NOT_FOUND)
338                             {
339                                 const CIMValue &tmpVal = profiles[i].getProperty(index).getValue();
340                                 if (!tmpVal.isNull())
341                                 {
342                                     tmpVal.get(regOrgNo);
343                                 }
344                             }
345 a.dunfey       1.1  
346 venkat.puvvada 1.12         if (regOrg == regOrgNo)
347 s.manicka      1.5          {
348 venkat.puvvada 1.12             if (profileName == ServerProfileName ||
349 venkat.puvvada 1.13                 (regOrg == SNIA_NUM &&
350                                         profileName == SNIAIndicationProfileName) ||
351                                     (regOrg == DMTF_NUM
352                                         && profileName == DMTFIndicationProfileName) ||
353 venkat.puvvada 1.12                 profileName == SoftwareProfileName)
354                                 {
355                                     if (VersionUtil::isVersionGreaterOrEqual(
356                                         versionNumber, majorVer, minorVer, updateVer))
357                                     {
358                                         instances.append(profiles[i]);
359                                     }
360                                 }
361                                 else if (profileName != SMISProfileName)
362                                 {
363                                     instances.append(profiles[i]);
364                                 }
365 s.manicka      1.5          }
366                         }
367 a.dunfey       1.1      return instances;
368                     }
369                     
370                     
371                     typedef Array<String> StringArray;
372                     
373                     void InteropProvider::verifyCachedInfo()
374                     {
375 venkat.puvvada 1.6      if (!updateProfileCache.get())
376                         {
377                             return;
378                         }
379                         // At present cache will be rebuilt in the following conditions.
380                         // (1) When instances of PG_ProviderProfileCapabilities is created
381                         //     or deleted.
382                         // (2) When Provider and ProviderCapabilities instances
383                         //     are created or Provider, ProviderModule and ProviderCapabilities
384                         //     instance are deleted.
385                         // (3) When Provider or ProviderModule is disabled or enabled.
386                         AutoMutex mtx(interopMut);
387                         if (updateProfileCache.get())
388                         {
389                             initializeNamespaces();
390                             cacheProfileRegistrationInfo();
391                             updateProfileCache--;
392                         }
393 a.dunfey       1.1  }
394                     
395                     //
396                     // Function that determines in which namespaces a provider supports a given
397                     // class. This information is needed to properly implement the
398                     // ElementConformsToProfile association.
399                     //
400                     Array<String> findProviderNamespacesForElement(
401                         const String & moduleName, const String & providerName,
402                         const CIMName & elementClass, CIMRepository * repository,
403                         Array<CIMInstance> & providerCapabilitiesInstances)
404                     {
405                         Array<CIMInstance> capabilities;
406 kumpf          1.4      if (providerCapabilitiesInstances.size() == 0)
407 a.dunfey       1.1      {
408                             Array<CIMName> propList;
409                             propList.append(PROVIDERCAPABILITIES_PROPERTY_PROVIDERMODULENAME);
410                             propList.append(PROVIDERCAPABILITIES_PROPERTY_PROVIDERNAME);
411                             propList.append(PROVIDERCAPABILITIES_PROPERTY_NAMESPACES);
412                             propList.append(PROVIDERCAPABILITIES_PROPERTY_CLASSNAME);
413                             capabilities = repository->enumerateInstancesForClass(
414                                 PEGASUS_NAMESPACENAME_INTEROP,
415 kumpf          1.11             PEGASUS_CLASSNAME_PROVIDERCAPABILITIES, false, false);
416 a.dunfey       1.1      }
417                         else
418                         {
419                             capabilities = providerCapabilitiesInstances;
420                         }
421                     
422 kumpf          1.4      for (Uint32 i = 0, n = capabilities.size(); i < n; ++i)
423 a.dunfey       1.1      {
424                             CIMInstance & currentCapabilities = capabilities[i];
425                             Uint32 propIndex = currentCapabilities.findProperty(
426                                 PROVIDERCAPABILITIES_PROPERTY_PROVIDERMODULENAME);
427                             PEGASUS_ASSERT(propIndex != PEG_NOT_FOUND);
428                             String currentName;
429                             currentCapabilities.getProperty(propIndex).getValue().get(
430                                 currentName);
431 kumpf          1.4          if (currentName == moduleName)
432 a.dunfey       1.1          {
433                                 propIndex = currentCapabilities.findProperty(
434                                     PROVIDERCAPABILITIES_PROPERTY_PROVIDERNAME);
435                                 PEGASUS_ASSERT(propIndex != PEG_NOT_FOUND);
436                                 currentCapabilities.getProperty(propIndex).getValue().get(
437                                     currentName);
438 kumpf          1.4              if (currentName == providerName)
439 a.dunfey       1.1              {
440                                     propIndex = currentCapabilities.findProperty(
441                                         PROVIDERCAPABILITIES_PROPERTY_CLASSNAME);
442                                     PEGASUS_ASSERT(propIndex != PEG_NOT_FOUND);
443                                     currentCapabilities.getProperty(propIndex).getValue().get(
444                                         currentName);
445 kumpf          1.4                  if (elementClass.equal(CIMName(currentName)))
446 a.dunfey       1.1                  {
447                                         propIndex = currentCapabilities.findProperty(
448                                           PROVIDERCAPABILITIES_PROPERTY_NAMESPACES);
449                                         PEGASUS_ASSERT(propIndex != PEG_NOT_FOUND);
450                                         Array<String> namespaces;
451                                         currentCapabilities.getProperty(propIndex).getValue().get(
452                                             namespaces);
453                                         return namespaces;
454                                     }
455                                 }
456                             }
457                         }
458                     
459                         throw PEGASUS_CIM_EXCEPTION(CIM_ERR_NOT_FOUND,
460                             "Could not find provider capabilities registered for module " +
461                             moduleName + ", provider " + providerName + ", and class " +
462                             elementClass.getString());
463                     }
464                     
465                     //
466                     // Method that caches certain profile registration information. Specifically,
467 a.dunfey       1.1  // information pertaining to the ElementConformsToProfofile association
468                     // implementation is kept here.
469                     //
470                     void InteropProvider::cacheProfileRegistrationInfo()
471                     {
472                         Array<CIMInstance> instances;
473                         Array<CIMInstance> providerCapabilitiesInstances;
474 venkat.puvvada 1.6  
475                         // Clear existing cache
476                         profileIds.clear();
477                         conformingElements.clear();
478                         elementNamespaces.clear();
479                     
480 a.dunfey       1.1      // Retrieve all of the provider profile registration info
481                         Array<CIMName> propList;
482                         propList.append(CAPABILITIES_PROPERTY_PROVIDERMODULENAME);
483                         propList.append(CAPABILITIES_PROPERTY_PROVIDERNAME);
484                         propList.append(PROFILECAPABILITIES_PROPERTY_PROFILEVERSION);
485                         propList.append(PROFILECAPABILITIES_PROPERTY_REGISTEREDPROFILE);
486                         propList.append(PROFILECAPABILITIES_PROPERTY_OTHERREGISTEREDPROFILE);
487                         propList.append(PROFILECAPABILITIES_PROPERTY_OTHERPROFILEORGANIZATION);
488                         propList.append(PROFILECAPABILITIES_PROPERTY_CONFORMINGELEMENTS);
489 venkat.puvvada 1.6  
490 kumpf          1.10     Array<CIMInstance> providerProfileInstances =
491 venkat.puvvada 1.6          enumProviderProfileCapabilityInstances(
492                                 true,
493                                 false,
494                                 false,
495                                 CIMPropertyList(propList));
496                     
497 a.dunfey       1.1      CIMClass elementConformsClass = repository->getClass(
498                             PEGASUS_NAMESPACENAME_INTEROP,
499                             PEGASUS_CLASSNAME_PG_ELEMENTCONFORMSTOPROFILE,
500                             false, true, false);
501                         CIMClass registeredProfileClass = repository->getClass(
502                             PEGASUS_NAMESPACENAME_INTEROP,
503                             PEGASUS_CLASSNAME_PG_REGISTEREDPROFILE,
504                             false, true, false);
505                         Array<CIMInstance> capabilities;
506                     
507                         // Loop through the provider profile info to determine what profiles are
508                         // supported by what providers, and to build the ElementConformsToProfile
509                         // associations.
510 kumpf          1.4      for (Uint32 i = 0, n = providerProfileInstances.size(); i < n; ++i)
511 a.dunfey       1.1      {
512                             CIMInstance & currentProfileInstance = providerProfileInstances[i];
513                             String moduleName = getRequiredValue<String>(currentProfileInstance,
514                                 CAPABILITIES_PROPERTY_PROVIDERMODULENAME);
515                             String providerName = getRequiredValue<String>(currentProfileInstance,
516                                 CAPABILITIES_PROPERTY_PROVIDERNAME);
517                             String profileName;
518                             Uint16 profileOrganization = 0;
519                             String profileVersion;
520                             String organizationName;
521                             Array<String> profileNames; // Not going to use this info
522                             Array<String> profileVersions; // Not going to use this info
523                             Array<Uint16> profileOrganizations; // Not going to use this info
524                             Array<String> profileOrganizationNames; // Not going to use this info
525 venkat.puvvada 1.6          Array<String> providerModuleNames; // Not going to use this info
526                             Array<String> providerNames; // Not going to use this info
527                     
528 a.dunfey       1.1          String profileId = extractProfileInfo(currentProfileInstance,
529                                 profileCapabilitiesClass,
530                                 registeredProfileClass,
531                                 profileName,
532                                 profileVersion,
533                                 profileOrganization,
534                                 organizationName,
535                                 profileNames,
536                                 profileVersions,
537                                 profileOrganizations,
538                                 profileOrganizationNames,
539 venkat.puvvada 1.6              providerModuleNames,
540                                 providerNames,
541 a.dunfey       1.1              true);
542 venkat.puvvada 1.6  
543 a.dunfey       1.1          Uint32 propIndex = currentProfileInstance.findProperty(
544                                   PROFILECAPABILITIES_PROPERTY_CONFORMINGELEMENTS);
545                     
546                             Array<CIMName> elementPropArray;
547                             elementPropArray.append(
548                                 ELEMENTCONFORMSTOPROFILE_PROPERTY_CONFORMANTSTANDARD);
549                             elementPropArray.append(
550                                 ELEMENTCONFORMSTOPROFILE_PROPERTY_MANAGEDELEMENT);
551                             CIMPropertyList elementPropList(elementPropArray);
552                     
553                             Array<CIMName> conformingElementsForProfile;
554                             Array<CIMNamespaceName> elementNamespacesForProfile;
555                     
556                             Array<String> elementClasses;
557                             currentProfileInstance.getProperty(propIndex).getValue().get(
558                                 elementClasses);
559 kumpf          1.4          //if (propIndex == PEG_NOT_FOUND)
560                             if (elementClasses.size() == 0)
561 a.dunfey       1.1          {
562                                 // Get the namespaces in which this provider operates and trim down
563                                 // the list of capabilities instaces to just those that are related
564                                 // to this one.
565 kumpf          1.4              if (capabilities.size() == 0)
566 a.dunfey       1.1              {
567 kumpf          1.7                  Array<CIMName> capPropList;
568                                     capPropList.append(
569 a.dunfey       1.1                      PROVIDERCAPABILITIES_PROPERTY_PROVIDERMODULENAME);
570 kumpf          1.7                  capPropList.append(PROVIDERCAPABILITIES_PROPERTY_PROVIDERNAME);
571                                     capPropList.append(PROVIDERCAPABILITIES_PROPERTY_NAMESPACES);
572                                     capPropList.append(PROVIDERCAPABILITIES_PROPERTY_CLASSNAME);
573 a.dunfey       1.1                  capabilities = repository->enumerateInstancesForClass(
574                                         PEGASUS_NAMESPACENAME_INTEROP,
575 kumpf          1.11                     PEGASUS_CLASSNAME_PROVIDERCAPABILITIES, false, false);
576 a.dunfey       1.1              }
577                                 Array<CIMInstance> capabilitiesForProvider;
578                                 Array<CIMNamespaceName> namespacesForProvider;
579                                 Array<CIMNameArray> subclassesForNamespace;
580 kumpf          1.4              for (Uint32 j = 0, m = capabilities.size(); j < m; ++j)
581 a.dunfey       1.1              {
582                                     CIMInstance & currentInstance = capabilities[j];
583                                     String curModuleName = getRequiredValue<String>(
584                                         currentInstance, CAPABILITIES_PROPERTY_PROVIDERMODULENAME);
585                                     String curProviderName = getRequiredValue<String>(
586                                         currentInstance, CAPABILITIES_PROPERTY_PROVIDERNAME);
587 kumpf          1.4                  if (curModuleName == moduleName &&
588 a.dunfey       1.1                      curProviderName == providerName)
589                                     {
590                                         CIMName currentClass(getRequiredValue<String>(
591                                             currentInstance,
592                                             PROVIDERCAPABILITIES_PROPERTY_CLASSNAME));
593                                         capabilitiesForProvider.append(currentInstance);
594                                         StringArray curNamespaces =
595                                             getRequiredValue<StringArray>(currentInstance,
596                                                 PROVIDERCAPABILITIES_PROPERTY_NAMESPACES);
597                                         Sint32 z = 0;
598                                         Sint32 y = curNamespaces.size();
599                     
600                                         // If one of the namespaces is Interop, then continue
601                                         bool interopNamespaceFound = false;
602 kumpf          1.4                      for (; z < y; ++z)
603 a.dunfey       1.1                      {
604 kumpf          1.4                          if (CIMNamespaceName(curNamespaces[z]) ==
605 a.dunfey       1.1                              PEGASUS_NAMESPACENAME_INTEROP)
606                                             {
607                                                 interopNamespaceFound = true;
608                                                 break;
609                                             }
610                                         }
611 kumpf          1.4                      if (interopNamespaceFound)
612 a.dunfey       1.1                          continue;
613                     
614                                         // See if the current namespaces are already listed
615 kumpf          1.7                      for (Sint32 w = 0; w < y; ++w)
616 a.dunfey       1.1                      {
617                                             Sint32 foundIndex = -1;
618 kumpf          1.7                          CIMNamespaceName curNamespace = curNamespaces[w];
619 a.dunfey       1.1                          Uint32 k = 0;
620                                             Uint32 x = namespacesForProvider.size();
621 kumpf          1.4                          for (; k < x; ++k)
622 a.dunfey       1.1                          {
623 kumpf          1.4                              if (curNamespace == namespacesForProvider[k])
624 a.dunfey       1.1                              {
625                                                     foundIndex = (Sint32)k;
626                                                     break;
627                                                 }
628                                             }
629 kumpf          1.4                          if (foundIndex == -1)
630 a.dunfey       1.1                          {
631                                                 // Get all the subclasses of
632                                                 // ElementConformsToProfile in the namespace and
633                                                 // cache them.
634                                                 foundIndex = namespacesForProvider.size();
635 kumpf          1.10                             Array<CIMName> subClasses =
636 a.dunfey       1.1                                  repository->enumerateClassNames(curNamespace,
637                                                     PEGASUS_CLASSNAME_CIM_ELEMENTCONFORMSTOPROFILE,
638                                                     true);
639                                                 subClasses.append(
640                                                     PEGASUS_CLASSNAME_CIM_ELEMENTCONFORMSTOPROFILE
641                                                     );
642                                                 namespacesForProvider.append(curNamespace);
643                                                 subclassesForNamespace.append(subClasses);
644                                             }
645                     
646                                             // Now search to see if the current class is one of the
647                                             // subclasses in this namespace, and finally, if it is
648                                             // add it to the list
649                                             Array<CIMName> & subClasses =
650                                                 subclassesForNamespace[foundIndex];
651 kumpf          1.4                          for (k = 0, x = subClasses.size(); k < x; ++k)
652 a.dunfey       1.1                          {
653 kumpf          1.4                              if (subClasses[k] == currentClass)
654 a.dunfey       1.1                              {
655                                                     String dynamicElement = PEGASUS_DYNAMIC +
656                                                         currentClass.getString();
657                                                     conformingElementsForProfile.append(
658                                                         dynamicElement);
659                                                     elementNamespacesForProfile.append(
660                                                         curNamespace);
661                                                 }
662                                             }
663                                         }
664                                     }
665                                 }
666                             }
667                             else
668                             {
669                                 //Array<String> elementClasses;
670                                 //currentProfileInstance.getProperty(propIndex).getValue().get(
671                                 //    elementClasses);
672 kumpf          1.4              for (Uint32 j = 0, m = elementClasses.size(); j < m; ++j)
673 a.dunfey       1.1              {
674                                     CIMName elementClass(elementClasses[j]);
675                                     Array<String> searchNamespaces =
676                                         findProviderNamespacesForElement(
677                                             moduleName, providerName,
678                                             elementClass,
679                                             repository,
680                                             providerCapabilitiesInstances);
681                                     Uint32 k = 0;
682                                     Uint32 x = searchNamespaces.size();
683 kumpf          1.4                  for (; k < x; ++k)
684 a.dunfey       1.1                  {
685                                         conformingElementsForProfile.append(elementClass);
686                                         elementNamespacesForProfile.append(searchNamespaces[k]);
687                                     }
688                                 }
689                             }
690                     
691                             Sint32 foundIndex = -1;
692 kumpf          1.4          for (Sint32 j = 0, m = profileIds.size(); j < m; ++j)
693 a.dunfey       1.1          {
694 kumpf          1.4              if (profileIds[j] == profileId)
695 a.dunfey       1.1              {
696                                     foundIndex = j;
697                                     break;
698                                 }
699                             }
700                     
701 kumpf          1.4          if (foundIndex >= 0)
702 a.dunfey       1.1          {
703                                 // Append the results to already existing entries
704                                 conformingElements[foundIndex].appendArray(
705                                     conformingElementsForProfile);
706                                 elementNamespaces[foundIndex].appendArray(
707                                     elementNamespacesForProfile);
708                             }
709                             else
710                             {
711                                 profileIds.append(profileId);
712                                 conformingElements.append(conformingElementsForProfile);
713                                 elementNamespaces.append(elementNamespacesForProfile);
714                             }
715                         }
716                     }
717                     
718 a.dunfey       1.2  PEGASUS_NAMESPACE_END
719 a.dunfey       1.1  // END_OF_FILE

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2