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

  1 a.dunfey 1.1 //%2006////////////////////////////////////////////////////////////////////////
  2              //
  3              // Copyright (c) 2000, 2001, 2002 BMC Software; Hewlett-Packard Development
  4              // Company, L.P.; IBM Corp.; The Open Group; Tivoli Systems.
  5              // Copyright (c) 2003 BMC Software; Hewlett-Packard Development Company, L.P.;
  6              // IBM Corp.; EMC Corporation, The Open Group.
  7              // Copyright (c) 2004 BMC Software; Hewlett-Packard Development Company, L.P.;
  8              // IBM Corp.; EMC Corporation; VERITAS Software Corporation; The Open Group.
  9              // Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.;
 10              // EMC Corporation; VERITAS Software Corporation; The Open Group.
 11              // Copyright (c) 2006 Hewlett-Packard Development Company, L.P.; IBM Corp.;
 12              // EMC Corporation; Symantec Corporation; The Open Group.
 13              //
 14              // Permission is hereby granted, free of charge, to any person obtaining a copy
 15              // of this software and associated documentation files (the "Software"), to
 16              // deal in the Software without restriction, including without limitation the
 17              // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
 18              // sell copies of the Software, and to permit persons to whom the Software is
 19              // furnished to do so, subject to the following conditions:
 20              // 
 21              // THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
 22 a.dunfey 1.1 // ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED
 23              // "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
 24              // LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
 25              // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
 26              // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
 27              // ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
 28              // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 29              //
 30 s.manicka 1.4.4.1 //=============================================================================
 31 kumpf     1.4     //
 32 s.manicka 1.4.4.1 //%////////////////////////////////////////////////////////////////////////////
 33 a.dunfey  1.1     
 34                   
 35                   ///////////////////////////////////////////////////////////////////////////////
 36                   //  Interop Provider - This provider services those classes from the
 37                   //  DMTF Interop schema in an implementation compliant with the SMI-S v1.1
 38                   //  Server Profile
 39                   //
 40                   //  Please see PG_ServerProfile20.mof in the directory
 41                   //  $(PEGASUS_ROOT)/Schemas/Pegasus/InterOp/VER20 for retails regarding the
 42                   //  classes supported by this control provider.
 43                   //
 44                   //  Interop forces all creates to the PEGASUS_NAMESPACENAME_INTEROP 
 45                   //  namespace. There is a test on each operation that returns 
 46                   //  the Invalid Class CIMDError
 47                   //  This is a control provider and as such uses the Tracer functions
 48                   //  for data and function traces.  Since we do not expect high volume
 49                   //  use we added a number of traces to help diagnostics.
 50                   ///////////////////////////////////////////////////////////////////////////////
 51                   
 52                   #include "InteropProvider.h"
 53                   #include "InteropProviderUtils.h"
 54 a.dunfey  1.1     #include "InteropConstants.h"
 55                   
 56                   PEGASUS_USING_STD;
 57 a.dunfey  1.2     PEGASUS_NAMESPACE_BEGIN
 58 a.dunfey  1.1     
 59                   //
 60                   // Given the two references in the association, this function creates an
 61                   // instance of the PG_ElementConformsToProfile class.
 62                   //
 63                   CIMInstance buildElementConformsToProfile(
 64                       const CIMObjectPath & currentProfile,
 65                       const CIMObjectPath & currentElement,
 66                       const CIMClass & elementConformsClass)
 67                   {
 68                       Array<CIMName> elementPropArray;
 69                       elementPropArray.append(
 70                           ELEMENTCONFORMSTOPROFILE_PROPERTY_CONFORMANTSTANDARD);
 71                       elementPropArray.append(
 72                           ELEMENTCONFORMSTOPROFILE_PROPERTY_MANAGEDELEMENT);
 73                       CIMPropertyList elementPropList(elementPropArray);
 74                   
 75                       CIMInstance tmpInstance =
 76                           elementConformsClass.buildInstance(false, false,
 77                               elementPropList);
 78                       setPropertyValue(tmpInstance,
 79 a.dunfey  1.1             ELEMENTCONFORMSTOPROFILE_PROPERTY_CONFORMANTSTANDARD,
 80                           currentProfile);
 81                       setPropertyValue(tmpInstance,
 82                           ELEMENTCONFORMSTOPROFILE_PROPERTY_MANAGEDELEMENT,
 83                           currentElement);
 84                       tmpInstance.setPath(tmpInstance.buildPath(
 85                           elementConformsClass));
 86                       return tmpInstance;
 87                   }
 88                   
 89 s.manicka 1.4.4.1 Array<CIMInstance> InteropProvider::enumElementConformsToProfileRPRPInstances(
 90                       const OperationContext & opContext, 
 91                       const CIMNamespaceName & opNamespace)
 92                   {
 93                       CIMClass elementConformsClass = repository->getClass(
 94                           PEGASUS_NAMESPACENAME_INTEROP,
 95                           PEGASUS_CLASSNAME_PG_ELEMENTCONFORMSTOPROFILE_RP_RP,
 96                           false, true, false);
 97                   
 98                       Array<CIMInstance> instances;
 99                       CIMObjectPath smisVersionProfile, profRegProfile;
100                   
101                       if (opNamespace == PEGASUS_NAMESPACENAME_INTEROP)
102                       {
103                           //Add associations between the 1.2 SMIS-Version profile and all 
104                           //the version 1.2.0 profiles and subprofiles. 
105                           smisVersionProfile = buildDependencyReference(
106                               hostName,
107                               buildProfileInstanceId(SNIA_NAME, "SMI-S", SNIA_VER_120),
108                               PEGASUS_CLASSNAME_PG_REGISTEREDPROFILE);
109                   
110 s.manicka 1.4.4.1         Array<CIMInstance> profileInstances = 
111                               enumRegisteredProfileInstances();
112                           Array<CIMInstance> subprofileInstances = 
113                               enumRegisteredSubProfileInstances();
114                           profileInstances.appendArray(subprofileInstances);
115                           Array<CIMInstance> profilesForVersion = getProfilesForVersion(
116                               profileInstances, 
117                               SNIA_VER_120); 
118                           for (Uint32 i = 0, n = profilesForVersion.size(); i < n; ++i)
119                           {
120                               instances.append(buildElementConformsToProfile(
121                                   smisVersionProfile,
122                                   profilesForVersion[i].getPath(), 
123                                   elementConformsClass));
124                           }
125                   
126                           //Add association between the 1.2 SMI-S registeredprofile and 
127                           //profileregistration registeredprofile with registeredversion 1.0.0
128                           profRegProfile = buildDependencyReference(
129                               hostName,
130                               buildProfileInstanceId(
131 s.manicka 1.4.4.1                 SNIA_NAME, 
132                                   "Profile Registration",
133                                   SNIA_VER_100),
134                               PEGASUS_CLASSNAME_PG_REGISTEREDPROFILE);
135                           instances.append(buildElementConformsToProfile(
136                               smisVersionProfile,
137                               profRegProfile, 
138                               elementConformsClass));
139                   
140                   
141                       }
142                       return instances;
143                   }
144                   
145 a.dunfey  1.1     //
146                   // Enumerates all of the ElementConformsToProfile association instances.
147                   //
148                   Array<CIMInstance> InteropProvider::enumElementConformsToProfileInstances(
149                       const OperationContext & opContext, const CIMNamespaceName & opNamespace)
150                   {
151                       CIMClass elementConformsClass = repository->getClass(
152                           PEGASUS_NAMESPACENAME_INTEROP,
153                           PEGASUS_CLASSNAME_PG_ELEMENTCONFORMSTOPROFILE,
154                           false, true, false);
155                   
156                       AutoMutex holder(interopMut);
157                       Array<CIMInstance> instances;
158                       verifyCachedInfo();
159                       // Loop through the cached profile Id's and related info about its
160                       // conforming elements.
161 kumpf     1.4         for (Uint32 i = 0, n = profileIds.size(); i < n; ++i)
162 a.dunfey  1.1         {
163                           String & profileId = profileIds[i];
164                           Array<CIMName> & elementList = conformingElements[i];
165                           Array<CIMNamespaceName> & namespaceList = elementNamespaces[i];
166                           Array<CIMObjectPath> conformingElementPaths;
167 kumpf     1.4             for (Uint32 j = 0, m = elementList.size(); j < m; ++j)
168 a.dunfey  1.1             {
169                               CIMName & currentElement = elementList[j];
170                               CIMNamespaceName & currentNamespace = namespaceList[j];
171                   
172 kumpf     1.4                 if (opNamespace == PEGASUS_NAMESPACENAME_INTEROP ||
173 a.dunfey  1.1                     opNamespace == currentNamespace)
174                               {
175                                   String currentElementStr(currentElement.getString());
176 kumpf     1.4                     if (currentElementStr.find(PEGASUS_DYNAMIC) == 0)
177 a.dunfey  1.1                     {
178                                       // If the provider profile registration did not provide a
179                                       // list of conforming elements (presumably because there is
180                                       // no such definite list), then the provider is required
181                                       // to provide instances of ElementConformsToProfile in the
182                                       // vendor namespace, so we do not generate instances.
183 kumpf     1.4                         if (opNamespace != PEGASUS_NAMESPACENAME_INTEROP)
184 a.dunfey  1.1                         {
185                                           continue;
186                                       }
187                                       CIMName subclassName(
188                                           currentElementStr.subString(PEGASUS_DYNAMIC_LEN));
189                                       Array<CIMInstance> elementConformsInstances =
190                                           cimomHandle.enumerateInstances(opContext,
191                                           currentNamespace, subclassName, true, false, false,
192                                           true, CIMPropertyList());
193                   
194                                       // Retrieve the Conforming Element
195 kumpf     1.4                         for (Uint32 k = 0, x = elementConformsInstances.size();
196 a.dunfey  1.1                             k < x; ++k)
197                                       {
198                                           CIMInstance & currentInstance =
199                                               elementConformsInstances[k];
200                   
201 kumpf     1.4                             // NOCHKSRC
202 a.dunfey  1.1                             // Make sure that the current instance points to the
203                                           // current profile ID.
204                                           CIMObjectPath profilePath =
205                                               getRequiredValue<CIMObjectPath>(
206                                                   elementConformsInstances[k],
207                                                   ELEMENTCONFORMSTOPROFILE_PROPERTY_CONFORMANTSTANDARD);
208 kumpf     1.4                             // DOCHKSRC
209 a.dunfey  1.1                             const Array<CIMKeyBinding> & keys =
210                                               profilePath.getKeyBindings();
211 kumpf     1.4                             if (keys.size() != 1)
212 a.dunfey  1.1                                 continue;
213 kumpf     1.4                             if (keys.size() == 1 && keys[0].getValue() == profileId)
214 a.dunfey  1.1                             {
215 kumpf     1.4                                 // NOCHKSRC
216 a.dunfey  1.1                                 conformingElementPaths.append(
217                                                   getRequiredValue<CIMObjectPath>(
218                                                   currentInstance,
219                                                   ELEMENTCONFORMSTOPROFILE_PROPERTY_MANAGEDELEMENT));
220 kumpf     1.4                                 // DOCHKSRC
221 a.dunfey  1.1                             }
222                                       }
223                                   }
224                                   else
225                                   {
226                                       // All of the instances of the current element in the
227                                       // corresponding namespace conform to the current profile.
228                                       Array<CIMObjectPath> paths =
229                                           cimomHandle.enumerateInstanceNames(opContext,
230                                               currentNamespace, currentElement);
231                                       // Set the namespace in the paths just in case
232 kumpf     1.4                         for (Uint32 k = 0, x = paths.size();
233 a.dunfey  1.1                             k < x; ++k)
234                                       {
235                                           CIMObjectPath & curPath = paths[k];
236                                           curPath.setNameSpace(currentNamespace);
237                                           curPath.setHost(hostName);
238                                       }
239                                       conformingElementPaths.appendArray(paths);
240                                   }
241                               }
242                           }
243                   
244                           // Create the object path for the RegisteredProfile using the given
245                           // profileId.
246                           CIMObjectPath profilePath = buildDependencyReference(
247                               hostName, profileIds[i], PEGASUS_CLASSNAME_PG_REGISTEREDPROFILE);
248                   
249                           // Build all of the ElementConformsToProfile instances for the current
250                           // profile.
251 kumpf     1.4             for (Uint32 k = 0, x = conformingElementPaths.size(); k < x; ++k)
252 a.dunfey  1.1             {
253                               instances.append(buildElementConformsToProfile(profilePath,
254                                   conformingElementPaths[k], elementConformsClass));
255                           }
256                       }
257                   
258                       // Now add the default instance: the association between the Server Profile
259                       // and the ObjectManager (if we're in the Interop namespace)
260 kumpf     1.4         if (opNamespace == PEGASUS_NAMESPACENAME_INTEROP)
261 a.dunfey  1.1         {
262 s.manicka 1.4.4.1         // Build up the Object Path for the server profile version 1.1.0
263                           CIMObjectPath serverProfile = buildDependencyReference(
264                               hostName,
265 a.dunfey  1.1                 buildProfileInstanceId(SNIA_NAME, "Server", SNIA_VER_110),
266                               PEGASUS_CLASSNAME_PG_REGISTEREDPROFILE);
267                           // Retrieve the Object Manager instance
268                           CIMInstance objManager = getObjectManagerInstance();
269                   
270 s.manicka 1.4.4.1         instances.append(
271                               buildElementConformsToProfile(
272                                   serverProfile,
273                                   objManager.getPath(), 
274                                   elementConformsClass));
275                   
276                           // Build up the Object Path for the server profile ver 1.2.0
277                           // and add the elementconformstoprofile association instance
278                           serverProfile = buildDependencyReference(
279                               hostName,
280                               buildProfileInstanceId(SNIA_NAME, "Server", SNIA_VER_120),
281                               PEGASUS_CLASSNAME_PG_REGISTEREDPROFILE);
282                           instances.append(
283                               buildElementConformsToProfile(
284                                   serverProfile,
285                                   objManager.getPath(), 
286                                   elementConformsClass));
287                           
288 a.dunfey  1.1         }
289                       return instances;
290                   }
291                   
292 s.manicka 1.4.4.1 //Method that filters the registered profile or registered subprofile instances
293                   //for the SMI-S version.
294                   Array<CIMInstance> InteropProvider::getProfilesForVersion(
295                       Array<CIMInstance>& profiles,
296                       const String version)
297                   {
298                       Array<CIMInstance> instances;
299                       instances.clear();
300                       for (Uint32 i = 0, n = profiles.size(); i < n; ++i)
301                       {
302                           String versionNumber;
303                           String profileName;
304                           Uint32 index = profiles[i].findProperty("RegisteredVersion");
305                           if (index != PEG_NOT_FOUND)
306                           {
307                               const CIMValue &tmpVal = profiles[i].getProperty(index).getValue();
308                               if (!tmpVal.isNull())
309                               {
310                                 tmpVal.get(versionNumber);
311                               }
312                           }
313 s.manicka 1.4.4.1         index = profiles[i].findProperty("RegisteredName");
314                           if (index != PEG_NOT_FOUND)
315                           {
316                               const CIMValue &tmpVal = profiles[i].getProperty(index).getValue();
317                               if (!tmpVal.isNull())
318                               {
319                                   tmpVal.get(profileName);
320                               }
321                           }
322                   
323                           if ((versionNumber == version) && (profileName != String("SMI-S")))
324                           {
325                               instances.append(profiles[i]);
326                           }
327                       }
328                       return instances;
329                   }
330 a.dunfey  1.1     
331                   typedef Array<String> StringArray;
332                   
333                   void InteropProvider::verifyCachedInfo()
334                   {
335                       // TBD: May need an algorithm to determine whether or not the information
336                       // cached by the Interop Provider is out of date in some way. Until that
337                       // can be created, then providers that are dynamically registered after
338                       // the Server profile has already been traversed may not be properly
339                       // reflected. Although this is a shortcoming, the current users of this
340                       // functionality do not generally use dynamic registration as part of their
341                       // installation procedures.
342                   }
343                   
344                   //
345                   // Function that determines in which namespaces a provider supports a given
346                   // class. This information is needed to properly implement the
347                   // ElementConformsToProfile association.
348                   //
349                   Array<String> findProviderNamespacesForElement(
350                       const String & moduleName, const String & providerName,
351 a.dunfey  1.1         const CIMName & elementClass, CIMRepository * repository,
352                       Array<CIMInstance> & providerCapabilitiesInstances)
353                   {
354                       Array<CIMInstance> capabilities;
355 kumpf     1.4         if (providerCapabilitiesInstances.size() == 0)
356 a.dunfey  1.1         {
357                           Array<CIMName> propList;
358                           propList.append(PROVIDERCAPABILITIES_PROPERTY_PROVIDERMODULENAME);
359                           propList.append(PROVIDERCAPABILITIES_PROPERTY_PROVIDERNAME);
360                           propList.append(PROVIDERCAPABILITIES_PROPERTY_NAMESPACES);
361                           propList.append(PROVIDERCAPABILITIES_PROPERTY_CLASSNAME);
362                           capabilities = repository->enumerateInstancesForClass(
363                               PEGASUS_NAMESPACENAME_INTEROP,
364 kumpf     1.3                 PEGASUS_CLASSNAME_PROVIDERCAPABILITIES, false, false, false);
365 a.dunfey  1.1         }
366                       else
367                       {
368                           capabilities = providerCapabilitiesInstances;
369                       }
370                   
371 kumpf     1.4         for (Uint32 i = 0, n = capabilities.size(); i < n; ++i)
372 a.dunfey  1.1         {
373                           CIMInstance & currentCapabilities = capabilities[i];
374                           Uint32 propIndex = currentCapabilities.findProperty(
375                               PROVIDERCAPABILITIES_PROPERTY_PROVIDERMODULENAME);
376                           PEGASUS_ASSERT(propIndex != PEG_NOT_FOUND);
377                           String currentName;
378                           currentCapabilities.getProperty(propIndex).getValue().get(
379                               currentName);
380 kumpf     1.4             if (currentName == moduleName)
381 a.dunfey  1.1             {
382                               propIndex = currentCapabilities.findProperty(
383                                   PROVIDERCAPABILITIES_PROPERTY_PROVIDERNAME);
384                               PEGASUS_ASSERT(propIndex != PEG_NOT_FOUND);
385                               currentCapabilities.getProperty(propIndex).getValue().get(
386                                   currentName);
387 kumpf     1.4                 if (currentName == providerName)
388 a.dunfey  1.1                 {
389                                   propIndex = currentCapabilities.findProperty(
390                                       PROVIDERCAPABILITIES_PROPERTY_CLASSNAME);
391                                   PEGASUS_ASSERT(propIndex != PEG_NOT_FOUND);
392                                   currentCapabilities.getProperty(propIndex).getValue().get(
393                                       currentName);
394 kumpf     1.4                     if (elementClass.equal(CIMName(currentName)))
395 a.dunfey  1.1                     {
396                                       propIndex = currentCapabilities.findProperty(
397                                         PROVIDERCAPABILITIES_PROPERTY_NAMESPACES);
398                                       PEGASUS_ASSERT(propIndex != PEG_NOT_FOUND);
399                                       Array<String> namespaces;
400                                       currentCapabilities.getProperty(propIndex).getValue().get(
401                                           namespaces);
402                                       return namespaces;
403                                   }
404                               }
405                           }
406                       }
407                   
408                       throw PEGASUS_CIM_EXCEPTION(CIM_ERR_NOT_FOUND,
409                           "Could not find provider capabilities registered for module " +
410                           moduleName + ", provider " + providerName + ", and class " +
411                           elementClass.getString());
412                   }
413                   
414                   //
415                   // Method that caches certain profile registration information. Specifically,
416 a.dunfey  1.1     // information pertaining to the ElementConformsToProfofile association
417                   // implementation is kept here.
418                   //
419                   void InteropProvider::cacheProfileRegistrationInfo()
420                   {
421                       Array<CIMInstance> instances;
422                       Array<CIMInstance> providerCapabilitiesInstances;
423                       // Retrieve all of the provider profile registration info
424                       Array<CIMName> propList;
425                       propList.append(CAPABILITIES_PROPERTY_PROVIDERMODULENAME);
426                       propList.append(CAPABILITIES_PROPERTY_PROVIDERNAME);
427                       propList.append(PROFILECAPABILITIES_PROPERTY_PROFILEVERSION);
428                       propList.append(PROFILECAPABILITIES_PROPERTY_REGISTEREDPROFILE);
429                       propList.append(PROFILECAPABILITIES_PROPERTY_OTHERREGISTEREDPROFILE);
430                       propList.append(PROFILECAPABILITIES_PROPERTY_OTHERPROFILEORGANIZATION);
431                       propList.append(PROFILECAPABILITIES_PROPERTY_CONFORMINGELEMENTS);
432                       Array<CIMInstance> providerProfileInstances =
433                           repository->enumerateInstancesForClass(PEGASUS_NAMESPACENAME_INTEROP,
434 kumpf     1.3                 PEGASUS_CLASSNAME_PG_PROVIDERPROFILECAPABILITIES, false,
435 a.dunfey  1.1                 false, false, CIMPropertyList(propList));
436                       CIMClass elementConformsClass = repository->getClass(
437                           PEGASUS_NAMESPACENAME_INTEROP,
438                           PEGASUS_CLASSNAME_PG_ELEMENTCONFORMSTOPROFILE,
439                           false, true, false);
440                       CIMClass registeredProfileClass = repository->getClass(
441                           PEGASUS_NAMESPACENAME_INTEROP,
442                           PEGASUS_CLASSNAME_PG_REGISTEREDPROFILE,
443                           false, true, false);
444                       Array<CIMInstance> capabilities;
445                   
446                       // Loop through the provider profile info to determine what profiles are
447                       // supported by what providers, and to build the ElementConformsToProfile
448                       // associations.
449 kumpf     1.4         for (Uint32 i = 0, n = providerProfileInstances.size(); i < n; ++i)
450 a.dunfey  1.1         {
451                           CIMInstance & currentProfileInstance = providerProfileInstances[i];
452                           String moduleName = getRequiredValue<String>(currentProfileInstance,
453                               CAPABILITIES_PROPERTY_PROVIDERMODULENAME);
454                           String providerName = getRequiredValue<String>(currentProfileInstance,
455                               CAPABILITIES_PROPERTY_PROVIDERNAME);
456                           String profileName;
457                           Uint16 profileOrganization = 0;
458                           String profileVersion;
459                           String organizationName;
460                           Array<String> profileNames; // Not going to use this info
461                           Array<String> profileVersions; // Not going to use this info
462                           Array<Uint16> profileOrganizations; // Not going to use this info
463                           Array<String> profileOrganizationNames; // Not going to use this info
464                           String profileId = extractProfileInfo(currentProfileInstance,
465                               profileCapabilitiesClass,
466                               registeredProfileClass,
467                               profileName,
468                               profileVersion,
469                               profileOrganization,
470                               organizationName,
471 a.dunfey  1.1                 profileNames,
472                               profileVersions,
473                               profileOrganizations,
474                               profileOrganizationNames,
475                               true);
476                           Uint32 propIndex = currentProfileInstance.findProperty(
477                                 PROFILECAPABILITIES_PROPERTY_CONFORMINGELEMENTS);
478                   
479                           Array<CIMName> elementPropArray;
480                           elementPropArray.append(
481                               ELEMENTCONFORMSTOPROFILE_PROPERTY_CONFORMANTSTANDARD);
482                           elementPropArray.append(
483                               ELEMENTCONFORMSTOPROFILE_PROPERTY_MANAGEDELEMENT);
484                           CIMPropertyList elementPropList(elementPropArray);
485                   
486                           Array<CIMName> conformingElementsForProfile;
487                           Array<CIMNamespaceName> elementNamespacesForProfile;
488                   
489                           Array<String> elementClasses;
490                           currentProfileInstance.getProperty(propIndex).getValue().get(
491                               elementClasses);
492 kumpf     1.4             //if (propIndex == PEG_NOT_FOUND)
493                           if (elementClasses.size() == 0)
494 a.dunfey  1.1             {
495                               // Get the namespaces in which this provider operates and trim down
496                               // the list of capabilities instaces to just those that are related
497                               // to this one.
498                               String moduleName = getRequiredValue<String>(
499                                   currentProfileInstance,
500                                   CAPABILITIES_PROPERTY_PROVIDERMODULENAME);
501                               String providerName = getRequiredValue<String>(
502                                   currentProfileInstance,
503                                   CAPABILITIES_PROPERTY_PROVIDERNAME);
504 kumpf     1.4                 if (capabilities.size() == 0)
505 a.dunfey  1.1                 {
506                                   Array<CIMName> propList;
507                                   propList.append(
508                                       PROVIDERCAPABILITIES_PROPERTY_PROVIDERMODULENAME);
509                                   propList.append(PROVIDERCAPABILITIES_PROPERTY_PROVIDERNAME);
510                                   propList.append(PROVIDERCAPABILITIES_PROPERTY_NAMESPACES);
511                                   propList.append(PROVIDERCAPABILITIES_PROPERTY_CLASSNAME);
512                                   capabilities = repository->enumerateInstancesForClass(
513                                       PEGASUS_NAMESPACENAME_INTEROP,
514 kumpf     1.3                         PEGASUS_CLASSNAME_PROVIDERCAPABILITIES, false, false,
515 a.dunfey  1.1                         false);
516                               }
517                               Array<CIMInstance> capabilitiesForProvider;
518                               Array<CIMNamespaceName> namespacesForProvider;
519                               Array<CIMNameArray> subclassesForNamespace;
520 kumpf     1.4                 for (Uint32 j = 0, m = capabilities.size(); j < m; ++j)
521 a.dunfey  1.1                 {
522                                   CIMInstance & currentInstance = capabilities[j];
523                                   String curModuleName = getRequiredValue<String>(
524                                       currentInstance, CAPABILITIES_PROPERTY_PROVIDERMODULENAME);
525                                   String curProviderName = getRequiredValue<String>(
526                                       currentInstance, CAPABILITIES_PROPERTY_PROVIDERNAME);
527 kumpf     1.4                     if (curModuleName == moduleName &&
528 a.dunfey  1.1                         curProviderName == providerName)
529                                   {
530                                       CIMName currentClass(getRequiredValue<String>(
531                                           currentInstance,
532                                           PROVIDERCAPABILITIES_PROPERTY_CLASSNAME));
533                                       capabilitiesForProvider.append(currentInstance);
534                                       StringArray curNamespaces =
535                                           getRequiredValue<StringArray>(currentInstance,
536                                               PROVIDERCAPABILITIES_PROPERTY_NAMESPACES);
537                                       Sint32 z = 0;
538                                       Sint32 y = curNamespaces.size();
539                   
540                                       // If one of the namespaces is Interop, then continue
541                                       bool interopNamespaceFound = false;
542 kumpf     1.4                         for (; z < y; ++z)
543 a.dunfey  1.1                         {
544 kumpf     1.4                             if (CIMNamespaceName(curNamespaces[z]) ==
545 a.dunfey  1.1                                 PEGASUS_NAMESPACENAME_INTEROP)
546                                           {
547                                               interopNamespaceFound = true;
548                                               break;
549                                           }
550                                       }
551 kumpf     1.4                         if (interopNamespaceFound)
552 a.dunfey  1.1                             continue;
553                   
554                                       // See if the current namespaces are already listed
555 kumpf     1.4                         for (Sint32 z = 0, y = curNamespaces.size(); z < y; ++z)
556 a.dunfey  1.1                         {
557                                           Sint32 foundIndex = -1;
558                                           CIMNamespaceName curNamespace = curNamespaces[z];
559                                           Uint32 k = 0;
560                                           Uint32 x = namespacesForProvider.size();
561 kumpf     1.4                             for (; k < x; ++k)
562 a.dunfey  1.1                             {
563 kumpf     1.4                                 if (curNamespace == namespacesForProvider[k])
564 a.dunfey  1.1                                 {
565                                                   foundIndex = (Sint32)k;
566                                                   break;
567                                               }
568                                           }
569 kumpf     1.4                             if (foundIndex == -1)
570 a.dunfey  1.1                             {
571                                               // Get all the subclasses of
572                                               // ElementConformsToProfile in the namespace and
573                                               // cache them.
574                                               foundIndex = namespacesForProvider.size();
575                                               Array<CIMName> subClasses = 
576                                                   repository->enumerateClassNames(curNamespace,
577                                                   PEGASUS_CLASSNAME_CIM_ELEMENTCONFORMSTOPROFILE,
578                                                   true);
579                                               subClasses.append(
580                                                   PEGASUS_CLASSNAME_CIM_ELEMENTCONFORMSTOPROFILE
581                                                   );
582                                               namespacesForProvider.append(curNamespace);
583                                               subclassesForNamespace.append(subClasses);
584                                           }
585                   
586                                           // Now search to see if the current class is one of the
587                                           // subclasses in this namespace, and finally, if it is
588                                           // add it to the list
589                                           Array<CIMName> & subClasses =
590                                               subclassesForNamespace[foundIndex];
591 kumpf     1.4                             for (k = 0, x = subClasses.size(); k < x; ++k)
592 a.dunfey  1.1                             {
593 kumpf     1.4                                 if (subClasses[k] == currentClass)
594 a.dunfey  1.1                                 {
595                                                   String dynamicElement = PEGASUS_DYNAMIC +
596                                                       currentClass.getString();
597                                                   conformingElementsForProfile.append(
598                                                       dynamicElement);
599                                                   elementNamespacesForProfile.append(
600                                                       curNamespace);
601                                               }
602                                           }
603                                       }
604                                   }
605                               }
606                           }
607                           else
608                           {
609                               //Array<String> elementClasses;
610                               //currentProfileInstance.getProperty(propIndex).getValue().get(
611                               //    elementClasses);
612 kumpf     1.4                 for (Uint32 j = 0, m = elementClasses.size(); j < m; ++j)
613 a.dunfey  1.1                 {
614                                   CIMName elementClass(elementClasses[j]);
615                                   Array<String> searchNamespaces =
616                                       findProviderNamespacesForElement(
617                                           moduleName, providerName,
618                                           elementClass,
619                                           repository,
620                                           providerCapabilitiesInstances);
621                                   Uint32 k = 0;
622                                   Uint32 x = searchNamespaces.size();
623 kumpf     1.4                     for (; k < x; ++k)
624 a.dunfey  1.1                     {
625                                       conformingElementsForProfile.append(elementClass);
626                                       elementNamespacesForProfile.append(searchNamespaces[k]);
627                                   }
628                               }
629                           }
630                   
631                           Sint32 foundIndex = -1;
632 kumpf     1.4             for (Sint32 j = 0, m = profileIds.size(); j < m; ++j)
633 a.dunfey  1.1             {
634 kumpf     1.4                 if (profileIds[j] == profileId)
635 a.dunfey  1.1                 {
636                                   foundIndex = j;
637                                   break;
638                               }
639                           }
640                   
641 kumpf     1.4             if (foundIndex >= 0)
642 a.dunfey  1.1             {
643                               // Append the results to already existing entries
644                               conformingElements[foundIndex].appendArray(
645                                   conformingElementsForProfile);
646                               elementNamespaces[foundIndex].appendArray(
647                                   elementNamespacesForProfile);
648                           }
649                           else
650                           {
651                               profileIds.append(profileId);
652                               conformingElements.append(conformingElementsForProfile);
653                               elementNamespaces.append(elementNamespacesForProfile);
654                           }
655                       }
656                   }
657                   
658 a.dunfey  1.2     PEGASUS_NAMESPACE_END
659 a.dunfey  1.1     // END_OF_FILE

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2