(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.75 and 1.88.2.1

version 1.75, 2008/05/16 06:26:48 version 1.88.2.1, 2011/10/11 18:18:16
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 59 
Line 57 
 #include "InteropConstants.h" #include "InteropConstants.h"
  
 #include <Pegasus/Common/StatisticalData.h> #include <Pegasus/Common/StatisticalData.h>
   #include <Pegasus/Common/StringConversion.h>
   #include <Pegasus/Common/ArrayIterator.h>
  
 PEGASUS_USING_STD; PEGASUS_USING_STD;
 PEGASUS_NAMESPACE_BEGIN PEGASUS_NAMESPACE_BEGIN
Line 76 
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");
  
       ConfigManager *configManager = ConfigManager::getInstance();
   #ifdef PEGASUS_ENABLE_SLP
       enableSLP = ConfigManager::parseBooleanValue(
           configManager->getCurrentValue("slp"));
   #else
       enableSLP = false;
   #endif
   
       httpPort = configManager->getCurrentValue("httpPort");
       if (httpPort.size() == 0)
       {
           Uint32 portNumberHttp = System::lookupPort(
               WBEM_HTTP_SERVICE_NAME, WBEM_DEFAULT_HTTP_PORT);
           char buffer[32];
           Uint32 n;
           const char *output = Uint32ToString(buffer, portNumberHttp, n);
           httpPort.assign(output, n);
       }
   
       httpsPort = configManager->getCurrentValue("httpsPort");
       if (httpsPort.size() == 0)
       {
           Uint32 portNumberHttps = System::lookupPort(
               WBEM_HTTPS_SERVICE_NAME, WBEM_DEFAULT_HTTPS_PORT);
           char buffer[32];
           Uint32 n;
           const char *output = Uint32ToString(buffer, portNumberHttps, n);
           httpsPort.assign(output, n);
       }
   
   
 #ifndef PEGASUS_DISABLE_PERFINST #ifndef PEGASUS_DISABLE_PERFINST
     try     try
     {     {
Line 122 
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 143 
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 157 
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 282 
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 308 
Line 479 
         }         }
         case PG_PROVIDERPROFILECAPABILITIES:         case PG_PROVIDERPROFILECAPABILITIES:
         {         {
             instances = enumProviderProfileCapabilityInstances(false, false);              instances = enumProviderProfileCapabilityInstances(false);
             break;             break;
         }         }
  
Line 363 
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 478 
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");
Line 804 
Line 985 
 CIMInstance InteropProvider::buildInstanceSkeleton( CIMInstance InteropProvider::buildInstanceSkeleton(
       const CIMNamespaceName & nameSpace,       const CIMNamespaceName & nameSpace,
       const CIMName& className,       const CIMName& className,
         Boolean includeQualifiers,
       CIMClass& returnedClass)       CIMClass& returnedClass)
 { {
     PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,     PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,
Line 811 
Line 993 
     // get class with lo = false, qualifier = true classorig = true     // get class with lo = false, qualifier = true classorig = true
     returnedClass = repository->getClass(nameSpace,     returnedClass = repository->getClass(nameSpace,
         className, false, true, true);         className, false, true, true);
     CIMInstance skeleton = returnedClass.buildInstance(true,true,      CIMInstance skeleton = returnedClass.buildInstance(
         CIMPropertyList());          includeQualifiers, true, CIMPropertyList());
  
     PEG_METHOD_EXIT();     PEG_METHOD_EXIT();
     return skeleton;     return skeleton;


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

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2