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

Diff for /pegasus/src/Pegasus/ControlProviders/InteropProvider/ElementConformsToProfile.cpp between version 1.2 and 1.12.6.2

version 1.2, 2006/11/03 20:15:39 version 1.12.6.2, 2013/06/03 22:35:54
Line 1 
Line 1 
 //%2006////////////////////////////////////////////////////////////////////////  //%LICENSE////////////////////////////////////////////////////////////////
 // //
 // Copyright (c) 2000, 2001, 2002 BMC Software; Hewlett-Packard Development  // Licensed to The Open Group (TOG) under one or more contributor license
 // Company, L.P.; IBM Corp.; The Open Group; Tivoli Systems.  // agreements.  Refer to the OpenPegasusNOTICE.txt file distributed with
 // Copyright (c) 2003 BMC Software; Hewlett-Packard Development Company, L.P.;  // this work for additional information regarding copyright ownership.
 // IBM Corp.; EMC Corporation, The Open Group.  // Each contributor licenses this file to you under the OpenPegasus Open
 // Copyright (c) 2004 BMC Software; Hewlett-Packard Development Company, L.P.;  // Source License; you may not use this file except in compliance with the
 // IBM Corp.; EMC Corporation; VERITAS Software Corporation; The Open Group.  // License.
 // Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.;  //
 // EMC Corporation; VERITAS Software Corporation; The Open Group.  // Permission is hereby granted, free of charge, to any person obtaining a
 // Copyright (c) 2006 Hewlett-Packard Development Company, L.P.; IBM Corp.;  // copy of this software and associated documentation files (the "Software"),
 // EMC Corporation; Symantec Corporation; The Open Group.  // to deal in the Software without restriction, including without limitation
 //  // the rights to use, copy, modify, merge, publish, distribute, sublicense,
 // Permission is hereby granted, free of charge, to any person obtaining a copy  // and/or sell copies of the Software, and to permit persons to whom the
 // of this software and associated documentation files (the "Software"), to  // Software is furnished to do so, subject to the following conditions:
 // deal in the Software without restriction, including without limitation the  //
 // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or  // The above copyright notice and this permission notice shall be included
 // sell copies of the Software, and to permit persons to whom the Software is  // in all copies or substantial portions of the Software.
 // furnished to do so, subject to the following conditions:  //
 //  // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
 // THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN  // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
 // ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED  // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
 // "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT  // IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
 // LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR  // CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
 // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT  // TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
 // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN  // SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 // ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION  
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.  
 // //
 //==============================================================================  //////////////////////////////////////////////////////////////////////////
   //
   //%////////////////////////////////////////////////////////////////////////////
  
  
 /////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
Line 84 
Line 84 
     return tmpInstance;     return tmpInstance;
 } }
  
   Array<CIMInstance> InteropProvider::enumElementConformsToProfileRPRPInstances(
       const OperationContext & opContext,
       const CIMNamespaceName & opNamespace)
   {
       CIMClass elementConformsClass = repository->getClass(
           PEGASUS_NAMESPACENAME_INTEROP,
           PEGASUS_CLASSNAME_PG_ELEMENTCONFORMSTOPROFILE_RP_RP,
           false, true, false);
   
       Array<CIMInstance> instances;
       CIMObjectPath smisVersionProfile, profRegProfile;
   
       if (opNamespace == PEGASUS_NAMESPACENAME_INTEROP)
       {
           //Add associations between the 1.2 SMIS-Version profile and all
           //the version 1.2.0 profiles and subprofiles.
           smisVersionProfile = buildDependencyReference(
               hostName,
               buildProfileInstanceId(SNIA_NAME, "SMI-S", SNIA_VER_120),
               PEGASUS_CLASSNAME_PG_REGISTEREDPROFILE);
   
           Array<CIMInstance> profileInstances =
               enumRegisteredProfileInstances();
           Array<CIMInstance> subprofileInstances =
               enumRegisteredSubProfileInstances();
           profileInstances.appendArray(subprofileInstances);
           Array<CIMInstance> profilesForVersion = getProfilesForVersion(
               profileInstances, SNIA_NUM, 1, 2, 0);
           for (Uint32 i = 0, n = profilesForVersion.size(); i < n; ++i)
           {
               instances.append(buildElementConformsToProfile(
                   smisVersionProfile,
                   profilesForVersion[i].getPath(),
                   elementConformsClass));
           }
       }
       return instances;
   }
   
 // //
 // Enumerates all of the ElementConformsToProfile association instances. // Enumerates all of the ElementConformsToProfile association instances.
 // //
