(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               //  Interop forces all creates to the PEGASUS_NAMESPACENAME_INTEROP 
 43               //  namespace. There is a test on each operation that returns 
 44               //  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 a.dunfey  1.1 #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                   const OperationContext & opContext, 
 89                   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                       //Add associations between the 1.2 SMIS-Version profile and all 
102                       //the version 1.2.0 profiles and subprofiles. 
103                       smisVersionProfile = buildDependencyReference(
104                           hostName,
105                           buildProfileInstanceId(SNIA_NAME, "SMI-S", SNIA_VER_120),
106                           PEGASUS_CLASSNAME_PG_REGISTEREDPROFILE);
107               
108 s.manicka 1.5         Array<CIMInstance> profileInstances = 
109                           enumRegisteredProfileInstances();
110                       Array<CIMInstance> subprofileInstances = 
111                           enumRegisteredSubProfileInstances();
112                       profileInstances.appendArray(subprofileInstances);
113                       Array<CIMInstance> profilesForVersion = getProfilesForVersion(
114                           profileInstances, 
115                           SNIA_VER_120); 
116                       for (Uint32 i = 0, n = profilesForVersion.size(); i < n; ++i)
117                       {
118                           instances.append(buildElementConformsToProfile(
119                               smisVersionProfile,
120                               profilesForVersion[i].getPath(), 
121                               elementConformsClass));
122                       }
123               
124                       //Add association between the 1.2 SMI-S registeredprofile and 
125                       //profileregistration registeredprofile with registeredversion 1.0.0
126                       profRegProfile = buildDependencyReference(
127                           hostName,
128                           buildProfileInstanceId(
129 s.manicka 1.5                 SNIA_NAME, 
130                               "Profile Registration",
131                               SNIA_VER_100),
132                           PEGASUS_CLASSNAME_PG_REGISTEREDPROFILE);
133                       instances.append(buildElementConformsToProfile(
134                           smisVersionProfile,
135                           profRegProfile, 
136                           elementConformsClass));
137               
138               
139                   }
140                   return instances;
141               }
142               
143 a.dunfey  1.1 //
144               // Enumerates all of the ElementConformsToProfile association instances.
145               //
146               Array<CIMInstance> InteropProvider::enumElementConformsToProfileInstances(
147                   const OperationContext & opContext, const CIMNamespaceName & opNamespace)
148               {
149                   CIMClass elementConformsClass = repository->getClass(
150                       PEGASUS_NAMESPACENAME_INTEROP,
151                       PEGASUS_CLASSNAME_PG_ELEMENTCONFORMSTOPROFILE,
152                       false, true, false);
153               
154                   AutoMutex holder(interopMut);
155                   Array<CIMInstance> instances;
156                   verifyCachedInfo();
157                   // Loop through the cached profile Id's and related info about its
158                   // conforming elements.
159 kumpf     1.4     for (Uint32 i = 0, n = profileIds.size(); i < n; ++i)
160 a.dunfey  1.1     {
161                       String & profileId = profileIds[i];
162                       Array<CIMName> & elementList = conformingElements[i];
163                       Array<CIMNamespaceName> & namespaceList = elementNamespaces[i];
164                       Array<CIMObjectPath> conformingElementPaths;
165 kumpf     1.4         for (Uint32 j = 0, m = elementList.size(); j < m; ++j)
166 a.dunfey  1.1         {
167                           CIMName & currentElement = elementList[j];
168                           CIMNamespaceName & currentNamespace = namespaceList[j];
169               
170 kumpf     1.4             if (opNamespace == PEGASUS_NAMESPACENAME_INTEROP ||
171 a.dunfey  1.1                 opNamespace == currentNamespace)
172                           {
173                               String currentElementStr(currentElement.getString());
174 kumpf     1.4                 if (currentElementStr.find(PEGASUS_DYNAMIC) == 0)
175 a.dunfey  1.1                 {
176                                   // If the provider profile registration did not provide a
177                                   // list of conforming elements (presumably because there is
178                                   // no such definite list), then the provider is required
179                                   // to provide instances of ElementConformsToProfile in the
180                                   // vendor namespace, so we do not generate instances.
181 kumpf     1.4                     if (opNamespace != PEGASUS_NAMESPACENAME_INTEROP)
182 a.dunfey  1.1                     {
183                                       continue;
184                                   }
185                                   CIMName subclassName(
186                                       currentElementStr.subString(PEGASUS_DYNAMIC_LEN));
187                                   Array<CIMInstance> elementConformsInstances =
188                                       cimomHandle.enumerateInstances(opContext,
189                                       currentNamespace, subclassName, true, false, false,
190                                       true, CIMPropertyList());
191               
192                                   // Retrieve the Conforming Element
193 kumpf     1.4                     for (Uint32 k = 0, x = elementConformsInstances.size();
194 a.dunfey  1.1                         k < x; ++k)
195                                   {
196                                       CIMInstance & currentInstance =
197                                           elementConformsInstances[k];
198               
199 kumpf     1.4                         // NOCHKSRC
200 a.dunfey  1.1                         // Make sure that the current instance points to the
201                                       // current profile ID.
202                                       CIMObjectPath profilePath =
203                                           getRequiredValue<CIMObjectPath>(
204                                               elementConformsInstances[k],
205                                               ELEMENTCONFORMSTOPROFILE_PROPERTY_CONFORMANTSTANDARD);
206 kumpf     1.4                         // DOCHKSRC
207 a.dunfey  1.1                         const Array<CIMKeyBinding> & keys =
208                                           profilePath.getKeyBindings();
209 kumpf     1.4                         if (keys.size() != 1)
210 a.dunfey  1.1                             continue;
211 kumpf     1.4                         if (keys.size() == 1 && keys[0].getValue() == profileId)
212 a.dunfey  1.1                         {
213 kumpf     1.4                             // NOCHKSRC
214 a.dunfey  1.1                             conformingElementPaths.append(
215                                               getRequiredValue<CIMObjectPath>(
216                                               currentInstance,
217                                               ELEMENTCONFORMSTOPROFILE_PROPERTY_MANAGEDELEMENT));
218 kumpf     1.4                             // DOCHKSRC
219 a.dunfey  1.1                         }
220                                   }
221                               }
222                               else
223                               {
224                                   // All of the instances of the current element in the
225                                   // corresponding namespace conform to the current profile.
226                                   Array<CIMObjectPath> paths =
227                                       cimomHandle.enumerateInstanceNames(opContext,
228                                           currentNamespace, currentElement);
229                                   // Set the namespace in the paths just in case
230 kumpf     1.4                     for (Uint32 k = 0, x = paths.size();
231 a.dunfey  1.1                         k < x; ++k)
232                                   {
233                                       CIMObjectPath & curPath = paths[k];
234                                       curPath.setNameSpace(currentNamespace);
235                                       curPath.setHost(hostName);
236                                   }
237                                   conformingElementPaths.appendArray(paths);
238                               }
239                           }
240                       }
241               
242                       // Create the object path for the RegisteredProfile using the given
243                       // profileId.
244                       CIMObjectPath profilePath = buildDependencyReference(
245                           hostName, profileIds[i], PEGASUS_CLASSNAME_PG_REGISTEREDPROFILE);
246               
247                       // Build all of the ElementConformsToProfile instances for the current
248                       // profile.
249 kumpf     1.4         for (Uint32 k = 0, x = conformingElementPaths.size(); k < x; ++k)
250 a.dunfey  1.1         {
251                           instances.append(buildElementConformsToProfile(profilePath,
252                               conformingElementPaths[k], elementConformsClass));
253                       }
254                   }
255               
256                   // Now add the default instance: the association between the Server Profile
257                   // and the ObjectManager (if we're in the Interop namespace)
258 kumpf     1.4     if (opNamespace == PEGASUS_NAMESPACENAME_INTEROP)
259 a.dunfey  1.1     {
260 s.manicka 1.5         // Build up the Object Path for the server profile version 1.1.0
261                       CIMObjectPath serverProfile = buildDependencyReference(
262                           hostName,
263 a.dunfey  1.1             buildProfileInstanceId(SNIA_NAME, "Server", SNIA_VER_110),
264                           PEGASUS_CLASSNAME_PG_REGISTEREDPROFILE);
265                       // Retrieve the Object Manager instance
266                       CIMInstance objManager = getObjectManagerInstance();
267               
268 s.manicka 1.5         instances.append(
269                           buildElementConformsToProfile(
270                               serverProfile,
271                               objManager.getPath(), 
272                               elementConformsClass));
273               
274                       // Build up the Object Path for the server profile ver 1.2.0
275                       // and add the elementconformstoprofile association instance
276                       serverProfile = buildDependencyReference(
277                           hostName,
278                           buildProfileInstanceId(SNIA_NAME, "Server", SNIA_VER_120),
279                           PEGASUS_CLASSNAME_PG_REGISTEREDPROFILE);
280                       instances.append(
281                           buildElementConformsToProfile(
282                               serverProfile,
283                               objManager.getPath(), 
284                               elementConformsClass));
285                       
286 a.dunfey  1.1     }
287 s.manicka 1.5     return instances;
288               }
289               
290               //Method that filters the registered profile or registered subprofile instances
291               //for the SMI-S version.
292               Array<CIMInstance> InteropProvider::getProfilesForVersion(
293                   Array<CIMInstance>& profiles,
294                   const String version)
295               {
296                   Array<CIMInstance> instances;
297                   instances.clear();
298                   for (Uint32 i = 0, n = profiles.size(); i < n; ++i)
299                   {
300                       String versionNumber;
301                       String profileName;
302                       Uint32 index = profiles[i].findProperty("RegisteredVersion");
303                       if (index != PEG_NOT_FOUND)
304                       {
305                           const CIMValue &tmpVal = profiles[i].getProperty(index).getValue();
306                           if (!tmpVal.isNull())
307                           {
308 s.manicka 1.5               tmpVal.get(versionNumber);
309                           }
310                       }
311                       index = profiles[i].findProperty("RegisteredName");
312                       if (index != PEG_NOT_FOUND)
313                       {
314                           const CIMValue &tmpVal = profiles[i].getProperty(index).getValue();
315                           if (!tmpVal.isNull())
316                           {
317                               tmpVal.get(profileName);
318                           }
319                       }
320 a.dunfey  1.1 
321 s.manicka 1.5         if ((versionNumber == version) && (profileName != String("SMI-S")))
322                       {
323                           instances.append(profiles[i]);
324                       }
325                   }
326 a.dunfey  1.1     return instances;
327               }
328               
329               
330               typedef Array<String> StringArray;
331               
332               void InteropProvider::verifyCachedInfo()
333               {
334 venkat.puvvada 1.6     if (!updateProfileCache.get())
335                        {
336                            return;
337                        }
338                        // At present cache will be rebuilt in the following conditions.
339                        // (1) When instances of PG_ProviderProfileCapabilities is created
340                        //     or deleted.
341                        // (2) When Provider and ProviderCapabilities instances
342                        //     are created or Provider, ProviderModule and ProviderCapabilities
343                        //     instance are deleted.
344                        // (3) When Provider or ProviderModule is disabled or enabled.
345                        AutoMutex mtx(interopMut);
346                        if (updateProfileCache.get())
347                        {
348                            initializeNamespaces();
349                            cacheProfileRegistrationInfo();
350                            updateProfileCache--;
351                        }
352 a.dunfey       1.1 }
353                    
354                    //
355                    // Function that determines in which namespaces a provider supports a given
356                    // class. This information is needed to properly implement the
357                    // ElementConformsToProfile association.
358                    //
359                    Array<String> findProviderNamespacesForElement(
360                        const String & moduleName, const String & providerName,
361                        const CIMName & elementClass, CIMRepository * repository,
362                        Array<CIMInstance> & providerCapabilitiesInstances)
363                    {
364                        Array<CIMInstance> capabilities;
365 kumpf          1.4     if (providerCapabilitiesInstances.size() == 0)
366 a.dunfey       1.1     {
367                            Array<CIMName> propList;
368                            propList.append(PROVIDERCAPABILITIES_PROPERTY_PROVIDERMODULENAME);
369                            propList.append(PROVIDERCAPABILITIES_PROPERTY_PROVIDERNAME);
370                            propList.append(PROVIDERCAPABILITIES_PROPERTY_NAMESPACES);
371                            propList.append(PROVIDERCAPABILITIES_PROPERTY_CLASSNAME);
372                            capabilities = repository->enumerateInstancesForClass(
373                                PEGASUS_NAMESPACENAME_INTEROP,
374 kumpf          1.3             PEGASUS_CLASSNAME_PROVIDERCAPABILITIES, false, false, false);
375 a.dunfey       1.1     }
376                        else
377                        {
378                            capabilities = providerCapabilitiesInstances;
379                        }
380                    
381 kumpf          1.4     for (Uint32 i = 0, n = capabilities.size(); i < n; ++i)
382 a.dunfey       1.1     {
383                            CIMInstance & currentCapabilities = capabilities[i];
384                            Uint32 propIndex = currentCapabilities.findProperty(
385                                PROVIDERCAPABILITIES_PROPERTY_PROVIDERMODULENAME);
386                            PEGASUS_ASSERT(propIndex != PEG_NOT_FOUND);
387                            String currentName;
388                            currentCapabilities.getProperty(propIndex).getValue().get(
389                                currentName);
390 kumpf          1.4         if (currentName == moduleName)
391 a.dunfey       1.1         {
392                                propIndex = currentCapabilities.findProperty(
393                                    PROVIDERCAPABILITIES_PROPERTY_PROVIDERNAME);
394                                PEGASUS_ASSERT(propIndex != PEG_NOT_FOUND);
395                                currentCapabilities.getProperty(propIndex).getValue().get(
396                                    currentName);
397 kumpf          1.4             if (currentName == providerName)
398 a.dunfey       1.1             {
399                                    propIndex = currentCapabilities.findProperty(
400                                        PROVIDERCAPABILITIES_PROPERTY_CLASSNAME);
401                                    PEGASUS_ASSERT(propIndex != PEG_NOT_FOUND);
402                                    currentCapabilities.getProperty(propIndex).getValue().get(
403                                        currentName);
404 kumpf          1.4                 if (elementClass.equal(CIMName(currentName)))
405 a.dunfey       1.1                 {
406                                        propIndex = currentCapabilities.findProperty(
407                                          PROVIDERCAPABILITIES_PROPERTY_NAMESPACES);
408                                        PEGASUS_ASSERT(propIndex != PEG_NOT_FOUND);
409                                        Array<String> namespaces;
410                                        currentCapabilities.getProperty(propIndex).getValue().get(
411                                            namespaces);
412                                        return namespaces;
413                                    }
414                                }
415                            }
416                        }
417                    
418                        throw PEGASUS_CIM_EXCEPTION(CIM_ERR_NOT_FOUND,
419                            "Could not find provider capabilities registered for module " +
420                            moduleName + ", provider " + providerName + ", and class " +
421                            elementClass.getString());
422                    }
423                    
424                    //
425                    // Method that caches certain profile registration information. Specifically,
426 a.dunfey       1.1 // information pertaining to the ElementConformsToProfofile association
427                    // implementation is kept here.
428                    //
429                    void InteropProvider::cacheProfileRegistrationInfo()
430                    {
431                        Array<CIMInstance> instances;
432                        Array<CIMInstance> providerCapabilitiesInstances;
433 venkat.puvvada 1.6 
434                        // Clear existing cache
435                        profileIds.clear();
436                        conformingElements.clear();
437                        elementNamespaces.clear();
438                    
439 a.dunfey       1.1     // Retrieve all of the provider profile registration info
440                        Array<CIMName> propList;
441                        propList.append(CAPABILITIES_PROPERTY_PROVIDERMODULENAME);
442                        propList.append(CAPABILITIES_PROPERTY_PROVIDERNAME);
443                        propList.append(PROFILECAPABILITIES_PROPERTY_PROFILEVERSION);
444                        propList.append(PROFILECAPABILITIES_PROPERTY_REGISTEREDPROFILE);
445                        propList.append(PROFILECAPABILITIES_PROPERTY_OTHERREGISTEREDPROFILE);
446                        propList.append(PROFILECAPABILITIES_PROPERTY_OTHERPROFILEORGANIZATION);
447                        propList.append(PROFILECAPABILITIES_PROPERTY_CONFORMINGELEMENTS);
448 venkat.puvvada 1.6 
449                        Array<CIMInstance> providerProfileInstances = 
450                            enumProviderProfileCapabilityInstances(
451                                true,
452                                false,
453                                false,
454                                false,
455                                CIMPropertyList(propList));
456                    
457 a.dunfey       1.1     CIMClass elementConformsClass = repository->getClass(
458                            PEGASUS_NAMESPACENAME_INTEROP,
459                            PEGASUS_CLASSNAME_PG_ELEMENTCONFORMSTOPROFILE,
460                            false, true, false);
461                        CIMClass registeredProfileClass = repository->getClass(
462                            PEGASUS_NAMESPACENAME_INTEROP,
463                            PEGASUS_CLASSNAME_PG_REGISTEREDPROFILE,
464                            false, true, false);
465                        Array<CIMInstance> capabilities;
466                    
467                        // Loop through the provider profile info to determine what profiles are
468                        // supported by what providers, and to build the ElementConformsToProfile
469                        // associations.
470 kumpf          1.4     for (Uint32 i = 0, n = providerProfileInstances.size(); i < n; ++i)
471 a.dunfey       1.1     {
472                            CIMInstance & currentProfileInstance = providerProfileInstances[i];
473                            String moduleName = getRequiredValue<String>(currentProfileInstance,
474                                CAPABILITIES_PROPERTY_PROVIDERMODULENAME);
475                            String providerName = getRequiredValue<String>(currentProfileInstance,
476                                CAPABILITIES_PROPERTY_PROVIDERNAME);
477                            String profileName;
478                            Uint16 profileOrganization = 0;
479                            String profileVersion;
480                            String organizationName;
481                            Array<String> profileNames; // Not going to use this info
482                            Array<String> profileVersions; // Not going to use this info
483                            Array<Uint16> profileOrganizations; // Not going to use this info
484                            Array<String> profileOrganizationNames; // Not going to use this info
485 venkat.puvvada 1.6         Array<String> providerModuleNames; // Not going to use this info
486                            Array<String> providerNames; // Not going to use this info
487                    
488 a.dunfey       1.1         String profileId = extractProfileInfo(currentProfileInstance,
489                                profileCapabilitiesClass,
490                                registeredProfileClass,
491                                profileName,
492                                profileVersion,
493                                profileOrganization,
494                                organizationName,
495                                profileNames,
496                                profileVersions,
497                                profileOrganizations,
498                                profileOrganizationNames,
499 venkat.puvvada 1.6             providerModuleNames,
500                                providerNames,
501 a.dunfey       1.1             true);
502 venkat.puvvada 1.6 
503 a.dunfey       1.1         Uint32 propIndex = currentProfileInstance.findProperty(
504                                  PROFILECAPABILITIES_PROPERTY_CONFORMINGELEMENTS);
505                    
506                            Array<CIMName> elementPropArray;
507                            elementPropArray.append(
508                                ELEMENTCONFORMSTOPROFILE_PROPERTY_CONFORMANTSTANDARD);
509                            elementPropArray.append(
510                                ELEMENTCONFORMSTOPROFILE_PROPERTY_MANAGEDELEMENT);
511                            CIMPropertyList elementPropList(elementPropArray);
512                    
513                            Array<CIMName> conformingElementsForProfile;
514                            Array<CIMNamespaceName> elementNamespacesForProfile;
515                    
516                            Array<String> elementClasses;
517                            currentProfileInstance.getProperty(propIndex).getValue().get(
518                                elementClasses);
519 kumpf          1.4         //if (propIndex == PEG_NOT_FOUND)
520                            if (elementClasses.size() == 0)
521 a.dunfey       1.1         {
522                                // Get the namespaces in which this provider operates and trim down
523                                // the list of capabilities instaces to just those that are related
524                                // to this one.
525 kumpf          1.4             if (capabilities.size() == 0)
526 a.dunfey       1.1             {
527 kumpf          1.7                 Array<CIMName> capPropList;
528                                    capPropList.append(
529 a.dunfey       1.1                     PROVIDERCAPABILITIES_PROPERTY_PROVIDERMODULENAME);
530 kumpf          1.7                 capPropList.append(PROVIDERCAPABILITIES_PROPERTY_PROVIDERNAME);
531                                    capPropList.append(PROVIDERCAPABILITIES_PROPERTY_NAMESPACES);
532                                    capPropList.append(PROVIDERCAPABILITIES_PROPERTY_CLASSNAME);
533 a.dunfey       1.1                 capabilities = repository->enumerateInstancesForClass(
534                                        PEGASUS_NAMESPACENAME_INTEROP,
535 kumpf          1.3                     PEGASUS_CLASSNAME_PROVIDERCAPABILITIES, false, false,
536 a.dunfey       1.1                     false);
537                                }
538                                Array<CIMInstance> capabilitiesForProvider;
539                                Array<CIMNamespaceName> namespacesForProvider;
540                                Array<CIMNameArray> subclassesForNamespace;
541 kumpf          1.4             for (Uint32 j = 0, m = capabilities.size(); j < m; ++j)
542 a.dunfey       1.1             {
543                                    CIMInstance & currentInstance = capabilities[j];
544                                    String curModuleName = getRequiredValue<String>(
545                                        currentInstance, CAPABILITIES_PROPERTY_PROVIDERMODULENAME);
546                                    String curProviderName = getRequiredValue<String>(
547                                        currentInstance, CAPABILITIES_PROPERTY_PROVIDERNAME);
548 kumpf          1.4                 if (curModuleName == moduleName &&
549 a.dunfey       1.1                     curProviderName == providerName)
550                                    {
551                                        CIMName currentClass(getRequiredValue<String>(
552                                            currentInstance,
553                                            PROVIDERCAPABILITIES_PROPERTY_CLASSNAME));
554                                        capabilitiesForProvider.append(currentInstance);
555                                        StringArray curNamespaces =
556                                            getRequiredValue<StringArray>(currentInstance,
557                                                PROVIDERCAPABILITIES_PROPERTY_NAMESPACES);
558                                        Sint32 z = 0;
559                                        Sint32 y = curNamespaces.size();
560                    
561                                        // If one of the namespaces is Interop, then continue
562                                        bool interopNamespaceFound = false;
563 kumpf          1.4                     for (; z < y; ++z)
564 a.dunfey       1.1                     {
565 kumpf          1.4                         if (CIMNamespaceName(curNamespaces[z]) ==
566 a.dunfey       1.1                             PEGASUS_NAMESPACENAME_INTEROP)
567                                            {
568                                                interopNamespaceFound = true;
569                                                break;
570                                            }
571                                        }
572 kumpf          1.4                     if (interopNamespaceFound)
573 a.dunfey       1.1                         continue;
574                    
575                                        // See if the current namespaces are already listed
576 kumpf          1.7                     for (Sint32 w = 0; w < y; ++w)
577 a.dunfey       1.1                     {
578                                            Sint32 foundIndex = -1;
579 kumpf          1.7                         CIMNamespaceName curNamespace = curNamespaces[w];
580 a.dunfey       1.1                         Uint32 k = 0;
581                                            Uint32 x = namespacesForProvider.size();
582 kumpf          1.4                         for (; k < x; ++k)
583 a.dunfey       1.1                         {
584 kumpf          1.4                             if (curNamespace == namespacesForProvider[k])
585 a.dunfey       1.1                             {
586                                                    foundIndex = (Sint32)k;
587                                                    break;
588                                                }
589                                            }
590 kumpf          1.4                         if (foundIndex == -1)
591 a.dunfey       1.1                         {
592                                                // Get all the subclasses of
593                                                // ElementConformsToProfile in the namespace and
594                                                // cache them.
595                                                foundIndex = namespacesForProvider.size();
596                                                Array<CIMName> subClasses = 
597                                                    repository->enumerateClassNames(curNamespace,
598                                                    PEGASUS_CLASSNAME_CIM_ELEMENTCONFORMSTOPROFILE,
599                                                    true);
600                                                subClasses.append(
601                                                    PEGASUS_CLASSNAME_CIM_ELEMENTCONFORMSTOPROFILE
602                                                    );
603                                                namespacesForProvider.append(curNamespace);
604                                                subclassesForNamespace.append(subClasses);
605                                            }
606                    
607                                            // Now search to see if the current class is one of the
608                                            // subclasses in this namespace, and finally, if it is
609                                            // add it to the list
610                                            Array<CIMName> & subClasses =
611                                                subclassesForNamespace[foundIndex];
612 kumpf          1.4                         for (k = 0, x = subClasses.size(); k < x; ++k)
613 a.dunfey       1.1                         {
614 kumpf          1.4                             if (subClasses[k] == currentClass)
615 a.dunfey       1.1                             {
616                                                    String dynamicElement = PEGASUS_DYNAMIC +
617                                                        currentClass.getString();
618                                                    conformingElementsForProfile.append(
619                                                        dynamicElement);
620                                                    elementNamespacesForProfile.append(
621                                                        curNamespace);
622                                                }
623                                            }
624                                        }
625                                    }
626                                }
627                            }
628                            else
629                            {
630                                //Array<String> elementClasses;
631                                //currentProfileInstance.getProperty(propIndex).getValue().get(
632                                //    elementClasses);
633 kumpf          1.4             for (Uint32 j = 0, m = elementClasses.size(); j < m; ++j)
634 a.dunfey       1.1             {
635                                    CIMName elementClass(elementClasses[j]);
636                                    Array<String> searchNamespaces =
637                                        findProviderNamespacesForElement(
638                                            moduleName, providerName,
639                                            elementClass,
640                                            repository,
641                                            providerCapabilitiesInstances);
642                                    Uint32 k = 0;
643                                    Uint32 x = searchNamespaces.size();
644 kumpf          1.4                 for (; k < x; ++k)
645 a.dunfey       1.1                 {
646                                        conformingElementsForProfile.append(elementClass);
647                                        elementNamespacesForProfile.append(searchNamespaces[k]);
648                                    }
649                                }
650                            }
651                    
652                            Sint32 foundIndex = -1;
653 kumpf          1.4         for (Sint32 j = 0, m = profileIds.size(); j < m; ++j)
654 a.dunfey       1.1         {
655 kumpf          1.4             if (profileIds[j] == profileId)
656 a.dunfey       1.1             {
657                                    foundIndex = j;
658                                    break;
659                                }
660                            }
661                    
662 kumpf          1.4         if (foundIndex >= 0)
663 a.dunfey       1.1         {
664                                // Append the results to already existing entries
665                                conformingElements[foundIndex].appendArray(
666                                    conformingElementsForProfile);
667                                elementNamespaces[foundIndex].appendArray(
668                                    elementNamespacesForProfile);
669                            }
670                            else
671                            {
672                                profileIds.append(profileId);
673                                conformingElements.append(conformingElementsForProfile);
674                                elementNamespaces.append(elementNamespacesForProfile);
675                            }
676                        }
677                    }
678                    
679 a.dunfey       1.2 PEGASUS_NAMESPACE_END
680 a.dunfey       1.1 // END_OF_FILE

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2