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

Diff for /pegasus/src/Pegasus/ControlProviders/InteropProvider/InteropProvider.cpp between version 1.79 and 1.88.2.1

version 1.79, 2008/12/01 17:50:33 version 1.88.2.1, 2011/10/11 18:18:16
Line 58 
Line 58 
  
 #include <Pegasus/Common/StatisticalData.h> #include <Pegasus/Common/StatisticalData.h>
 #include <Pegasus/Common/StringConversion.h> #include <Pegasus/Common/StringConversion.h>
   #include <Pegasus/Common/ArrayIterator.h>
  
 PEGASUS_USING_STD; PEGASUS_USING_STD;
 PEGASUS_NAMESPACE_BEGIN PEGASUS_NAMESPACE_BEGIN
Line 75 
Line 76 
 // //
 // Constructor for the InteropProvider control provider // Constructor for the InteropProvider control provider
 // //
 InteropProvider::InteropProvider(CIMRepository * rep) : repository(rep),  InteropProvider::InteropProvider(
     hostName(System::getHostName()), providerInitialized(false),      CIMRepository * rep,
       ProviderRegistrationManager *provRegManager):
           repository(rep),
           providerRegistrationManager(provRegManager),
           hostName(System::getHostName()),
           providerInitialized(false),
     updateProfileCache(0),     updateProfileCache(0),
     profileIds(Array<String>()), conformingElements(Array<CIMNameArray>()),          profileIds(Array<String>()),
           conformingElements(Array<CIMNameArray>()),
     elementNamespaces(Array<CIMNamespaceArray>())     elementNamespaces(Array<CIMNamespaceArray>())
 { {
     PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,"InteropProvider::InteropProvider");     PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,"InteropProvider::InteropProvider");