Line 140 
Line 179 
                         CIMInstance & currentInstance =                         CIMInstance & currentInstance =
                             elementConformsInstances[k];                             elementConformsInstances[k];
  
                           // NOCHKSRC
                         // Make sure that the current instance points to the                         // Make sure that the current instance points to the
                         // current profile ID.                         // current profile ID.
                         CIMObjectPath profilePath =                         CIMObjectPath profilePath =
                             getRequiredValue<CIMObjectPath>(                             getRequiredValue<CIMObjectPath>(
                                 elementConformsInstances[k],                                 elementConformsInstances[k],
                                 ELEMENTCONFORMSTOPROFILE_PROPERTY_CONFORMANTSTANDARD);                                 ELEMENTCONFORMSTOPROFILE_PROPERTY_CONFORMANTSTANDARD);
                           // DOCHKSRC
                         const Array<CIMKeyBinding> & keys =                         const Array<CIMKeyBinding> & keys =
                             profilePath.getKeyBindings();                             profilePath.getKeyBindings();
                         if(keys.size() != 1)                         if(keys.size() != 1)
                             continue;                             continue;
                         if(keys.size() == 1 && keys[0].getValue() == profileId)                         if(keys.size() == 1 && keys[0].getValue() == profileId)
                         {                         {
                               // NOCHKSRC
                             conformingElementPaths.append(                             conformingElementPaths.append(
                                 getRequiredValue<CIMObjectPath>(                                 getRequiredValue<CIMObjectPath>(
                                 currentInstance,                                 currentInstance,
                                 ELEMENTCONFORMSTOPROFILE_PROPERTY_MANAGEDELEMENT));                                 ELEMENTCONFORMSTOPROFILE_PROPERTY_MANAGEDELEMENT));
                               // DOCHKSRC
                         }                         }
                     }                     }
                 }                 }
