(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.5 //=============================================================================
 31 kumpf     1.4 //
 32 s.manicka 1.5 //%////////////////////////////////////////////////////////////////////////////
 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.5 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.5         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.5                 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.5         // 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.5         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 s.manicka 1.5     return instances;
290               }
291               
292               //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 s.manicka 1.5               tmpVal.get(versionNumber);
311                           }
312                       }
313                       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 a.dunfey  1.1 
323 s.manicka 1.5         if ((versionNumber == version) && (profileName != String("SMI-S")))
324                       {
325                           instances.append(profiles[i]);
326                       }
327                   }
328 a.dunfey  1.1     return instances;
329               }
330               
331               
332               typedef Array<String> StringArray;
333               
334               void InteropProvider::verifyCachedInfo()
335               {
336 venkat.puvvada 1.6     if (!updateProfileCache.get())
337                        {
338                            return;
339                        }
340                        // At present cache will be rebuilt in the following conditions.
341                        // (1) When instances of PG_ProviderProfileCapabilities is created
342                        //     or deleted.
343                        // (2) When Provider and ProviderCapabilities instances
344                        //     are created or Provider, ProviderModule and ProviderCapabilities
345                        //     instance are deleted.
346                        // (3) When Provider or ProviderModule is disabled or enabled.
347                        AutoMutex mtx(interopMut);
348                        if (updateProfileCache.get())
349                        {
350                            initializeNamespaces();
351                            cacheProfileRegistrationInfo();
352                            updateProfileCache--;
353                        }
354 a.dunfey       1.1 }
355                    
356                    //
357                    // Function that determines in which namespaces a provider supports a given
358                    // class. This information is needed to properly implement the
359                    // ElementConformsToProfile association.
360                    //
361                    Array<String> findProviderNamespacesForElement(
362                        const String & moduleName, const String & providerName,
363                        const CIMName & elementClass, CIMRepository * repository,
364                        Array<CIMInstance> & providerCapabilitiesInstances)
365                    {
366                        Array<CIMInstance> capabilities;
367 kumpf          1.4     if (providerCapabilitiesInstances.size() == 0)
368 a.dunfey       1.1     {
369                            Array<CIMName> propList;
370                            propList.append(PROVIDERCAPABILITIES_PROPERTY_PROVIDERMODULENAME);
371                            propList.append(PROVIDERCAPABILITIES_PROPERTY_PROVIDERNAME);
372                            propList.append(PROVIDERCAPABILITIES_PROPERTY_NAMESPACES);
373                            propList.append(PROVIDERCAPABILITIES_PROPERTY_CLASSNAME);
374                            capabilities = repository->enumerateInstancesForClass(
375                                PEGASUS_NAMESPACENAME_INTEROP,
376 kumpf          1.3             PEGASUS_CLASSNAME_PROVIDERCAPABILITIES, false, false, false);
377 a.dunfey       1.1     }
378                        else
379                        {
380                            capabilities = providerCapabilitiesInstances;
381                        }
382                    
383 kumpf          1.4     for (Uint32 i = 0, n = capabilities.size(); i < n; ++i)
384 a.dunfey       1.1     {
385                            CIMInstance & currentCapabilities = capabilities[i];
386                            Uint32 propIndex = currentCapabilities.findProperty(
387                                PROVIDERCAPABILITIES_PROPERTY_PROVIDERMODULENAME);
388                            PEGASUS_ASSERT(propIndex != PEG_NOT_FOUND);
389                            String currentName;
390                            currentCapabilities.getProperty(propIndex).getValue().get(
391                                currentName);
392 kumpf          1.4         if (currentName == moduleName)
393 a.dunfey       1.1         {
394                                propIndex = currentCapabilities.findProperty(
395                                    PROVIDERCAPABILITIES_PROPERTY_PROVIDERNAME);
396                                PEGASUS_ASSERT(propIndex != PEG_NOT_FOUND);
397                                currentCapabilities.getProperty(propIndex).getValue().get(
398                                    currentName);
399 kumpf          1.4             if (currentName == providerName)
400 a.dunfey       1.1             {
401                                    propIndex = currentCapabilities.findProperty(
402                                        PROVIDERCAPABILITIES_PROPERTY_CLASSNAME);
403                                    PEGASUS_ASSERT(propIndex != PEG_NOT_FOUND);
404                                    currentCapabilities.getProperty(propIndex).getValue().get(
405                                        currentName);
406 kumpf          1.4                 if (elementClass.equal(CIMName(currentName)))
407 a.dunfey       1.1                 {
408                                        propIndex = currentCapabilities.findProperty(
409                                          PROVIDERCAPABILITIES_PROPERTY_NAMESPACES);
410                                        PEGASUS_ASSERT(propIndex != PEG_NOT_FOUND);
411                                        Array<String> namespaces;
412                                        currentCapabilities.getProperty(propIndex).getValue().get(
413                                            namespaces);
414                                        return namespaces;
415                                    }
416                                }
417                            }
418                        }
419                    
420                        throw PEGASUS_CIM_EXCEPTION(CIM_ERR_NOT_FOUND,
421                            "Could not find provider capabilities registered for module " +
422                            moduleName + ", provider " + providerName + ", and class " +
423                            elementClass.getString());
424                    }
425                    
426                    //
427                    // Method that caches certain profile registration information. Specifically,
428 a.dunfey       1.1 // information pertaining to the ElementConformsToProfofile association
429                    // implementation is kept here.
430                    //
431                    void InteropProvider::cacheProfileRegistrationInfo()
432                    {
433                        Array<CIMInstance> instances;
434                        Array<CIMInstance> providerCapabilitiesInstances;
435 venkat.puvvada 1.6 
436                        // Clear existing cache
437                        profileIds.clear();
438                        conformingElements.clear();
439                        elementNamespaces.clear();
440                    
441 a.dunfey       1.1     // Retrieve all of the provider profile registration info
442                        Array<CIMName> propList;
443                        propList.append(CAPABILITIES_PROPERTY_PROVIDERMODULENAME);
444                        propList.append(CAPABILITIES_PROPERTY_PROVIDERNAME);
445                        propList.append(PROFILECAPABILITIES_PROPERTY_PROFILEVERSION);
446                        propList.append(PROFILECAPABILITIES_PROPERTY_REGISTEREDPROFILE);
447                        propList.append(PROFILECAPABILITIES_PROPERTY_OTHERREGISTEREDPROFILE);
448                        propList.append(PROFILECAPABILITIES_PROPERTY_OTHERPROFILEORGANIZATION);
449                        propList.append(PROFILECAPABILITIES_PROPERTY_CONFORMINGELEMENTS);
450 venkat.puvvada 1.6 
451                        Array<CIMInstance> providerProfileInstances = 
452                            enumProviderProfileCapabilityInstances(
453                                true,
454                                false,
455                                false,
456                                false,
457                                CIMPropertyList(propList));
458                    
459 a.dunfey       1.1     CIMClass elementConformsClass = repository->getClass(
460                            PEGASUS_NAMESPACENAME_INTEROP,
461                            PEGASUS_CLASSNAME_PG_ELEMENTCONFORMSTOPROFILE,
462                            false, true, false);
463                        CIMClass registeredProfileClass = repository->getClass(
464                            PEGASUS_NAMESPACENAME_INTEROP,
465                            PEGASUS_CLASSNAME_PG_REGISTEREDPROFILE,
466                            false, true, false);
467                        Array<CIMInstance> capabilities;
468                    
469                        // Loop through the provider profile info to determine what profiles are
470                        // supported by what providers, and to build the ElementConformsToProfile
471                        // associations.
472 kumpf          1.4     for (Uint32 i = 0, n = providerProfileInstances.size(); i < n; ++i)
473 a.dunfey       1.1     {
474                            CIMInstance & currentProfileInstance = providerProfileInstances[i];
475                            String moduleName = getRequiredValue<String>(currentProfileInstance,
476                                CAPABILITIES_PROPERTY_PROVIDERMODULENAME);
477                            String providerName = getRequiredValue<String>(currentProfileInstance,
478                                CAPABILITIES_PROPERTY_PROVIDERNAME);
479                            String profileName;
480                            Uint16 profileOrganization = 0;
481                            String profileVersion;
482                            String organizationName;
483                            Array<String> profileNames; // Not going to use this info
484                            Array<String> profileVersions; // Not going to use this info
485                            Array<Uint16> profileOrganizations; // Not going to use this info
486                            Array<String> profileOrganizationNames; // Not going to use this info
487 venkat.puvvada 1.6         Array<String> providerModuleNames; // Not going to use this info
488                            Array<String> providerNames; // Not going to use this info
489                    
490 a.dunfey       1.1         String profileId = extractProfileInfo(currentProfileInstance,
491                                profileCapabilitiesClass,
492                                registeredProfileClass,
493                                profileName,
494                                profileVersion,
495                                profileOrganization,
496                                organizationName,
497                                profileNames,
498                                profileVersions,
499                                profileOrganizations,
500                                profileOrganizationNames,
501 venkat.puvvada 1.6             providerModuleNames,
502                                providerNames,
503 a.dunfey       1.1             true);
504 venkat.puvvada 1.6 
505 a.dunfey       1.1         Uint32 propIndex = currentProfileInstance.findProperty(
506                                  PROFILECAPABILITIES_PROPERTY_CONFORMINGELEMENTS);
507                    
508                            Array<CIMName> elementPropArray;
509                            elementPropArray.append(
510                                ELEMENTCONFORMSTOPROFILE_PROPERTY_CONFORMANTSTANDARD);
511                            elementPropArray.append(
512                                ELEMENTCONFORMSTOPROFILE_PROPERTY_MANAGEDELEMENT);
513                            CIMPropertyList elementPropList(elementPropArray);
514                    
515                            Array<CIMName> conformingElementsForProfile;
516                            Array<CIMNamespaceName> elementNamespacesForProfile;
517                    
518                            Array<String> elementClasses;
519                            currentProfileInstance.getProperty(propIndex).getValue().get(
520                                elementClasses);
521 kumpf          1.4         //if (propIndex == PEG_NOT_FOUND)
522                            if (elementClasses.size() == 0)
523 a.dunfey       1.1         {
524                                // Get the namespaces in which this provider operates and trim down
525                                // the list of capabilities instaces to just those that are related
526                                // to this one.
527                                String moduleName = getRequiredValue<String>(
528                                    currentProfileInstance,
529                                    CAPABILITIES_PROPERTY_PROVIDERMODULENAME);
530                                String providerName = getRequiredValue<String>(
531                                    currentProfileInstance,
532                                    CAPABILITIES_PROPERTY_PROVIDERNAME);
533 kumpf          1.4             if (capabilities.size() == 0)
534 a.dunfey       1.1             {
535                                    Array<CIMName> propList;
536                                    propList.append(
537                                        PROVIDERCAPABILITIES_PROPERTY_PROVIDERMODULENAME);
538                                    propList.append(PROVIDERCAPABILITIES_PROPERTY_PROVIDERNAME);
539                                    propList.append(PROVIDERCAPABILITIES_PROPERTY_NAMESPACES);
540                                    propList.append(PROVIDERCAPABILITIES_PROPERTY_CLASSNAME);
541                                    capabilities = repository->enumerateInstancesForClass(
542                                        PEGASUS_NAMESPACENAME_INTEROP,
543 kumpf          1.3                     PEGASUS_CLASSNAME_PROVIDERCAPABILITIES, false, false,
544 a.dunfey       1.1                     false);
545                                }
546                                Array<CIMInstance> capabilitiesForProvider;
547                                Array<CIMNamespaceName> namespacesForProvider;
548                                Array<CIMNameArray> subclassesForNamespace;
549 kumpf          1.4             for (Uint32 j = 0, m = capabilities.size(); j < m; ++j)
550 a.dunfey       1.1             {
551                                    CIMInstance & currentInstance = capabilities[j];
552                                    String curModuleName = getRequiredValue<String>(
553                                        currentInstance, CAPABILITIES_PROPERTY_PROVIDERMODULENAME);
554                                    String curProviderName = getRequiredValue<String>(
555                                        currentInstance, CAPABILITIES_PROPERTY_PROVIDERNAME);
556 kumpf          1.4                 if (curModuleName == moduleName &&
557 a.dunfey       1.1                     curProviderName == providerName)
558                                    {
559                                        CIMName currentClass(getRequiredValue<String>(
560                                            currentInstance,
561                                            PROVIDERCAPABILITIES_PROPERTY_CLASSNAME));
562                                        capabilitiesForProvider.append(currentInstance);
563                                        StringArray curNamespaces =
564                                            getRequiredValue<StringArray>(currentInstance,
565                                                PROVIDERCAPABILITIES_PROPERTY_NAMESPACES);
566                                        Sint32 z = 0;
567                                        Sint32 y = curNamespaces.size();
568                    
569                                        // If one of the namespaces is Interop, then continue
570                                        bool interopNamespaceFound = false;
571 kumpf          1.4                     for (; z < y; ++z)
572 a.dunfey       1.1                     {
573 kumpf          1.4                         if (CIMNamespaceName(curNamespaces[z]) ==
574 a.dunfey       1.1                             PEGASUS_NAMESPACENAME_INTEROP)
575                                            {
576                                                interopNamespaceFound = true;
577                                                break;
578                                            }
579                                        }
580 kumpf          1.4                     if (interopNamespaceFound)
581 a.dunfey       1.1                         continue;
582                    
583                                        // See if the current namespaces are already listed
584 kumpf          1.4                     for (Sint32 z = 0, y = curNamespaces.size(); z < y; ++z)
585 a.dunfey       1.1                     {
586                                            Sint32 foundIndex = -1;
587                                            CIMNamespaceName curNamespace = curNamespaces[z];
588                                            Uint32 k = 0;
589                                            Uint32 x = namespacesForProvider.size();
590 kumpf          1.4                         for (; k < x; ++k)
591 a.dunfey       1.1                         {
592 kumpf          1.4                             if (curNamespace == namespacesForProvider[k])
593 a.dunfey       1.1                             {
594                                                    foundIndex = (Sint32)k;
595                                                    break;
596                                                }
597                                            }
598 kumpf          1.4                         if (foundIndex == -1)
599 a.dunfey       1.1                         {
600                                                // Get all the subclasses of
601                                                // ElementConformsToProfile in the namespace and
602                                                // cache them.
603                                                foundIndex = namespacesForProvider.size();
604                                                Array<CIMName> subClasses = 
605                                                    repository->enumerateClassNames(curNamespace,
606                                                    PEGASUS_CLASSNAME_CIM_ELEMENTCONFORMSTOPROFILE,
607                                                    true);
608                                                subClasses.append(
609                                                    PEGASUS_CLASSNAME_CIM_ELEMENTCONFORMSTOPROFILE
610                                                    );
611                                                namespacesForProvider.append(curNamespace);
612                                                subclassesForNamespace.append(subClasses);
613                                            }
614                    
615                                            // Now search to see if the current class is one of the
616                                            // subclasses in this namespace, and finally, if it is
617                                            // add it to the list
618                                            Array<CIMName> & subClasses =
619                                                subclassesForNamespace[foundIndex];
620 kumpf          1.4                         for (k = 0, x = subClasses.size(); k < x; ++k)
621 a.dunfey       1.1                         {
622 kumpf          1.4                             if (subClasses[k] == currentClass)
623 a.dunfey       1.1                             {
624                                                    String dynamicElement = PEGASUS_DYNAMIC +
625                                                        currentClass.getString();
626                                                    conformingElementsForProfile.append(
627                                                        dynamicElement);
628                                                    elementNamespacesForProfile.append(
629                                                        curNamespace);
630                                                }
631                                            }
632                                        }
633                                    }
634                                }
635                            }
636                            else
637                            {
638                                //Array<String> elementClasses;
639                                //currentProfileInstance.getProperty(propIndex).getValue().get(
640                                //    elementClasses);
641 kumpf          1.4             for (Uint32 j = 0, m = elementClasses.size(); j < m; ++j)
642 a.dunfey       1.1             {
643                                    CIMName elementClass(elementClasses[j]);
644                                    Array<String> searchNamespaces =
645                                        findProviderNamespacesForElement(
646                                            moduleName, providerName,
647                                            elementClass,
648                                            repository,
649                                            providerCapabilitiesInstances);
650                                    Uint32 k = 0;
651                                    Uint32 x = searchNamespaces.size();
652 kumpf          1.4                 for (; k < x; ++k)
653 a.dunfey       1.1                 {
654                                        conformingElementsForProfile.append(elementClass);
655                                        elementNamespacesForProfile.append(searchNamespaces[k]);
656                                    }
657                                }
658                            }
659                    
660                            Sint32 foundIndex = -1;
661 kumpf          1.4         for (Sint32 j = 0, m = profileIds.size(); j < m; ++j)
662 a.dunfey       1.1         {
663 kumpf          1.4             if (profileIds[j] == profileId)
664 a.dunfey       1.1             {
665                                    foundIndex = j;
666                                    break;
667                                }
668                            }
669                    
670 kumpf          1.4         if (foundIndex >= 0)
671 a.dunfey       1.1         {
672                                // Append the results to already existing entries
673                                conformingElements[foundIndex].appendArray(
674                                    conformingElementsForProfile);
675                                elementNamespaces[foundIndex].appendArray(
676                                    elementNamespacesForProfile);
677                            }
678                            else
679                            {
680                                profileIds.append(profileId);
681                                conformingElements.append(conformingElementsForProfile);
682                                elementNamespaces.append(elementNamespacesForProfile);
683                            }
684                        }
685                    }
686                    
687 a.dunfey       1.2 PEGASUS_NAMESPACE_END
688 a.dunfey       1.1 // END_OF_FILE

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2