Line 152 
Line 159 
     // through the PG_ElementConformsToProfile association     // through the PG_ElementConformsToProfile association
     CIMNamespaceName opNamespace = instanceName.getNameSpace();     CIMNamespaceName opNamespace = instanceName.getNameSpace();
     CIMName opClass = instanceName.getClassName();     CIMName opClass = instanceName.getClassName();
     if(opNamespace != PEGASUS_NAMESPACENAME_INTEROP &&      if((opNamespace != PEGASUS_NAMESPACENAME_INTEROP &&
         opClass != PEGASUS_CLASSNAME_PG_ELEMENTCONFORMSTOPROFILE          opClass != PEGASUS_CLASSNAME_PG_ELEMENTCONFORMSTOPROFILE)
         // Get CIM_IndicationService instance from IndicationService.         // Get CIM_IndicationService instance from IndicationService.
 #ifdef PEGASUS_ENABLE_DMTF_INDICATION_PROFILE_SUPPORT #ifdef PEGASUS_ENABLE_DMTF_INDICATION_PROFILE_SUPPORT
         || opClass == PEGASUS_CLASSNAME_CIM_INDICATIONSERVICE         || opClass == PEGASUS_CLASSNAME_CIM_INDICATIONSERVICE
Line 173 
Line 180 
         return gotInstance;         return gotInstance;
     }     }
  
       TARGET_CLASS classEnum  = translateClassInput(opClass);
       CIMInstance retInstance;
       switch(classEnum)
       {
           case PG_SOFTWAREIDENTITY:
           {
               retInstance = getSoftwareIdentityInstance(instanceName);
               normalizeInstance(
                   retInstance, instanceName, false, false, propertyList);
           }
           break;
           case PG_NAMESPACE:
           {
               retInstance = getNameSpaceInstance(instanceName);
               normalizeInstance(
                   retInstance, instanceName, false, false, propertyList);
           }
           break;
           // ATTN: Implement getIntstance for all other classes. Currently
           // this method calls localEnumerateInstances() to select instance
           // which is too expensive.
           default:
           {
     // Create reference from host, namespace, class components of     // Create reference from host, namespace, class components of
     // instance name     // instance name
     CIMObjectPath ref;     CIMObjectPath ref;
Line 187 
Line 217 
         context,         context,
         ref,         ref,
         propertyList);         propertyList);
               ConstArrayIterator<CIMInstance> instancesIter(instances);
  
     // deliver a single instance if found.     // deliver a single instance if found.
     CIMInstance retInstance;  
   
     bool found = false;     bool found = false;
     for(Uint32 i = 0, n = instances.size(); i < n; i++)              for(Uint32 i = 0; i < instancesIter.size(); i++)
     {     {
         CIMObjectPath currentInstRef = instances[i].getPath();                  CIMObjectPath currentInstRef = instancesIter[i].getPath();
         currentInstRef.setHost(instanceName.getHost());         currentInstRef.setHost(instanceName.getHost());
         currentInstRef.setNameSpace(instanceName.getNameSpace());         currentInstRef.setNameSpace(instanceName.getNameSpace());
         if(instanceName == currentInstRef)         if(instanceName == currentInstRef)
         {         {
             retInstance = instances[i];                      retInstance = instancesIter[i];
             found = true;             found = true;
             break;             break;
         }         }
     }     }
  
               PEG_METHOD_EXIT();
     if(!found)     if(!found)
     {     {
       cout << "Coule not find instance: " << instanceName.toString() << endl;                  throw CIMObjectNotFoundException(instanceName.toString());
     }     }
     PEG_METHOD_EXIT();          }
       }
   
     return retInstance;     return retInstance;
 } }
  
   Array<CIMInstance> InteropProvider::getReferencedInstances(
       const Array<CIMInstance> &refs,
       const String targetRole,
       const OperationContext & context,
       const CIMPropertyList & propertyList)
   {
       PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,
           "InteropProvider::getReferencedObjects");
   
       Array<CIMInstance> referencedInstances;
       Array<CIMInstance> classInstances;
       CIMName prevClassName;
   
       ConstArrayIterator<CIMInstance> refsIter(refs);
       for(Uint32 i = 0; i < refsIter.size(); i++)
       {
           CIMInstance thisRef = refsIter[i];
           CIMObjectPath thisTarget = getRequiredValue<CIMObjectPath>(
               thisRef,
               targetRole);
   
           // Test if we're looking for something outside of our namespace. This
           // will happen during associators calls from PG_RegisteredProfile
           // instances through the PG_ElementConformsToProfile association
           CIMNamespaceName opNamespace = thisTarget.getNameSpace();
           CIMName opClass = thisTarget.getClassName();
   
           if((opNamespace != PEGASUS_NAMESPACENAME_INTEROP &&
               opClass != PEGASUS_CLASSNAME_PG_ELEMENTCONFORMSTOPROFILE)
               // Get CIM_IndicationService instance from IndicationService.
   #ifdef PEGASUS_ENABLE_DMTF_INDICATION_PROFILE_SUPPORT
               || opClass == PEGASUS_CLASSNAME_CIM_INDICATIONSERVICE
   #endif
               )
           {
               AutoMutex mut(interopMut);
               CIMInstance gotInstance = cimomHandle.getInstance(
                   context,
                   opNamespace,
                   thisTarget,
                   false,
                   false,
                   false,
                   propertyList);
               referencedInstances.append(gotInstance);
               continue;
           }
   
           TARGET_CLASS classEnum  = translateClassInput(opClass);
           CIMInstance retInstance;
           switch(classEnum)
           {
               case PG_SOFTWAREIDENTITY:
               {
                   CIMInstance retInstance =
                       getSoftwareIdentityInstance(thisTarget);
                   normalizeInstance(
                       retInstance, thisTarget, false, false, propertyList);
                   retInstance.setPath(thisTarget);
                   referencedInstances.append(retInstance);
               }
               break;
               case PG_NAMESPACE:
               {
                   CIMInstance retInstance = getNameSpaceInstance(thisTarget);
                   normalizeInstance(
                       retInstance, thisTarget, false, false, propertyList);
                   retInstance.setPath(thisTarget);
                   referencedInstances.append(retInstance);
               }
               break;
               default:
               {
                   if( opClass != prevClassName )
                   {
                       CIMObjectPath ref;
                       ref.setHost(thisTarget.getHost());
                       ref.setClassName(thisTarget.getClassName());
                       ref.setNameSpace(thisTarget.getNameSpace());
                       classInstances = localEnumerateInstances(
                           context,
                           ref,
                           propertyList);
                       ArrayIterator<CIMInstance> instsIter(classInstances);
                       for(Uint32 n = 0; n < instsIter.size(); n++)
                       {
                           CIMObjectPath tmpInst = instsIter[n].getPath();
                           tmpInst.setHost(thisTarget.getHost());
                           tmpInst.setNameSpace(thisTarget.getNameSpace());
                           instsIter[n].setPath(tmpInst);
                       }
                       prevClassName = opClass;
                   }
                   ConstArrayIterator<CIMInstance> instsConstIter(classInstances);
                   for(Uint32 j = 0; j < instsConstIter.size(); j++)
                   {
                       if(thisTarget == instsConstIter[j].getPath())
                       {
                           referencedInstances.append(instsConstIter[j]);
                           break;
                       }
                   }
               }
               break;
           }
       }
       PEG_METHOD_EXIT();
       return referencedInstances;
   }
  
 // //
 // Local version of enumerateInstances to be used by other functions in the // Local version of enumerateInstances to be used by other functions in the