Line 197 
Line 240 
     // and the ObjectManager (if we're in the Interop namespace)     // and the ObjectManager (if we're in the Interop namespace)
     if(opNamespace == PEGASUS_NAMESPACENAME_INTEROP)     if(opNamespace == PEGASUS_NAMESPACENAME_INTEROP)
     {     {
         // Build up the Object Path for the server profile          // Build up the Object Path for the server profile version 1.1.0
         CIMObjectPath serverProfile = buildDependencyReference(hostName,          CIMObjectPath serverProfile = buildDependencyReference(
               hostName,
             buildProfileInstanceId(SNIA_NAME, "Server", SNIA_VER_110),             buildProfileInstanceId(SNIA_NAME, "Server", SNIA_VER_110),
             PEGASUS_CLASSNAME_PG_REGISTEREDPROFILE);             PEGASUS_CLASSNAME_PG_REGISTEREDPROFILE);
         // Retrieve the Object Manager instance         // Retrieve the Object Manager instance
         CIMInstance objManager = getObjectManagerInstance();         CIMInstance objManager = getObjectManagerInstance();
  
         instances.append(buildElementConformsToProfile(serverProfile,          instances.append(
             objManager.getPath(), elementConformsClass));              buildElementConformsToProfile(
                   serverProfile,
                   objManager.getPath(),
                   elementConformsClass));
   
           // Build up the Object Path for the server profile ver 1.2.0
           // and add the elementconformstoprofile association instance
           serverProfile = buildDependencyReference(
               hostName,
               buildProfileInstanceId(SNIA_NAME, "Server", SNIA_VER_120),
               PEGASUS_CLASSNAME_PG_REGISTEREDPROFILE);
           instances.append(
               buildElementConformsToProfile(
                   serverProfile,
                   objManager.getPath(),
                   elementConformsClass));
   
       }
   
   #ifdef PEGASUS_ENABLE_DMTF_INDICATION_PROFILE_SUPPORT
       // Now add the  association between the Indication profile
       // and IndicationService
       if (opNamespace == PEGASUS_NAMESPACENAME_INTEROP)
       {
           CIMObjectPath serverProfile = buildDependencyReference(
               hostName,
               buildProfileInstanceId(DMTF_NAME, "Indications", DMTF_VER_110),
               PEGASUS_CLASSNAME_PG_REGISTEREDPROFILE);
           // Retrieve the IndicationService instance
           Array<CIMInstance> indService =
               enumIndicationServiceInstances(OperationContext());
   
           instances.append(
               buildElementConformsToProfile(
                   serverProfile,
                   indService[0].getPath(),
                   elementConformsClass));
       }
   #endif
   
       return instances;
   }
   
   //Method that filters the registered profile or registered subprofile instances
   //whose versions are greater or equal to the given version.
   Array<CIMInstance> InteropProvider::getProfilesForVersion(
       Array<CIMInstance>& profiles,
       Uint16 regOrg,
       Uint32 majorVer,
       Uint32 minorVer,
       Uint32 updateVer)
   {
       static const String SMISProfileName("SMI-S");
       static const String SNIAIndicationProfileName("Indication");
       static const String DMTFIndicationProfileName("Indications");
       static const String ServerProfileName("Server");
       static const String SoftwareProfileName("Software");
   
       Array<CIMInstance> instances;
       instances.clear();
       for (Uint32 i = 0, n = profiles.size(); i < n; ++i)
       {
           String versionNumber;
           String profileName;
           //Can use 0 here as registered organization value of 0 is
           //ruled out(not specified in the CIM Schema
           Uint16 regOrgNo = 0;
   
           Uint32 index = profiles[i].findProperty("RegisteredVersion");
           if (index != PEG_NOT_FOUND)
           {
               const CIMValue &tmpVal = profiles[i].getProperty(index).getValue();
               if (!tmpVal.isNull())
               {
                 tmpVal.get(versionNumber);
               }
           }
           index = profiles[i].findProperty("RegisteredName");
           if (index != PEG_NOT_FOUND)
           {
               const CIMValue &tmpVal = profiles[i].getProperty(index).getValue();
               if (!tmpVal.isNull())
               {
                   tmpVal.get(profileName);
               }
           }
           index = profiles[i].findProperty("RegisteredOrganization");
           if (index != PEG_NOT_FOUND)
           {
               const CIMValue &tmpVal = profiles[i].getProperty(index).getValue();
               if (!tmpVal.isNull())
               {
                   tmpVal.get(regOrgNo);
               }
     }     }
  
           if ( regOrgNo != 0 && regOrg == regOrgNo)
           {
               if (profileName == ServerProfileName ||
                   (regOrg == SNIA_NUM &&
                       profileName == SNIAIndicationProfileName) ||
                   (regOrg == DMTF_NUM
                       && profileName == DMTFIndicationProfileName) ||
                   profileName == SoftwareProfileName)
               {
                   if (VersionUtil::isVersionGreaterOrEqual(
                       versionNumber, majorVer, minorVer, updateVer))
                   {
                       instances.append(profiles[i]);
                   }
               }
               else if (profileName != SMISProfileName)
               {
                   instances.append(profiles[i]);
               }
           }
       }
     return instances;     return instances;
 } }
  
Line 216 
Line 374 
  
 void InteropProvider::verifyCachedInfo() void InteropProvider::verifyCachedInfo()
 { {
     // TBD: May need an algorithm to determine whether or not the information      if (!updateProfileCache.get())
     // cached by the Interop Provider is out of date in some way. Until that      {
     // can be created, then providers that are dynamically registered after          return;
     // the Server profile has already been traversed may not be properly      }
     // reflected. Although this is a shortcoming, the current users of this      // At present cache will be rebuilt in the following conditions.
     // functionality do not generally use dynamic registration as part of their      // (1) When instances of PG_ProviderProfileCapabilities is created
     // installation procedures.      //     or deleted.
       // (2) When Provider and ProviderCapabilities instances
       //     are created or Provider, ProviderModule and ProviderCapabilities
       //     instance are deleted.
       // (3) When Provider or ProviderModule is disabled or enabled.
       AutoMutex mtx(interopMut);
       if (updateProfileCache.get())
       {
           initializeNamespaces();
           cacheProfileRegistrationInfo();
           updateProfileCache--;
       }
 } }
  
 // //
Line 245 
Line 414 
         propList.append(PROVIDERCAPABILITIES_PROPERTY_CLASSNAME);         propList.append(PROVIDERCAPABILITIES_PROPERTY_CLASSNAME);
         capabilities = repository->enumerateInstancesForClass(         capabilities = repository->enumerateInstancesForClass(
             PEGASUS_NAMESPACENAME_INTEROP,             PEGASUS_NAMESPACENAME_INTEROP,
             PEGASUS_CLASSNAME_PROVIDERCAPABILITIES, true, false, false);              PEGASUS_CLASSNAME_PROVIDERCAPABILITIES, false, false);
     }     }
     else     else
     {     {
Line 304 
Line 473 
 { {
     Array<CIMInstance> instances;     Array<CIMInstance> instances;
     Array<CIMInstance> providerCapabilitiesInstances;     Array<CIMInstance> providerCapabilitiesInstances;
   
       // Clear existing cache
       profileIds.clear();
       conformingElements.clear();
       elementNamespaces.clear();
   
     // Retrieve all of the provider profile registration info     // Retrieve all of the provider profile registration info
     Array<CIMName> propList;     Array<CIMName> propList;
     propList.append(CAPABILITIES_PROPERTY_PROVIDERMODULENAME);     propList.append(CAPABILITIES_PROPERTY_PROVIDERMODULENAME);
Line 313 
Line 488 
     propList.append(PROFILECAPABILITIES_PROPERTY_OTHERREGISTEREDPROFILE);     propList.append(PROFILECAPABILITIES_PROPERTY_OTHERREGISTEREDPROFILE);
     propList.append(PROFILECAPABILITIES_PROPERTY_OTHERPROFILEORGANIZATION);     propList.append(PROFILECAPABILITIES_PROPERTY_OTHERPROFILEORGANIZATION);
     propList.append(PROFILECAPABILITIES_PROPERTY_CONFORMINGELEMENTS);     propList.append(PROFILECAPABILITIES_PROPERTY_CONFORMINGELEMENTS);
   
     Array<CIMInstance> providerProfileInstances =     Array<CIMInstance> providerProfileInstances =
         repository->enumerateInstancesForClass(PEGASUS_NAMESPACENAME_INTEROP,          enumProviderProfileCapabilityInstances(
             PEGASUS_CLASSNAME_PG_PROVIDERPROFILECAPABILITIES, true,              true,
             false, false, CIMPropertyList(propList));              false,
               false,
               CIMPropertyList(propList));
   
     CIMClass elementConformsClass = repository->getClass(     CIMClass elementConformsClass = repository->getClass(
         PEGASUS_NAMESPACENAME_INTEROP,         PEGASUS_NAMESPACENAME_INTEROP,
         PEGASUS_CLASSNAME_PG_ELEMENTCONFORMSTOPROFILE,         PEGASUS_CLASSNAME_PG_ELEMENTCONFORMSTOPROFILE,
Line 345 
Line 524 
         Array<String> profileVersions; // Not going to use this info         Array<String> profileVersions; // Not going to use this info
         Array<Uint16> profileOrganizations; // Not going to use this info         Array<Uint16> profileOrganizations; // Not going to use this info
         Array<String> profileOrganizationNames; // Not going to use this info         Array<String> profileOrganizationNames; // Not going to use this info
           Array<String> providerModuleNames; // Not going to use this info
           Array<String> providerNames; // Not going to use this info
   
         String profileId = extractProfileInfo(currentProfileInstance,         String profileId = extractProfileInfo(currentProfileInstance,
             profileCapabilitiesClass,             profileCapabilitiesClass,
             registeredProfileClass,             registeredProfileClass,
Line 356 
Line 538 
             profileVersions,             profileVersions,
             profileOrganizations,             profileOrganizations,
             profileOrganizationNames,             profileOrganizationNames,
               providerModuleNames,
               providerNames,
             true);             true);
   
         Uint32 propIndex = currentProfileInstance.findProperty(         Uint32 propIndex = currentProfileInstance.findProperty(
               PROFILECAPABILITIES_PROPERTY_CONFORMINGELEMENTS);               PROFILECAPABILITIES_PROPERTY_CONFORMINGELEMENTS);
  
Line 379 
Line 564 
             // Get the namespaces in which this provider operates and trim down             // Get the namespaces in which this provider operates and trim down
             // the list of capabilities instaces to just those that are related             // the list of capabilities instaces to just those that are related
             // to this one.             // to this one.
             String moduleName = getRequiredValue<String>(  
                 currentProfileInstance,  
                 CAPABILITIES_PROPERTY_PROVIDERMODULENAME);  
             String providerName = getRequiredValue<String>(  
                 currentProfileInstance,  
                 CAPABILITIES_PROPERTY_PROVIDERNAME);  
             if(capabilities.size() == 0)             if(capabilities.size() == 0)
             {             {
                 Array<CIMName> propList;                  Array<CIMName> capPropList;
                 propList.append(                  capPropList.append(
                     PROVIDERCAPABILITIES_PROPERTY_PROVIDERMODULENAME);                     PROVIDERCAPABILITIES_PROPERTY_PROVIDERMODULENAME);
                 propList.append(PROVIDERCAPABILITIES_PROPERTY_PROVIDERNAME);                  capPropList.append(PROVIDERCAPABILITIES_PROPERTY_PROVIDERNAME);
                 propList.append(PROVIDERCAPABILITIES_PROPERTY_NAMESPACES);                  capPropList.append(PROVIDERCAPABILITIES_PROPERTY_NAMESPACES);
                 propList.append(PROVIDERCAPABILITIES_PROPERTY_CLASSNAME);                  capPropList.append(PROVIDERCAPABILITIES_PROPERTY_CLASSNAME);
                 capabilities = repository->enumerateInstancesForClass(                 capabilities = repository->enumerateInstancesForClass(
                     PEGASUS_NAMESPACENAME_INTEROP,                     PEGASUS_NAMESPACENAME_INTEROP,
                     PEGASUS_CLASSNAME_PROVIDERCAPABILITIES, true, false,                      PEGASUS_CLASSNAME_PROVIDERCAPABILITIES, false, false);
                     false);  
             }             }
             Array<CIMInstance> capabilitiesForProvider;             Array<CIMInstance> capabilitiesForProvider;
             Array<CIMNamespaceName> namespacesForProvider;             Array<CIMNamespaceName> namespacesForProvider;
Line 436 
Line 614 
                         continue;                         continue;
  
                     // See if the current namespaces are already listed                     // See if the current namespaces are already listed
                     for(Sint32 z = 0, y = curNamespaces.size(); z < y; ++z)                      for (Sint32 w = 0; w < y; ++w)
                     {                     {
                         Sint32 foundIndex = -1;                         Sint32 foundIndex = -1;
                         CIMNamespaceName curNamespace = curNamespaces[z];                          CIMNamespaceName curNamespace = curNamespaces[w];
                         Uint32 k = 0;                         Uint32 k = 0;
                         Uint32 x = namespacesForProvider.size();                         Uint32 x = namespacesForProvider.size();
                         for(; k < x; ++k)                         for(; k < x; ++k)


Legend:
Removed from v.1.2  
changed lines
  Added in v.1.12.6.2

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2