Line 312 
Line 453 
         }         }
         case PG_INSTALLEDSOFTWAREIDENTITY:         case PG_INSTALLEDSOFTWAREIDENTITY:
         {         {
             instances = enumInstalledSoftwareIdentityInstances();              instances = enumInstalledSoftwareIdentityInstances(context);
             break;             break;
         }         }
         case PG_COMPUTERSYSTEM:         case PG_COMPUTERSYSTEM:
         {         {
             instances.append(getComputerSystemInstance());              instances.append(getComputerSystemInstance(context));
             break;             break;
         }         }
         case PG_HOSTEDOBJECTMANAGER:         case PG_HOSTEDOBJECTMANAGER:
         {         {
             instances.append(getHostedObjectManagerInstance());              instances.append(getHostedObjectManagerInstance(context));
             break;             break;
         }         }
         case PG_HOSTEDACCESSPOINT:         case PG_HOSTEDACCESSPOINT:
         {         {
             instances = enumHostedAccessPointInstances();              instances = enumHostedAccessPointInstances(context);
             break;             break;
         }         }
         //We don't support enumerate CIM_Namespace instances. PG_Namespace is         //We don't support enumerate CIM_Namespace instances. PG_Namespace is
Line 338 
Line 479 
         }         }
         case PG_PROVIDERPROFILECAPABILITIES:         case PG_PROVIDERPROFILECAPABILITIES:
         {         {
             instances = enumProviderProfileCapabilityInstances(false, false);              instances = enumProviderProfileCapabilityInstances(false);
             break;             break;
         }         }
  
Line 393 
Line 534 
     PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,     PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,
         "InteropProvider::validAssocClassForObject()");         "InteropProvider::validAssocClassForObject()");
     TARGET_CLASS assocClassEnum = translateClassInput(assocClass);     TARGET_CLASS assocClassEnum = translateClassInput(assocClass);
     TARGET_CLASS originClassEnum;      TARGET_CLASS originClassEnum = NOCLASS;
     CIMName originClass = objectName.getClassName();     CIMName originClass = objectName.getClassName();
     // If the association class is PG_ElementConformsToProfile, we'll have to     // If the association class is PG_ElementConformsToProfile, we'll have to
     // do some special processing in case the origin instance for the operation     // do some special processing in case the origin instance for the operation
Line 508 
Line 649 
       case PG_ELEMENTCONFORMSTOPROFILE_RP_RP:       case PG_ELEMENTCONFORMSTOPROFILE_RP_RP:
           propNames.append(CIMName("RegisteredName"));           propNames.append(CIMName("RegisteredName"));
           propertyList = CIMPropertyList(propNames);           propertyList = CIMPropertyList(propNames);
             try
             {
           tmpInstance = localGetInstance(           tmpInstance = localGetInstance(
               context,               context,
               objectName,               objectName,
               propertyList);               propertyList);
             }
             catch (CIMException &e)
             {
                 PEG_TRACE((TRC_CONTROLPROVIDER, Tracer::LEVEL2,
                     "CIMException while getting instance of Registered Profile "
                         ": %s",
                     (const char*)e.getMessage().getCString()));
             }
           if (!tmpInstance.isUninitialized())           if (!tmpInstance.isUninitialized())
           {           {
               index = tmpInstance.findProperty("RegisteredName");               index = tmpInstance.findProperty("RegisteredName");


Legend:
Removed from v.1.79  
changed lines
  Added in v.1.88.2.1

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2