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

version 1.5.2.10, 2004/03/03 19:27:54 version 1.88.2.1, 2011/10/11 18:18:16
Line 1 
Line 1 
 //%2003////////////////////////////////////////////////////////////////////////  //%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
 //  // Source License; you may not use this file except in compliance with the
 // Permission is hereby granted, free of charge, to any person obtaining a copy  // License.
 // of this software and associated documentation files (the "Software"), to  //
 // deal in the Software without restriction, including without limitation the  // Permission is hereby granted, free of charge, to any person obtaining a
 // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or  // copy of this software and associated documentation files (the "Software"),
 // sell copies of the Software, and to permit persons to whom the Software is  // to deal in the Software without restriction, including without limitation
 // furnished to do so, subject to the following conditions:  // the rights to use, copy, modify, merge, publish, distribute, sublicense,
 //  // and/or sell copies of the Software, and to permit persons to whom the
 // THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN  // Software is furnished to do so, subject to the following conditions:
 // ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED  //
 // "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT  // The above copyright notice and this permission notice shall be included
 // LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR  // in all copies or substantial portions of the Software.
 // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT  //
 // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN  // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
 // ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION  // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.  // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
 //  // IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
 //==============================================================================  // CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
 //  // TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
 // Author: Karl Schopmeyer (k.schopmeyer@opengroup.org)  // SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //  //
 // Modified By: Carol Ann Krug Graves, Hewlett-Packard Company  //////////////////////////////////////////////////////////////////////////
 //                (carolann_graves@hp.com)  
 //              Karl Schopmeyer - Add Cim_Namespace capabilities.  
 //              Karl Schopmeyer - Temp added objectmanager and communication classes  
 // //
 //%//////////////////////////////////////////////////////////////////////////// //%////////////////////////////////////////////////////////////////////////////
  
   
 /////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
 //  Interop Provider - This provider services those classes from the //  Interop Provider - This provider services those classes from the
 //  DMTF Interop schema association with the CIMOM itself  //  DMTF Interop schema in an implementation compliant with the SMI-S v1.1
   //  Server Profile
 // //
 //  This provider services the following classes:  //  Please see PG_ServerProfile20.mof in the directory
 //      CIMObjectManager  //  $(PEGASUS_ROOT)/Schemas/Pegasus/InterOp/VER20 for retails regarding the
 //      CIM_ObjectManagerCommunicationMechanism  //  classes supported by this control provider.
 //      CIM_CIMXMLCommunicationMechanism  //
 //      CIM_ProtocolAdapter  //  Interop forces all creates to the PEGASUS_NAMESPACENAME_INTEROP
 //      CIM_Namespace  //  namespace. There is a test on each operation that returns
 //  //  the Invalid Class CIMDError
 //      It also services the Interop associations tied to these classes  //  This is a control provider and as such uses the Tracer functions
 //      including:  //  for data and function traces.  Since we do not expect high volume
 //      CIM_NamespaceInManager  //  use we added a number of traces to help diagnostics.
 //      ...  
   
 //      CIM Version: Interop Provider was written for CIM 2.7 adn 2.8.  
 //       Note: all 2.8 functions are controlled by a flag and can be  
 //      disabled.  
 /////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
  
 /* STATUS: In process but running 12 feburary 2004 KS */  
 /* TODO: 12 Feb 2004  
     Add the association functions  
     UUID generation should become a system function since it will be used  
     by many providers, etc. as part of id generation.  
 */  
   
 #include <Pegasus/Common/Config.h> #include <Pegasus/Common/Config.h>
 #include <Pegasus/Common/PegasusVersion.h> #include <Pegasus/Common/PegasusVersion.h>
  
Line 68 
Line 53 
 #include <iostream> #include <iostream>
  
 #include "InteropProvider.h" #include "InteropProvider.h"
 #include "Guid.h"  #include "InteropProviderUtils.h"
 #include <Pegasus/Common/String.h>  #include "InteropConstants.h"
 #include <Pegasus/Common/System.h>  
 #include <Pegasus/Common/ArrayInternal.h>  
 #include <Pegasus/Common/CIMName.h>  
 #include <Pegasus/Common/CIMType.h>  
 #include <Pegasus/Common/CIMInstance.h>  
 #include <Pegasus/Common/CIMObjectPath.h>  
 #include <Pegasus/Common/InternalException.h>  
 #include <Pegasus/Common/CIMStatusCode.h>  
 #include <Pegasus/Common/Tracer.h>  
 #include <Pegasus/Common/OperationContext.h>  
 #include <Pegasus/Config/ConfigManager.h>  
 #include <Pegasus/Common/XmlWriter.h>  
 #include <Pegasus/Config/ConfigManager.h>  
   
 #include <sstream>  
 #include <string>  
   
 #include <stdlib.h>  
   
 //The following include is needed for UUID Generator  
 #if defined(PEGASUS_OS_TYPE_WINDOWS)  
 #include <objbase.h>  
 #endif  
  
 PEGASUS_USING_STD;  #include <Pegasus/Common/StatisticalData.h>
   #include <Pegasus/Common/StringConversion.h>
   #include <Pegasus/Common/ArrayIterator.h>
  
   PEGASUS_USING_STD;
 PEGASUS_NAMESPACE_BEGIN PEGASUS_NAMESPACE_BEGIN
  
 #define CDEBUG(X)  /*****************************************************************************
 //#define CDEBUG(X) PEGASUS_STD(cout) << "InteropProvider " << X << PEGASUS_STD(endl)   *
 //#define CDEBUG(X) Logger::put (Logger::DEBUG_LOG, "Linux_ProcessorProvider", Logger::INFORMATION, "$0", X)   * The following are constants representing property names for the classes
 //#define CDEBUG(X) {std::stringstream ss; std::string r;ss << X;ss>>r; PEG_TRACE_STRING(TRC_CONTROLPROVIDER, Tracer::LEVEL4, r)}   * managed by the Interop Provider. Where multiple classes have properties of
    * the same name, there will be a common CIMName object defined, and a macro
    * defined that points to the common CIMName object, but whose macro name
 //**************************************************************************   * reflects the class in which the property is used.
 //   *
 //    Constants representing the class names processed   *****************************************************************************/
 //  
 //**************************************************************************  //
   // Constructor for the InteropProvider control provider
 // The following should be moved to somewhere like constants.  //
 static const String PegasusInstanceIDGlobalPrefix = "PEG";  InteropProvider::InteropProvider(
       CIMRepository * rep,
 /**      ProviderRegistrationManager *provRegManager):
     The constants representing the class names we process          repository(rep),
 */          providerRegistrationManager(provRegManager),
 static const CIMName __NAMESPACE_CLASSNAME  = CIMName ("__Namespace");          hostName(System::getHostName()),
 static const CIMName CIM_NAMESPACE_CLASSNAME  = CIMName ("CIM_Namespace");          providerInitialized(false),
 static const CIMName CIM_OBJECTMANAGER_CLASSNAME  = CIMName ("CIM_ObjectManager");          updateProfileCache(0),
 static const CIMName CIM_OBJECTMANAGERCOMMUNICATIONMECHANISM_CLASSNAME  =          profileIds(Array<String>()),
         CIMName ("CIM_ObjectManagerCommunicationMechanism");          conformingElements(Array<CIMNameArray>()),
 //static const CIMName CIM_CIMXMLCOMMUNICATIONMECHANISM_CLASSNAME  =          elementNamespaces(Array<CIMNamespaceArray>())
 //        CIMName ("CIM_CIMXMLCommunicationMechanism");  
 static const CIMName PG_CIMXMLCOMMUNICATIONMECHANISM_CLASSNAME  =  
         CIMName ("PG_CIMXMLCommunicationMechanism");  
   
 // Property Names for __Namespace Class  
 static const CIMName NAMESPACE_PROPERTYNAME  = CIMName ("Name");  
 static const CIMNamespaceName ROOTNS  = CIMNamespaceName ("root");  
   
   
 // Property names for CIM_ObjectManager Class  
 static const CIMName OM_GATHERSTATISTICALDATA  =  
  CIMName ("GatherStatisticalData");  
 // Property for the slp template.  
 static const CIMName OM_DESCRIPTIONPROPERTY =  
     CIMName("Description");  
   
   
 // Property Names for ObjectManagerCommunicationMechanism Class  
 static const CIMName OM_COMMUNICATIONMECHANISM  =  
         CIMName ("CommunicationMechanism");  
 static const CIMName OM_FUNCTIONALPROFILESSUPPORTED  =  
  CIMName ("FunctionalProfilesSupported");  
 static const CIMName OM_FUNCTIONALPROFILEDESCRIPTIONS  =  
  CIMName ("FunctionalProfileDescriptions");  
 static const CIMName OM_AUTHENTICATIONMECHANISMSSUPPORTED  =  
  CIMName ("AuthenticationMechanismsSupported");  
 static const CIMName OM_AUTHENTICATIONMECHANISMDESCRIPTIONS  =  
  CIMName ("AuthenticationMechanismDescriptions");  
 static const CIMName OM_MULTIPLEOPERATIONSSUPPORTED  =  
  CIMName ("MultipleOperationsSupported");  
 static const CIMName OM_VERSION  =  
  CIMName ("Version");  
   
 // Property Names for CIMXML CommunicationMechanism  
   
 static const CIMName CIMVALIDATED  =  
  CIMName ("CIMValidated");  
   
 static const String CIMXMLProtocolVersion = "1.0";  
   
 // Property names for CIM_Namespace Class  
   
 static const CIMName CIM_NAMESPACE_PROPERTY_SYSTEMCREATIONCLASSNAME =  
         CIMName ("SystemCreationClassName");  
 static const CIMName CIM_NAMESPACE_PROPERTY_SYSTEMNAME =  
         CIMName ("SystemName");  
 static const CIMName CIM_NAMESPACE_PROPERTY_OBJECTMANAGERCREATIONCLASSNAME =  
         CIMName ("ObjectManagerCreationClassName");  
 static const CIMName CIM_NAMESPACE_PROPERTY_OBJECTMANAGERNAME =  
         CIMName ("ObjectManagerName");  
 static const CIMName CIM_NAMESPACE_PROPERTY_CREATIONCLASSNAME =  
         CIMName ("CreationClassName");  
 static const CIMName CIM_NAMESPACE_PROPERTY_NAME  = CIMName ("Name");  
 static const CIMName CIM_NAMESPACE_PROPERTY_CLASSINFO =  
         CIMName ("ClassInfo");  
 static const CIMName CIM_NAMESPACE_PROPERTY_DESCRIPTIONOFCLASSINFO =  
         CIMName ("DescriptionOfClassInfo");  
   
 // Defines to serve as the ENUM for class selection for instance  
 // operations.  
   
 enum targetClass{  
      __NAMESPACE = 1,  
      CIM_NAMESPACE = 2,  
      CIM_OBJECTMANAGER = 3,  
      PG_CIMXMLCOMMUNICATIONMECHANISM = 4  
      };  
   
 //***************************************************************  
 // Provider Utility Functions  
 //***************************************************************  
 /*  
 void _removeQualifiers(CIMProperty& p)  
 {  
   
     Uint32 count;  
     while((count = p.getQualifierCount()) > 0)  
         p.removeQualifier(count - 1);  
 }  
 void _removeQualifiers(CIMInstance& cimInstance)  
 {  
     // remove qualifiers of the class  
     Uint32 count;  
     while((count = cimInstance.getQualifierCount()) > 0)  
         cimInstance.removeQualifier(count - 1);  
   
     // remove qualifiers from the properties  
     for (Uint32 i = 0; i < cimInstance.getPropertyCount(); i++)  
     {  
         _removeQualifiers(cimInstance.getProperty(i));  
     }  
 }  
 */  
   
 /** get one string property from an instance.  
     @param instance CIMInstance from which we get property value  
     @param propertyName String name of the property containing the value  
     @param default String optional parameter that is substituted if the property does  
     not exist, is Null, or is not a string type. The substitute is String::EMPTY  
     @return String value found or defaultValue.  
 */  
 String _getPropertyValue(const CIMInstance& instance, const CIMName& propertyName, const String& defaultValue = String::EMPTY)  
 {  
     String output;  
     Uint32 pos;  
     if ((pos = instance.findProperty(propertyName)) != PEG_NOT_FOUND)  
     {  
         CIMConstProperty p1 = instance.getProperty(pos);  
         if (p1.getType() == CIMTYPE_STRING)  
         {  
             CIMValue v1  = p1.getValue();  
   
             if (!v1.isNull())  
                 v1.get(output);  
             else  
                 output = defaultValue;  
         }  
         else  
             output = defaultValue;  
     }  
     else  
         output = defaultValue;  
     return(output);  
 }  
 /** get Host IP address from host name. If the  
     host name is not provided, uses internal function.  
     If everything fails, gets the definition normally  
     used for localhost (127.0.0.1).  
   
     @param hostName String with the name of the host  
     @return String with the IP address to be used  
     NOTE: This code should not be in slpprovider. This  
     should be in the Interop classes but for the moment  
     it is not.  
 */  
 String _getHostAddress(String hostName)  
 { {
   // set default address      PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,"InteropProvider::InteropProvider");
   String ipAddress("127.0.0.1");  
   
   if (hostName == String::EMPTY)  
         hostName = System::getHostName();  
  
   struct hostent * phostent;      ConfigManager *configManager = ConfigManager::getInstance();
   struct in_addr   inaddr;  #ifdef PEGASUS_ENABLE_SLP
       enableSLP = ConfigManager::parseBooleanValue(
           configManager->getCurrentValue("slp"));
   #else
       enableSLP = false;
   #endif
  
   if ((phostent = ::gethostbyname((const char *)hostName.getCString())) != NULL)      httpPort = configManager->getCurrentValue("httpPort");
       if (httpPort.size() == 0)
     {     {
       ::memcpy( &inaddr, phostent->h_addr,4);          Uint32 portNumberHttp = System::lookupPort(
       ipAddress = ::inet_ntoa( inaddr );              WBEM_HTTP_SERVICE_NAME, WBEM_DEFAULT_HTTP_PORT);
     }          char buffer[32];
   return ipAddress;          Uint32 n;
           const char *output = Uint32ToString(buffer, portNumberHttp, n);
           httpPort.assign(output, n);
 } }
  
  Array<String> _getFunctionalProfiles(Array<Uint16> profiles)      httpsPort = configManager->getCurrentValue("httpsPort");
       if (httpsPort.size() == 0)
  {  {
      Array<String> profileDescriptions;          Uint32 portNumberHttps = System::lookupPort(
      profiles.append(2); profileDescriptions.append("Basic Read");              WBEM_HTTPS_SERVICE_NAME, WBEM_DEFAULT_HTTPS_PORT);
      profiles.append(3); profileDescriptions.append("Basic Write");          char buffer[32];
      profiles.append(4); profileDescriptions.append("Schema Manipulation");          Uint32 n;
      profiles.append(5); profileDescriptions.append("Instance Manipulation");          const char *output = Uint32ToString(buffer, portNumberHttps, n);
      profiles.append(6); profileDescriptions.append("Association Traversal");          httpsPort.assign(output, n);
      profiles.append(8); profileDescriptions.append("Qualifier Declaration");  
      profiles.append(9); profileDescriptions.append("Indications");  
      return(profileDescriptions);  
  }  }
  
 /*  get the prefix that will be part of the cimom identification  
     This can be either the default PEG or if the environment  
     variable PEGASUS_TRADEMARK_PREFIX is defined this is used.  
     NOTE: getting from the environment variable is a hack until  
     we can come up with a better source.  
     @return String containing the unique name for the CIMOM ID  
 */  
  
 String getTrademarkCIMOMIDPrefix()  #ifndef PEGASUS_DISABLE_PERFINST
       try
 { {
           initProvider();
     char * trademark;  
     trademark = getenv("PEGASUS_TRADEMARK_PREFIX");  
     return((trademark)? trademark : PegasusInstanceIDGlobalPrefix);  
 } }
 /** Builds the UUID string for this CIMOM.      catch(const Exception &)
 **/  
 String getUUIDString()  
 { {
     return(Guid::getGuid());          // Provider initialization may fail if the repository is not
           // populated
 } }
   #endif
  
 /* Test the keys in the CIM_Namespace for valid values      PEG_METHOD_EXIT();
    This includes all of the keys above the name key.  
    THis is a dummy for now.  
    ATTN: KS Extend and finish this function.  
 */  
 Boolean _validateProperties(const CIMObjectPath& path)  
 {  
     return true;  
 }  
 Boolean _validateProperties(const CIMInstance& instance)  
 {  
     return true;  
 } }
  
 /* validate that the property exists, is string type and  
    optionally the value itself. Note processes only String  
    properties  
    @param - Instance to search for property.  
    @param - Property Name  
    @value - String value. If not String::EMPTY, compare to  
    value in the property  
    @return - ture if passes all tests  
 */  
 Boolean _validateRequiredProperty(const CIMInstance& instance,  
                           const CIMName& propertyName,  
                           const String& value)  
 {  
     PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,  
             "InteropProvider::_validateRequiredProperty()");  
     Uint32 pos;  
     if ((pos = instance.findProperty (propertyName)) == PEG_NOT_FOUND)  
         return(false);  
     //  
     //  Get the property  
     //  
     CIMConstProperty theProperty = instance.getProperty(pos);  
     const CIMValue theValue = theProperty.getValue ();  
     String valueField;  
     theValue.get(valueField);  
     //     //
     //  Required property must have a non-null value  // Local version of getInstance to be used by other functions in the the
   // provider. Returns a single instance. Note that it always returns an
   // instance. If none was found, it is uninialitized.
     //     //
     if ((theValue.getType() != CIMTYPE_STRING) || (theValue.isNull()))  CIMInstance InteropProvider::localGetInstance(
       const OperationContext & context,
       const CIMObjectPath & instanceName,
       const CIMPropertyList & propertyList)
     {     {
         PEG_METHOD_EXIT();      PEG_METHOD_ENTER(TRC_CONTROLPROVIDER, "InteropProvider::localGetInstance");
         return(false);  
     }      PEG_TRACE((TRC_CONTROLPROVIDER, Tracer::LEVEL4,
     if ((value == String::EMPTY) || (valueField == value))          "%s getInstance. instanceName= %s , PropertyList= %s",
           thisProvider,
           (const char *)instanceName.toString().getCString(),
           (const char *)propertyListToString(propertyList).getCString()));
   
       // 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 = instanceName.getNameSpace();
       CIMName opClass = instanceName.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,
                                            instanceName,
                                            false,
                                            false,
                                            false,
                                            propertyList);
         PEG_METHOD_EXIT();         PEG_METHOD_EXIT();
         return(true);          return gotInstance;
     }  
     PEG_METHOD_EXIT();  
     return(false);  
 } }
  
 Boolean _validateRequiredProperty(const CIMInstance& instance,      TARGET_CLASS classEnum  = translateClassInput(opClass);
                           const CIMName& propertyName,      CIMInstance retInstance;
                           const Uint16& value)      switch(classEnum)
 {      {
     PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,          case PG_SOFTWAREIDENTITY:
         "InteropProvider::_validateRequiredProperty()");          {
               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
               // instance name
               CIMObjectPath ref;
               ref.setHost(instanceName.getHost());
               ref.setClassName(opClass);
               ref.setNameSpace(opNamespace);
   
               // Enumerate instances for this class. Returns all instances
               // Note that this returns paths setup and instances already
               // filtered per the input criteria.
               Array<CIMInstance> instances =  localEnumerateInstances(
                   context,
                   ref,
                   propertyList);
               ConstArrayIterator<CIMInstance> instancesIter(instances);
  
     PEG_TRACE_STRING(TRC_CONTROLPROVIDER, Tracer::LEVEL4, "Validate "              // deliver a single instance if found.
         + propertyName.getString());              bool found = false;
     Uint32 pos;              for(Uint32 i = 0; i < instancesIter.size(); i++)
     if ((pos = instance.findProperty (propertyName)) == PEG_NOT_FOUND)  
     {     {
         PEG_METHOD_EXIT();                  CIMObjectPath currentInstRef = instancesIter[i].getPath();
         return(false);                  currentInstRef.setHost(instanceName.getHost());
     }                  currentInstRef.setNameSpace(instanceName.getNameSpace());
     //                  if(instanceName == currentInstRef)
     //  Get the property  
     //  
     CIMConstProperty theProperty = instance.getProperty(pos);  
     CIMValue theValue = theProperty.getValue ();  
     //  
     //  Required property must have a non-null value  
     //  
     if ((theValue.getType() != CIMTYPE_UINT16)  
         || (theValue.isNull())  )  
     {     {
         PEG_METHOD_EXIT();                      retInstance = instancesIter[i];
         return(false);                      found = true;
                       break;
     }     }
               }
   
     PEG_METHOD_EXIT();     PEG_METHOD_EXIT();
     return(true);              if (!found)
               {
                   throw CIMObjectNotFoundException(instanceName.toString());
               }
           }
 } }
 Boolean _validateRequiredProperty(const CIMObjectPath& objectPath,  
                           const CIMName& propertyName,      return retInstance;
                           const String value)  }
   
   Array<CIMInstance> InteropProvider::getReferencedInstances(
       const Array<CIMInstance> &refs,
       const String targetRole,
       const OperationContext & context,
       const CIMPropertyList & propertyList)
 { {
     PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,     PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,
             "InteropProvider::_validateRequiedProperty()");          "InteropProvider::getReferencedObjects");
     Array<CIMKeyBinding> kbArray = objectPath.getKeyBindings();  
  
     // find the correct key binding      Array<CIMInstance> referencedInstances;
     for (Uint32 i = 0; i < kbArray.size(); i++)      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
               )
     {     {
         if (kbArray[i].getName() == propertyName)              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++)
         {         {
             if (value != String::EMPTY)                          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 (value !=kbArray[i].getValue())                      if(thisTarget == instsConstIter[j].getPath())
                 {                 {
                     PEG_METHOD_EXIT();                          referencedInstances.append(instsConstIter[j]);
                     return(true);                          break;
                 }                 }
             }             }
         }         }
               break;
     }     }
     PEG_METHOD_EXIT();  
     return(true);  
 } }
   
 /* Query the repository for array of all namespacenames  
    @return Array<CIMNamespaceName> with all namespaces  
    @exception Passes all exception that repository may generate.  
 */  
 Array<CIMNamespaceName> InteropProvider::_enumerateNameSpaces()  
 {  
     PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,  
             "InteropProvider::_enumerateNameSpaces()");  
     Array<CIMNamespaceName> namespaceNames;  
   
     namespaceNames = _repository->enumerateNameSpaces();  
   
     PEG_METHOD_EXIT();     PEG_METHOD_EXIT();
     return(namespaceNames);      return referencedInstances;
 } }
  
 /* get a class defintion. Gets the class defined by  //
     the parameters. Generates exception of class not defined.  // Local version of enumerateInstances to be used by other functions in the
    @param namespace in which to look for the class.  // provider. Note that this delivers instances as a group rather than one
    @param name of class to get.  // at a time. This design point may need to be revisited if this provider
    @return the CIMClass object  // is used in environments such that returning segmented responses would have
    @Exceptions any repository exceptions if class not found.  // significant performance advantages. For now, that doesn't seem to be the
 */  // case.
 CIMClass InteropProvider::_getClass(const CIMNamespaceName& nameSpace,  //
                                     const CIMName& className)  Array<CIMInstance> InteropProvider::localEnumerateInstances(
       const OperationContext & context,
       const CIMObjectPath & ref,
       const CIMPropertyList& propertyList)
 { {
     PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,     PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,
             "InteropProvider::_getClass");          "InteropProvider::localEnumerateInstances()");
       const CIMName & className = ref.getClassName();
     CIMClass myClass = _repository->getClass(nameSpace, className );      PEG_TRACE((TRC_CONTROLPROVIDER, Tracer::LEVEL4,
     PEG_METHOD_EXIT();          "%s enumerateInstances. referenc= %s , PropertyList= %s",
     return myClass;          thisProvider,
 }          (const char *)className.getString().getCString(),
           (const char *)propertyListToString(propertyList).getCString()));
 /* Verify that this is one of the legal classnames and  
    return indicator which.  
    @param - Classname  
    @return - Uint32 indicating type  
    @Exceptions - throws CIMNotSupportedException if invalid class.  
 */  
 targetClass _verifyValidClassInput(const CIMName& className)  
 {  
     if (className.equal(CIM_OBJECTMANAGER_CLASSNAME))  
         return CIM_OBJECTMANAGER;  
  
     if (className.equal(PG_CIMXMLCOMMUNICATIONMECHANISM_CLASSNAME))      // Verify that ClassName is correct and get its enum value
         return PG_CIMXMLCOMMUNICATIONMECHANISM;      TARGET_CLASS classEnum  = translateClassInput(className);
  
     // Last entry, reverse test and return OK if CIM_Namespace      Array<CIMInstance> instances;
     if (!className.equal(CIM_NAMESPACE_CLASSNAME))      switch(classEnum)
         throw CIMNotSupportedException  
             (className.getString() + " not supported by Interop Provider");  
   
     return CIM_NAMESPACE;  
 }  
   
 /* validate the authorization of the user name against the namespace.  
 */  
 String _validateUserID(const OperationContext & context)  
 { {
     //ATTN-DME-P3-20020522: ADD AUTHORIZATION CHECK TO __NAMESPACE PROVIDER          case PG_OBJECTMANAGER:
     String userName;  
     try  
     {     {
         IdentityContainer container = context.get(IdentityContainer::NAME);              instances.append(getObjectManagerInstance());
         userName = container.getUserName();              break;
     }     }
     catch (...)          case PG_CIMXMLCOMMUNICATIONMECHANISM:
     {     {
        userName = String::EMPTY;              instances = enumCIMXMLCommunicationMechanismInstances();
               break;
     }     }
     return userName;          case PG_NAMESPACEINMANAGER:
 }  
   
 /** set the value of a property defined by property name in the instance provided.  
     Sets a String into the value field unless the property name cannot be found.  
     If the property cannot be found, it simply returns.  
     ATTN: This function does not pass an error back if property not found.  
     @param instance CIMInstance in which to set property value  
     @param propertyName CIMName of property in which value will be set.  
     @param value String value to set into property  
   
 */  
 void _setPropertyValue(CIMInstance& instance, const CIMName propertyName, const String& value)  
 { {
     Uint32 pos;              instances = enumNamespaceInManagerInstances();
     if ((pos = instance.findProperty(propertyName)) != PEG_NOT_FOUND)              break;
         instance.getProperty(pos).setValue(CIMValue(value));  
 } }
           case PG_COMMMECHANISMFORMANAGER:
 void _setPropertyValue(CIMInstance& instance, const CIMName propertyName, const Boolean& value)  
 { {
     Uint32 pos;              instances = enumCommMechanismForManagerInstances();
     if ((pos = instance.findProperty(propertyName)) != PEG_NOT_FOUND)              break;
         instance.getProperty(pos).setValue(CIMValue(value));  
 } }
           case PG_NAMESPACE:
 void _setPropertyValue(CIMInstance& instance, const CIMName propertyName, const Uint16& value)  
 { {
     Uint32 pos;              instances = enumNamespaceInstances();
     if ((pos = instance.findProperty(propertyName)) != PEG_NOT_FOUND)              break;
         instance.getProperty(pos).setValue(CIMValue(value));  
 } }
           case PG_REGISTEREDPROFILE:
 void _setPropertyValue(CIMInstance& instance, const CIMName propertyName, const Array<String> value)  
 { {
     Uint32 pos;              instances = enumRegisteredProfileInstances();
     if ((pos = instance.findProperty(propertyName)) != PEG_NOT_FOUND)              break;
         instance.getProperty(pos).setValue(CIMValue(value));  
 } }
           case PG_REGISTEREDSUBPROFILE:
 void _setPropertyValue(CIMInstance& instance, const CIMName propertyName, const Array<Uint16> value)  
 { {
     Uint32 pos;              instances = enumRegisteredSubProfileInstances();
     if ((pos = instance.findProperty(propertyName)) != PEG_NOT_FOUND)              break;
         instance.getProperty(pos).setValue(CIMValue(value));  
 } }
 /** add the correct values to the common keys defined for all of the classes. This is          case PG_REFERENCEDPROFILE:
     systemcreationclassname and systemname  
     Note that if the properties do not exist, we simply ignore them.  
 */  
 void _fixInstanceCommonKeys(CIMInstance& instance)  
 { {
     PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,              instances = enumReferencedProfileInstances();
             "InteropProvider::_fixInstanceCommonKeys()");              break;
     String SystemCreationClassName = System::getSystemCreationClassName ();          }
     if (SystemCreationClassName == String::EMPTY)          case PG_ELEMENTCONFORMSTOPROFILE:
     {     {
         //Attn: Get this globally. For now This in place because global is often Empty              instances = enumElementConformsToProfileInstances(context,
         SystemCreationClassName = "CIM_ComputerSystem";                  ref.getNameSpace());
               break;
     }     }
           case PG_ELEMENTCONFORMSTOPROFILE_RP_RP:
     _setPropertyValue(instance, CIM_NAMESPACE_PROPERTY_SYSTEMCREATIONCLASSNAME,SystemCreationClassName);          {
               instances = enumElementConformsToProfileRPRPInstances(
     // Add property SystemName                  context,
                   ref.getNameSpace());
     _setPropertyValue(instance, CIM_NAMESPACE_PROPERTY_SYSTEMNAME,System::getHostName());              break;
     PEG_METHOD_EXIT();  
 } }
           case PG_SUBPROFILEREQUIRESPROFILE:
   
 /** builds one instance of the CIM_ObjectManager class filling in the  
     correct properties from the className.  This required a repository  
     getclass request for each instance built. The skeleton is built by  
     creating the instance and copying qualifiers and properties from  
     the class. Finally the instance is cloned to separate it from the  
     original objects.  
     NOTE: This is very inefficient for anything larger than a few instances.  
     We should separate the get from the createSkeleton.  
     @param className CIMName of the class for which the instance is to be built  
     @return CIMInstance of this class with properties complete.  
     @exception passes on any exceptions received from the repository request.  
 */  
 CIMInstance InteropProvider::_buildInstanceSkeleton(const CIMName& className)  
 { {
     CIMClass myClass;              instances = enumSubProfileRequiresProfileInstances();
     PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,              break;
             "InteropProvider::_buildInstanceSkeleton()");  
   
     CIMInstance skeleton(className);  
         myClass = _repository->getClass(_operationNamespace, className, false, true, true);  
   
     // copy the qualifiers  
     for (Uint32 i = 0 ; i < myClass.getQualifierCount() ; i++)  
         skeleton.addQualifier(myClass.getQualifier(i));  
   
     // copy the properties  
     for (Uint32 i = 0 ; i < myClass.getPropertyCount() ; i++)  
         skeleton.addProperty(myClass.getProperty(i));  
   
     PEG_METHOD_EXIT();  
     return(skeleton.clone());  
 } }
           case PG_SOFTWAREIDENTITY:
   
 /* build a single instance of the cimxmlcommunicationmechanism class  
    using the parameter provided as the name property  
    @parm name String representing the name to be used for this object.  
    @return CIMInstance of the class  
 */  
 CIMInstance InteropProvider::_buildInstancePGCIMXMLCommunicationMechanism(  
                                             const String& namespaceType,  
                                             const String& IPAddress,  
                                             const Boolean& includeQualifiers,  
                                             const Boolean& includeClassOrigin,  
                                             const CIMPropertyList& propertyList)  
 { {
     PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,              instances = enumSoftwareIdentityInstances();
             "InteropProvider::_buildInstancePGCIMXMLCommunicationMechanism()");              break;
   
     CIMInstance instance = _buildInstanceSkeleton(PG_CIMXMLCOMMUNICATIONMECHANISM_CLASSNAME);  
   
     _fixInstanceCommonKeys(instance);  
   
     //CreationClassName  
     _setPropertyValue(instance, CIM_NAMESPACE_PROPERTY_CREATIONCLASSNAME,PG_CIMXMLCOMMUNICATIONMECHANISM_CLASSNAME.getString());  
   
     //Name, this CommunicationMechanism.  
     _setPropertyValue(instance, CIM_NAMESPACE_PROPERTY_NAME, PG_CIMXMLCOMMUNICATIONMECHANISM_CLASSNAME.getString());  
   
     // CommunicationMechanism Property  
     _setPropertyValue(instance, OM_COMMUNICATIONMECHANISM, Uint16(2));  
   
     //Functional Profiles Supported Property.  
     Array<Uint16> profiles;  
     Array<String> profileDescriptions = _getFunctionalProfiles(profiles);  
   
     // Set functional profiles in instance  
     _setPropertyValue(instance, OM_FUNCTIONALPROFILESSUPPORTED, profiles);  
   
     _setPropertyValue(instance, OM_FUNCTIONALPROFILEDESCRIPTIONS, profileDescriptions);  
   
     // Multiple OperationsSupported Property  
     _setPropertyValue(instance, OM_MULTIPLEOPERATIONSSUPPORTED, false);  
   
     // AuthenticationMechanismsSupported Property  
     Array<Uint16> authentications;  
     Array<String> authenticationDescriptions;  
   
     authentications.append(3); authenticationDescriptions.append("basic");  
   
     _setPropertyValue(instance, OM_AUTHENTICATIONMECHANISMSSUPPORTED, authentications);  
   
     _setPropertyValue(instance, OM_AUTHENTICATIONMECHANISMDESCRIPTIONS, authenticationDescriptions);  
   
     _setPropertyValue(instance, OM_VERSION, CIMXMLProtocolVersion);  
   
     _setPropertyValue(instance, "namespaceType", namespaceType);  
   
     _setPropertyValue(instance, "IPAddress", IPAddress);  
   
     PEG_METHOD_EXIT();  
     return(instance);  
 } }
           case PG_ELEMENTSOFTWAREIDENTITY:
 Array<CIMInstance> InteropProvider::_buildInstancesPGCIMXMLCommunicationMechanism(  
                                             const Boolean includeQualifiers,  
                                             const Boolean includeClassOrigin,  
                                             const CIMPropertyList& propertyList)  
 { {
     // This is a temporary hack to get the multiple connections.              instances = enumElementSoftwareIdentityInstances();
     ConfigManager* configManager = ConfigManager::getInstance();              break;
     Boolean enableHttpConnection = String::equal(          }
         configManager->getCurrentValue("enableHttpConnection"), "true");          case PG_INSTALLEDSOFTWAREIDENTITY:
     Boolean enableHttpsConnection = String::equal(  
         configManager->getCurrentValue("enableHttpsConnection"), "true");  
   
     String IPAddress = _getHostAddress(System::getHostName());  
     Array<CIMInstance> instances;  
   
     if (enableHttpConnection)  
     {     {
         CDEBUG("building pgcimxmlinstances 1");              instances = enumInstalledSoftwareIdentityInstances(context);
         CIMInstance instance = _buildInstancePGCIMXMLCommunicationMechanism(              break;
                             "http", IPAddress,  
                             includeQualifiers,  
                             includeClassOrigin,  
                             propertyList);  
         instances.append(instance);  
     }     }
           case PG_COMPUTERSYSTEM:
     if (enableHttpsConnection)  
     {     {
         CDEBUG("building pgcimxmlinstances 2");              instances.append(getComputerSystemInstance(context));
         CIMInstance instance = _buildInstancePGCIMXMLCommunicationMechanism(              break;
                                                 "https", IPAddress,  
                                                 includeQualifiers,  
                                                 includeClassOrigin,  
                                                 propertyList);  
         instances.append(instance);  
     }     }
     return(instances);          case PG_HOSTEDOBJECTMANAGER:
           {
               instances.append(getHostedObjectManagerInstance(context));
               break;
 } }
 /*  Gets the value for the CIMObjectManager name.  This is a key          case PG_HOSTEDACCESSPOINT:
     property with the following characteristics.  
     1. It is persistent. This must be persistent through CIMOM  
     restarts.  We will save it in the instance database to achieve this.  
     2. It must be unique. We cannot create duplicate CIMOM names  
     3. It is based on the DMTF description of how unique InstanceIds  
     are defined (Trademark/etc followed by unique identification.  
     Use the Global constant PegasusInstanceIDGlobalPrefix as the  
     prefix allowing this to be changed.  
 */  
 String buildObjectManagerName()  
 {  
     return(getTrademarkCIMOMIDPrefix() + ":" + getUUIDString());  
 }  
   
 /** build an instance of the CIM_ObjectManager class filling out  
     the required properties  
     @param includeQualifiers Boolean  
     @param includeClassOrigin Boolean  
     @param propertylist CIMPropertyList  
     @return CIMInstance with a single built instance of the class  
     @exception repository instances if exception to enumerateInstances  
         for this class.  
 */  
   
 CIMInstance InteropProvider::_buildInstanceCIMObjectManager(  
                         const Boolean includeQualifiers,  
                         const Boolean includeClassOrigin,  
                         const CIMPropertyList& propertyList)  
 { {
     PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,              instances = enumHostedAccessPointInstances(context);
             "InteropProvider::_buildInstanceCIMObjectManager()");              break;
           }
     // If there is already an instance of this class, use it locally use it.          //We don't support enumerate CIM_Namespace instances. PG_Namespace is
     if (!instanceOfCIMObjectManager.isUninitialized())          //supported.
           case CIM_NAMESPACE:
     {     {
         PEG_METHOD_EXIT();              break;
         return(instanceOfCIMObjectManager);  
     }     }
           case PG_PROVIDERPROFILECAPABILITIES:
     // Try to get persistent instance from repository  
     Array<CIMInstance> instances;  
     instances = _repository->enumerateInstances(_operationNamespace,  
                   CIM_OBJECTMANAGER_CLASSNAME, true, false, includeQualifiers,  
                     includeClassOrigin, propertyList);  
   
     // ATTN: KS How do we really account for multiple instances of  
     // this class and determine which one is really us.  
     if (instances.size() >= 1)  
     {     {
         instanceOfCIMObjectManager = instances[0];              instances = enumProviderProfileCapabilityInstances(false);
         PEG_METHOD_EXIT();              break;
         return(instanceOfCIMObjectManager);  
     }     }
  
     //  #ifdef PEGASUS_ENABLE_DMTF_INDICATION_PROFILE_SUPPORT
     // Repository empty. Must build new instance and save it.          case PG_ELEMENTCAPABILITIES:
     //  
     CIMInstance instance = _buildInstanceSkeleton(CIM_OBJECTMANAGER_CLASSNAME);  
   
     _fixInstanceCommonKeys(instance);  
     instanceOfCIMObjectManager = instance;  
   
     _setPropertyValue(instance, CIM_NAMESPACE_PROPERTY_CREATIONCLASSNAME,CIM_OBJECTMANAGER_CLASSNAME.getString());  
   
     _setPropertyValue(instance, CIM_NAMESPACE_PROPERTY_NAME,buildObjectManagerName());  
   
     _setPropertyValue(instance, CIMName("ElementName"), String("Pegasus"));  
   
     //Description property this object manager instance  
     // default is Pegasus CIM_Server Version  
     String description;  
     char * envDescription;  
     envDescription = getenv("PEGASUS_CIMOM_DESCRIPTION");  
   
     if (envDescription)  
         description = envDescription;  
     else  
         description = "Pegasus " + String(PEGASUS_NAME) + "Version " + String(PEGASUS_VERSION);  
   
     _setPropertyValue(instance, CIMName("Description"), description);  
   
     //Property GatherStatisticalData. Note that today we do not  
     // have a dynamic activation for this value.  
   
 #ifdef PEGASUS_HAS_PERFINST  
     Boolean gatherStatData = true;  
 #else  
     Boolean gatherStatData = false;  
 #endif  
   
     _setPropertyValue(instance, OM_GATHERSTATISTICALDATA, Boolean(gatherStatData));  
   
     // write the instance to the repository  
     CIMObjectPath instancepath;  
     try  
     {     {
         instancepath = _repository->createInstance(_operationNamespace,              instances = enumElementCapabilityInstances(context);
                        instanceOfCIMObjectManager );              break;
     }     }
     catch(CIMException& e)          case PG_HOSTEDINDICATIONSERVICE:
     {     {
         // ATTN: KS generate log error if this not possible              instances = enumHostedIndicationServiceInstances(context);
         PEG_METHOD_EXIT();              break;
         throw e;  
     }     }
     catch(Exception& e)          case PG_SERVICEAFFECTSELEMENT:
     {     {
     PEG_METHOD_EXIT();              instances = enumServiceAffectsElementInstances(context);
         throw e;              break;
     }     }
   #endif
           default:
     PEG_METHOD_EXIT();     PEG_METHOD_EXIT();
     return(instanceOfCIMObjectManager);              throw CIMNotSupportedException(className.getString() +
                 " not supported by Interop Provider enumerate");
 } }
  
 /** Get the instances of CIM_Namespace      // Filter and deliver the resulting instances
     ATTN: KS For the moment we build them.  We really want to get them from the repository and      for (Uint32 i = 0 ; i < instances.size() ; i++)
     compare with the existing namespaces.  
 */  
 Array<CIMInstance> InteropProvider::_getInstancesCIMNamespace(const Boolean& includeQualifiers,  
                             const Boolean& includeClassOrigin,  
                             const CIMPropertyList& propertyList)  
 {  
     PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,  
             "InteropProvider::_getInstancesCIMNamespace()");  
     CDEBUG("_getinstancesCIMNamespace");  
     Array<CIMNamespaceName> namespaceNames = _enumerateNameSpaces();  
   
     Array<CIMInstance> instanceArray;  
   
     for (Uint32 i = 0; i < namespaceNames.size(); i++)  
     {     {
        instanceArray.append( _buildInstanceCIMNamespace(namespaceNames[i]));          normalizeInstance(instances[i], ref, false,
               false, propertyList);
     }     }
   
     PEG_METHOD_EXIT();     PEG_METHOD_EXIT();
     return(instanceArray);      return instances;
 } }
  
 /** get the instance of namespace defined by the input parameter which is the object path  //
     for the instance required.  // Class that determines whether or not the origin class in an association
     ATTN: Note that this is incorrect. We are supplying the namespace name and need to supply  // operation is valid for the given association class, and also determines
     the objectpath  // the origin and target "roles". These values generally correspond to the
     @param TBD  // role and resultRole parameter of an associators/associatorNames operation.
     @return CIMInstance with the found instance or CIMInstance() if nothing found.  //
 */  bool InteropProvider::validAssocClassForObject(
 CIMInstance InteropProvider::_getInstanceCIMNamespace(const CIMNamespaceName & nameSpace)      const OperationContext & context,
       const CIMName & assocClass,
       const CIMObjectPath & objectName,
       const CIMNamespaceName & opNamespace,
       String & originProperty,
       String & targetProperty)
 { {
     PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,     PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,
             "InteropProvider::_getInstancesCIMNamespace()");          "InteropProvider::validAssocClassForObject()");
       TARGET_CLASS assocClassEnum = translateClassInput(assocClass);
     CDEBUG("_getinstanceCIMNamespace Gets ONE only from Namespace=" << nameSpace.getString());      TARGET_CLASS originClassEnum = NOCLASS;
     Array<CIMInstance> instances = _getInstancesCIMNamespace(true, true, CIMPropertyList());      CIMName originClass = objectName.getClassName();
       // If the association class is PG_ElementConformsToProfile, we'll have to
       // do some special processing in case the origin instance for the operation
       // is managed by another provider.
       if(assocClassEnum == PG_ELEMENTCONFORMSTOPROFILE)
       {
           // Test if the origin is an element managed by another provider
           // that has implemented a registered profile.
           if(opNamespace != PEGASUS_NAMESPACENAME_INTEROP ||
               (originClass != PEGASUS_CLASSNAME_PG_REGISTEREDPROFILE &&
                originClass != PEGASUS_CLASSNAME_PG_OBJECTMANAGER ))
           {
               //
               // Search the cached conformingElements list for the originClass,
               // returning false if it is not found
               //
               bool found = false;
  
     for (Uint32 i = 0 ; i < instances.size() ; i++)              PEGASUS_ASSERT(conformingElements.size() ==
                   elementNamespaces.size());
               for(Uint32 i = 0, n = conformingElements.size(); i < n; ++i)
     {     {
         if (_getPropertyValue(instances[i], CIMName("name")) == nameSpace.getString())                  CIMNameArray & elementList = conformingElements[i];
                   CIMNamespaceArray & namespaceList = elementNamespaces[i];
                   PEGASUS_ASSERT(elementList.size() == namespaceList.size());
                   for(Uint32 j = 0, m = elementList.size(); j < m; ++j)
         {         {
             PEG_METHOD_EXIT();                      CIMName & curElement = elementList[j];
             return(instances[i]);                      if((curElement == originClass ||
                         curElement.getString().find(PEGASUS_DYNAMIC) == 0) &&
                         opNamespace == namespaceList[j])
                       {
                           found = true;
                           break;
         }         }
     }     }
     PEG_METHOD_EXIT();                  if(found)
     CIMInstance nullInstance;                      break;
     return(nullInstance);  
 } }
  
 /* generate one instance of the CIM_Namespace class with the              if(!found)
    properties  
    @param namespace name to put into the class  
    @exceptions - exceptions carried forward from create instance  
    and addProperty.  
 */  
 CIMInstance InteropProvider::_buildInstanceCIMNamespace(const CIMNamespaceName & nameSpace)  
 { {
     PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,  
             "InteropProvider::_buildInstanceCIMNamespace()");  
   
     // ATTN: KS need to get the real objectManager name from elsewhere.  the only place  
     // this exists is through the objectmanager object.  
     // ATTN: Should we be saving the objectmanager name somewhere internally either in  
     // interop or more generally somewhere within the system for common access.  
     String ObjectManagerName = "ObjectManagerNameValue";  
   
     CIMInstance instance = _buildInstanceSkeleton(CIM_NAMESPACE_CLASSNAME);  
   
     _fixInstanceCommonKeys(instance);  
   
     //ObjectManagerCreationClassName  
     _setPropertyValue(instance, CIM_NAMESPACE_PROPERTY_OBJECTMANAGERCREATIONCLASSNAME, CIM_OBJECTMANAGER_CLASSNAME.getString());  
   
     //ObjectManagerName  
     _setPropertyValue(instance, CIM_NAMESPACE_PROPERTY_OBJECTMANAGERNAME, ObjectManagerName);  
   
     //CreationClassName  
     // Class in which this was created,  
     _setPropertyValue(instance, CIM_NAMESPACE_PROPERTY_CREATIONCLASSNAME, CIM_NAMESPACE_CLASSNAME.getString());  
     //Name  
     // This is the namespace name itself  
     _setPropertyValue(instance, CIM_NAMESPACE_PROPERTY_NAME, nameSpace.getString());  
   
     //ClassInfo  
     // Set the classinfo to unknown and the description to namespace.  
     _setPropertyValue(instance, CIM_NAMESPACE_PROPERTY_CLASSINFO, Uint16(0));  
     _setPropertyValue(instance, CIM_NAMESPACE_PROPERTY_DESCRIPTIONOFCLASSINFO, String("namespace"));  
   
     PEG_METHOD_EXIT();     PEG_METHOD_EXIT();
     return(instance);                  return false;
 } }
 void _validateCIMNamespaceKeys(const CIMObjectPath& objectPath)  
 {  
     PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,  
             "InteropProvider::_validateCIMNamespaceKeys");  
   
     Boolean valid = true;  
     CIMName propertyName;  
     if (!_validateRequiredProperty(objectPath,  
                 CIM_NAMESPACE_PROPERTY_SYSTEMCREATIONCLASSNAME,  
                 System::getSystemCreationClassName ()))  
     {  
         propertyName = CIM_NAMESPACE_PROPERTY_SYSTEMCREATIONCLASSNAME;  
         valid = false;  
     }     }
     if (!_validateRequiredProperty(objectPath,  
                 CIM_NAMESPACE_PROPERTY_SYSTEMNAME,  
                 System::getHostName()))  
     {  
         propertyName = CIM_NAMESPACE_PROPERTY_SYSTEMNAME;  
         valid = false;  
     }     }
     if (!_validateRequiredProperty(objectPath,      else
                 CIM_NAMESPACE_PROPERTY_OBJECTMANAGERCREATIONCLASSNAME,  
                 CIM_OBJECTMANAGER_CLASSNAME.getString()))  
     {     {
         propertyName = CIM_NAMESPACE_PROPERTY_OBJECTMANAGERCREATIONCLASSNAME;          // Otherwise, just get the enum value representing the origin class
         valid = false;          // for this operation
           originClassEnum = translateClassInput(originClass);
     }     }
  
     // ATTN: This one still a problem.  We have to get the name first      CIMName expectedTargetRole;
     if (!_validateRequiredProperty(objectPath,      CIMName expectedOriginRole;
                 CIM_NAMESPACE_PROPERTY_OBJECTMANAGERNAME,  
                 String::EMPTY))      Array<CIMName> propNames;
       String profileName;
       CIMPropertyList propertyList;
       CIMInstance tmpInstance;
       Uint32 index;
       propNames.clear();
   
       //
       // Set the target and origin role values. Note that if these values are
       // not set following the switch block, that implies that the origin class
       // is not valid for the supplied association class.
       //
       switch(assocClassEnum)
       {
         case PG_NAMESPACEINMANAGER:
             if(originClassEnum == PG_OBJECTMANAGER)
     {     {
         propertyName = CIM_NAMESPACE_PROPERTY_OBJECTMANAGERNAME;                expectedTargetRole = PROPERTY_DEPENDENT;
         valid = false;                expectedOriginRole = PROPERTY_ANTECEDENT;
     }     }
     if (!_validateRequiredProperty(objectPath,            else if(originClassEnum == PG_NAMESPACE)
                 CIM_NAMESPACE_PROPERTY_CREATIONCLASSNAME,  
                 System::getHostName()))  
     {     {
         propertyName = CIM_NAMESPACE_PROPERTY_CREATIONCLASSNAME;                expectedTargetRole = PROPERTY_ANTECEDENT;
         valid = false;                expectedOriginRole = PROPERTY_DEPENDENT;
     }     }
             break;
     if (!_validateRequiredProperty(objectPath,        case PG_COMMMECHANISMFORMANAGER:
                 CIM_NAMESPACE_PROPERTY_NAME,            if(originClassEnum == PG_OBJECTMANAGER)
                 String::EMPTY))  
     {     {
         propertyName = CIM_NAMESPACE_PROPERTY_NAME;                expectedTargetRole = PROPERTY_DEPENDENT;
         valid = false;                expectedOriginRole = PROPERTY_ANTECEDENT;
     }     }
             else if(originClassEnum == PG_CIMXMLCOMMUNICATIONMECHANISM)
     if (false)  
     {     {
         PEG_METHOD_EXIT();                expectedTargetRole = PROPERTY_ANTECEDENT;
         throw CIMInvalidParameterException(                expectedOriginRole = PROPERTY_DEPENDENT;
             "Invalid key property: " + propertyName.getString());  
     }     }
     PEG_METHOD_EXIT();            break;
         case PG_ELEMENTCONFORMSTOPROFILE:
             if(originClass.equal(PEGASUS_CLASSNAME_PG_REGISTEREDPROFILE))
             {
                 expectedTargetRole =
                     ELEMENTCONFORMSTOPROFILE_PROPERTY_MANAGEDELEMENT;
                 expectedOriginRole =
                     ELEMENTCONFORMSTOPROFILE_PROPERTY_CONFORMANTSTANDARD;
 } }
             else
 void _validateCIMNamespaceKeys(const CIMInstance& instance)  
 { {
     PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,                expectedTargetRole =
             "InteropProvider::_validateCIMNamespaceKeys");                    ELEMENTCONFORMSTOPROFILE_PROPERTY_CONFORMANTSTANDARD;
     Boolean valid = true;                expectedOriginRole =
     CIMName propertyName;                    ELEMENTCONFORMSTOPROFILE_PROPERTY_MANAGEDELEMENT;
     if (!_validateRequiredProperty(instance,            }
                 CIM_NAMESPACE_PROPERTY_SYSTEMCREATIONCLASSNAME,            break;
                 System::getSystemCreationClassName ()))        case PG_ELEMENTCONFORMSTOPROFILE_RP_RP:
             propNames.append(CIMName("RegisteredName"));
             propertyList = CIMPropertyList(propNames);
             try
     {     {
         propertyName = CIM_NAMESPACE_PROPERTY_SYSTEMCREATIONCLASSNAME;                tmpInstance = localGetInstance(
         valid = false;                    context,
                     objectName,
                     propertyList);
     }     }
             catch (CIMException &e)
     if (!_validateRequiredProperty(instance,  
                 CIM_NAMESPACE_PROPERTY_SYSTEMNAME,  
                 System::getHostName()))  
     {     {
         propertyName = CIM_NAMESPACE_PROPERTY_SYSTEMNAME;                PEG_TRACE((TRC_CONTROLPROVIDER, Tracer::LEVEL2,
         valid = false;                    "CIMException while getting instance of Registered Profile "
                         ": %s",
                     (const char*)e.getMessage().getCString()));
     }     }
             if (!tmpInstance.isUninitialized())
     if (!_validateRequiredProperty(instance,  
                 CIM_NAMESPACE_PROPERTY_OBJECTMANAGERCREATIONCLASSNAME,  
                 CIM_OBJECTMANAGER_CLASSNAME.getString()))  
     {     {
         propertyName = CIM_NAMESPACE_PROPERTY_OBJECTMANAGERCREATIONCLASSNAME;                index = tmpInstance.findProperty("RegisteredName");
         valid = false;                if (index != PEG_NOT_FOUND)
     }                {
                     const CIMValue &tmpVal =
     // ATTN: This one still a problem.  We have to get the name first                        tmpInstance.getProperty(index).getValue();
     if (!_validateRequiredProperty(instance,                    if (!tmpVal.isNull())
                 CIM_NAMESPACE_PROPERTY_OBJECTMANAGERNAME,  
                 String::EMPTY))  
     {     {
         propertyName = CIM_NAMESPACE_PROPERTY_OBJECTMANAGERNAME;                        tmpVal.get(profileName);
         valid = false;  
     }     }
     if (!_validateRequiredProperty(instance,                }
                 CIM_NAMESPACE_PROPERTY_CREATIONCLASSNAME,            }
                 System::getHostName()))            if (String::compareNoCase(profileName, String("SMI-S")) == 0)
     {     {
         propertyName = CIM_NAMESPACE_PROPERTY_CREATIONCLASSNAME;                expectedTargetRole =
         valid = false;                    ELEMENTCONFORMSTOPROFILE_PROPERTY_MANAGEDELEMENT;
                 expectedOriginRole =
                     ELEMENTCONFORMSTOPROFILE_PROPERTY_CONFORMANTSTANDARD;
     }     }
             else
     if (!_validateRequiredProperty(instance,  
                 CIM_NAMESPACE_PROPERTY_NAME,  
                 String::EMPTY))  
     {     {
         propertyName = CIM_NAMESPACE_PROPERTY_NAME;                expectedTargetRole =
         valid = false;                    ELEMENTCONFORMSTOPROFILE_PROPERTY_CONFORMANTSTANDARD;
                 expectedOriginRole =
                     ELEMENTCONFORMSTOPROFILE_PROPERTY_MANAGEDELEMENT;
     }     }
             break;
     if (false)        case PG_SUBPROFILEREQUIRESPROFILE:
             if(originClassEnum == PG_REGISTEREDPROFILE)
     {     {
         PEG_TRACE_STRING(TRC_CONTROLPROVIDER, Tracer::LEVEL4,                expectedTargetRole = PROPERTY_DEPENDENT;
             "Invalid CIM_Namespace Key Property " +  propertyName.getString());                expectedOriginRole = PROPERTY_ANTECEDENT;
         PEG_METHOD_EXIT();  
         throw CIMInvalidParameterException(  
             "Invalid CIM_Namespace key property: " + propertyName.getString());  
     }     }
     PEG_TRACE_STRING(TRC_CONTROLPROVIDER, Tracer::LEVEL4, "CIM_Namespace Keys Valid");            else if(originClassEnum == PG_REGISTEREDSUBPROFILE)
     PEG_METHOD_EXIT();            {
                 expectedTargetRole = PROPERTY_ANTECEDENT;
                 expectedOriginRole = PROPERTY_DEPENDENT;
 } }
             break;
 /* Given a class and instance build the instance path for a        case PG_REFERENCEDPROFILE:
    the object.  This builds all components of the path            if (originClassEnum == PG_REGISTEREDSUBPROFILE)
    @param namespace name to build  
    @return CIMObjectPath containing namespace, class and keybinding  
    components of path  
    @exceptions - Passes repository exceptions.  
 */  
 // ATTN: KS Build path from instance and instance from class.  Not sure  
 //   we want to always do this.  Consider change to build keys directly  
   
 CIMObjectPath InteropProvider::_buildInstancePath(const CIMNamespaceName& name,  
                                            const CIMName className,  
                                            const CIMInstance& instance)  
 { {
     PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,                expectedTargetRole = PROPERTY_ANTECEDENT;
             "InteropProvider::_buildInstancePath");                expectedOriginRole = PROPERTY_DEPENDENT;
   
     // get the class CIM_Namespace class to use in building path  
   
     // Exception out if Class does not exist in this namespace  
     CIMClass thisClass = _getClass(name, className);  
   
     // XmlWriter::printInstanceElement(instance);  
     CIMObjectPath ref = instance.buildPath(thisClass);  
   
     PEG_METHOD_EXIT();  
     return(ref);  
 } }
             else if (originClassEnum == PG_REGISTEREDPROFILE)
 /* _isNamespace determines if the namespace in the second  
    parameter is in the array in the first parameter.  
     @param array of possible namespaces  
     @param canidate namespace  
     @return - true if found  
 */  
 Boolean _isNamespace(  
             Array<CIMNamespaceName>& namespaceNames,  
                 CIMNamespaceName& namespaceName)  
   
 { {
      Boolean found = false;                if ((targetProperty.size() != 0) &&
      for(Uint32 i = 0; i < namespaceNames.size(); i++)                    (originProperty.size() != 0) &&
                     String::equalNoCase(targetProperty, originProperty))
      {      {
         if(namespaceNames[i].equal ( namespaceName ))  
             return true;  
      }  
      return false;      return false;
 } }
                 if (targetProperty.size() != 0)
 Boolean _isChild(                {
         CIMNamespaceName& parentNamespaceName,                    if (!(String::equalNoCase(targetProperty, "Antecedent") ||
         CIMNamespaceName& namespaceName)                        String::equalNoCase(targetProperty, "Dependent") ))
   
 { {
     String parent = parentNamespaceName.getString();  
     String child = namespaceName.getString();  
     //  
     //  If length of namespace name is shorter than or equal to the  
     //  length of parent namespace name, cannot be a child  
     //  
     if (child.size () <= parent.size ())  
       return false;  
   
     //  
     //  Compare prefix substring of namespace name with parent namespace name  
     //  
     else if (String::equalNoCase (child.subString (0, parent.size ()), parent))  
       return true;  
   
     return false;     return false;
 } }
 //**************************************************************                }
 // Overloaded functions to get key value with different params                if (originProperty.size() != 0)
 //**************************************************************  
   
 /*  find the name key in the keybindings and return the value.  
     Executes exception if the key not found  
     @param object path we will search  
     @param keyName - Name of the key to find.  
     @return value of name property  
     @exceptions CIMInvalidParameterException  
 */  
 String _getKeyValue(const CIMObjectPath& instanceName, const CIMName& keyName)  
 { {
     Array<CIMKeyBinding> kbArray = instanceName.getKeyBindings();                    if (!(String::equalNoCase(originProperty, "Antecedent") ||
                         String::equalNoCase(originProperty, "Dependent") ))
     // find the correct key binding  
     for (Uint32 i = 0; i < kbArray.size(); i++)  
     {     {
         if (kbArray[i].getName() == keyName)                        return false;
             return (kbArray[i].getValue());  
     }     }
   
     throw CIMInvalidParameterException("Invalid key property: " + keyName.getString());  
 } }
                 if (String::equalNoCase(originProperty, "Antecedent") &&
 String _getKeyValue(const CIMInstance& instance, const CIMName& keyName)                    targetProperty.size() == 0)
 { {
     Uint32 pos;                    targetProperty = String("Dependent");
     CIMValue propertyValue;  
   
     pos = instance.findProperty(keyName);  
     if (pos == PEG_NOT_FOUND)  
        throw CIMPropertyNotFoundException  
            (NAMESPACE_PROPERTYNAME.getString());  
   
     propertyValue = instance.getProperty(pos).getValue();  
     if (propertyValue.getType() != CIMTYPE_STRING)  
        throw CIMInvalidParameterException("Invalid type for property: "  
                              + NAMESPACE_PROPERTYNAME.getString());  
     String name;  
     propertyValue.get(name);  
     return(name);  
     //ATTN: KS Returns String whereas below returns CIMNamespaceName.  
 } }
                 if (String::equalNoCase(originProperty, "Dependent") &&
 /* gets the key value for the __Namespace property "name"                    targetProperty.size() == 0)
    from the instance provided. Sets childNamespaceName and  
    isRelativeName fields  
    This overload called if instance provided.  
 */  
 void _getKeyValue (  
     const CIMInstance& namespaceInstance,  
         CIMNamespaceName& childNamespaceName,  
         Boolean& isRelativeName)  
   
 { {
     //Validate key property                    targetProperty = String("Antecedent");
   
     Uint32 pos;  
     CIMValue propertyValue;  
   
     pos = namespaceInstance.findProperty(NAMESPACE_PROPERTYNAME);  
     if (pos == PEG_NOT_FOUND)  
     {  
        throw CIMPropertyNotFoundException  
            (NAMESPACE_PROPERTYNAME.getString());  
     }     }
                 if (String::equalNoCase(targetProperty, "Antecedent") &&
     propertyValue = namespaceInstance.getProperty(pos).getValue();                    originProperty.size() == 0)
     if (propertyValue.getType() != CIMTYPE_STRING)  
        throw CIMInvalidParameterException("Invalid type for property: "  
                              + NAMESPACE_PROPERTYNAME.getString());  
   
     String cnsName;  
     propertyValue.get(cnsName);  
     childNamespaceName = CIMNamespaceName (cnsName);  
   
     isRelativeName = !(childNamespaceName.isNull());  
 }  
 /* gets the key value for the __Namespace property "name"  
    from the instance provided. Sets childNamespaceName and  
    isRelativeName fields  
    This overload called if object path provided.  
 */  
   
 void _getKeyValue (  
         const CIMObjectPath&  instanceName,  
         CIMNamespaceName& childNamespaceName,  
         Boolean& isRelativeName)  
 { {
                     originProperty = String("Dependent");
     Array<CIMKeyBinding> kbArray = instanceName.getKeyBindings();                }
                 if (String::equalNoCase(targetProperty, "Dependent") &&
     if ((kbArray.size() == 1) &&                    originProperty.size() == 0)
             (kbArray[0].getName() == NAMESPACE_PROPERTYNAME))  
     {     {
        childNamespaceName = CIMNamespaceName (kbArray[0].getValue());                    originProperty = String("Antecedent");
        isRelativeName = !(childNamespaceName.isNull());  
     }     }
     else                return true;
        throw CIMInvalidParameterException("Invalid key property:  ");  
 } }
             break;
 /* generate the full namespace name from the parent and child        case PG_ELEMENTSOFTWAREIDENTITY:
    components            if(originClassEnum == PG_SOFTWAREIDENTITY)
    @param namespaceNames - List of all namespaces  
    @param parentNamespaceName  
    @param childNamespaceName  
    @param Boolean isrelative  
    @return full namespacename created from parent + child  
    Note that if isrelative is true, parent is tested for validty  
 */  
 CIMNamespaceName _generateFullNamespaceName(  
                 Array<CIMNamespaceName>& namespaceNames,  
                 CIMNamespaceName& parentNamespaceName,  
                 CIMNamespaceName& childNamespaceName,  
                 Boolean isRelativeName)  
   
 {  
     // If isRelativeName is true, then the parentNamespace  
     // MUST exist  
     //  
     CIMNamespaceName fullNamespaceName;  
   
     if (isRelativeName)  
     {     {
       if (!_isNamespace(namespaceNames, parentNamespaceName))                expectedTargetRole = PROPERTY_DEPENDENT;
                 expectedOriginRole = PROPERTY_ANTECEDENT;
             }
             else if(originClassEnum == PG_REGISTEREDPROFILE ||
                 originClassEnum == PG_REGISTEREDSUBPROFILE)
       {       {
          throw CIMObjectNotFoundException("Parent namespace does not exist: "                expectedTargetRole = PROPERTY_ANTECEDENT;
                                   + parentNamespaceName.getString());                expectedOriginRole = PROPERTY_DEPENDENT;
       }       }
       // Create full namespace name by prepending parentNamespaceName            break;
       fullNamespaceName = CIMNamespaceName (parentNamespaceName.getString()        case PG_INSTALLEDSOFTWAREIDENTITY:
           + "/" + childNamespaceName.getString());            if(originClassEnum == PG_SOFTWAREIDENTITY)
             {
                 expectedTargetRole = INSTALLEDSOFTWAREIDENTITY_PROPERTY_SYSTEM;
                 expectedOriginRole =
                     INSTALLEDSOFTWAREIDENTITY_PROPERTY_INSTALLEDSOFTWARE;
     }     }
     else            else if(originClassEnum == PG_COMPUTERSYSTEM)
     {     {
       fullNamespaceName = parentNamespaceName;                expectedTargetRole =
                     INSTALLEDSOFTWAREIDENTITY_PROPERTY_INSTALLEDSOFTWARE;
                 expectedOriginRole = INSTALLEDSOFTWAREIDENTITY_PROPERTY_SYSTEM;
     }     }
     return(fullNamespaceName);            break;
         case PG_HOSTEDACCESSPOINT:
             if(originClassEnum == PG_COMPUTERSYSTEM)
             {
                 expectedTargetRole = PROPERTY_DEPENDENT;
                 expectedOriginRole = PROPERTY_ANTECEDENT;
 } }
             else if(originClassEnum == PG_CIMXMLCOMMUNICATIONMECHANISM)
 //***************************************************************************            {
 //  The following section is the Instance Operation processors                expectedTargetRole = PROPERTY_ANTECEDENT;
 //***************************************************************************                expectedOriginRole = PROPERTY_DEPENDENT;
 //                createInstance  
 //***************************************************************************  
 void InteropProvider::createInstance(  
         const OperationContext & context,  
         const CIMObjectPath & instanceReference,  
     const CIMInstance& myInstance,  
         ObjectPathResponseHandler & handler)  
     {  
         PEG_METHOD_ENTER(TRC_CONTROLPROVIDER, "InteropProvider::createInstance()");  
   
         CIMNamespaceName childNamespaceName;  
         CIMNamespaceName newNamespaceName;  
         Boolean isRelativeName;  
         CDEBUG("CreateInstance " << instanceReference.toString());  
         // operation namespace needed internally to get class.  
         _operationNamespace = instanceReference.getNameSpace();  
   
         // Verify that ClassName is correct and get value  
         targetClass classEnum  = _verifyValidClassInput(instanceReference.getClassName());  
         CDEBUG("Class Validated");  
         String userName = _validateUserID(context);  
         CIMObjectPath newInstanceReference;  
         CDEBUG("UserIDValidated");  
         if ((classEnum == CIM_OBJECTMANAGER) ||  
             (classEnum == PG_CIMXMLCOMMUNICATIONMECHANISM))  
             throw CIMNotSupportedException("InteropProvider, Create Not allowed");  
   
         CDEBUG("CreateInstance: No test for CIM_NamepsaceClass");  
         if (classEnum == CIM_NAMESPACE)  
         {  
             // Validate that keys are as required. Does its own exception.  
             _validateCIMNamespaceKeys(myInstance);  
             String namespaceName;  
             newNamespaceName = _getKeyValue(myInstance, CIM_NAMESPACE_PROPERTY_NAME);  
   
             CIMInstance instance = _buildInstanceCIMNamespace(namespaceName);  
             CDEBUG("CreateInstance:Rtn from _BuildInstanceCIMNamespace for namespace= " << namespaceName);  
             newInstanceReference = _buildInstancePath(CIMNamespaceName(namespaceName),  
                                         CIM_NAMESPACE_CLASSNAME, instance);  
             CDEBUG("CreateInstance:Go to common create functions");  
         }  
   
         else   // Process the __Namespace request to get namespace name value  
         {  
             CDEBUG("CreateInstance: Fell through to __Namespace processing");  
             _getKeyValue(myInstance, childNamespaceName, isRelativeName);  
             CIMNamespaceName parentNamespaceName = instanceReference.getNameSpace();  
   
             PEG_TRACE_STRING(TRC_CONTROLPROVIDER, Tracer::LEVEL4,  
                "childNamespaceName = " + childNamespaceName.getString() +  
                ", isRelativeName = " +  
                (isRelativeName?String("true"):String("false")) +  
                ", parentNamespaceName = " + parentNamespaceName.getString());  
             CDEBUG("__Namespace Process. parent= " << parentNamespaceName.getString() );  
             Array<CIMNamespaceName> namespaceNames;  
             namespaceNames = _enumerateNameSpaces();  
   
             newNamespaceName = _generateFullNamespaceName(  
                 namespaceNames, parentNamespaceName,  
                          childNamespaceName, isRelativeName);  
   
             // return key (i.e., CIMObjectPath) for newly created namespace  
   
             Array<CIMKeyBinding> keyBindings;  
             keyBindings.append(CIMKeyBinding(NAMESPACE_PROPERTYNAME,  
                  isRelativeName?childNamespaceName.getString():  
                                     parentNamespaceName.getString(),  
                                          CIMKeyBinding::STRING));  
             //Add namespace class and keybindings  
             newInstanceReference.set(String::EMPTY, parentNamespaceName,  
                                          __NAMESPACE_CLASSNAME, keyBindings);  
         }         }
         // Create the new namespace        case PG_HOSTEDOBJECTMANAGER:
         try            if(originClassEnum == PG_COMPUTERSYSTEM)
         {         {
             CDEBUG("Create namespace " << newNamespaceName.getString());                expectedTargetRole = PROPERTY_DEPENDENT;
             PEG_TRACE_STRING(TRC_CONTROLPROVIDER, Tracer::LEVEL4,                expectedOriginRole = PROPERTY_ANTECEDENT;
                 "Namespace = " + newNamespaceName.getString() +  
                     " to be created.");  
   
             _repository->createNameSpace(newNamespaceName);  
   
             PEG_TRACE_STRING(TRC_CONTROLPROVIDER, Tracer::LEVEL4,  
                 "Namespace = " + newNamespaceName.getString() +  
                     " successfully created.");  
             // ATTN: Add standardlog entry here.  
         }         }
         catch(CIMException& e)            else if(originClassEnum == PG_OBJECTMANAGER)
         {         {
            PEG_METHOD_EXIT();                expectedTargetRole = PROPERTY_ANTECEDENT;
            throw e;                expectedOriginRole = PROPERTY_DEPENDENT;
         }         }
         catch(Exception& e)            break;
   #ifdef PEGASUS_ENABLE_DMTF_INDICATION_PROFILE_SUPPORT
         case PG_HOSTEDINDICATIONSERVICE:
             if(originClassEnum == PG_COMPUTERSYSTEM)
         {         {
            PEG_METHOD_EXIT();                expectedTargetRole = PROPERTY_DEPENDENT;
            throw e;                expectedOriginRole = PROPERTY_ANTECEDENT;
         }         }
             break;
         // begin processing the request  #endif
         handler.processing();        default:
             break;
   
        handler.deliver(newInstanceReference);  
   
        // complete processing the request  
        handler.complete();  
   
        PEG_METHOD_EXIT();  
        return;  
    }    }
  
 //***************************************************************************      //
 //                deleteInstance      // The rest of this method checks to see if target role and origin roles
 //***************************************************************************      // were found for the association and origin class combination and, if
 void InteropProvider::deleteInstance(      // found, checks against the input target and origin roles if provided.
         const OperationContext & context,      // Failure for any of these tests points to an invalid association
         const CIMObjectPath & instanceName,      // traversal request.
         ResponseHandler & handler)      //
       if(expectedTargetRole.isNull() ||
           expectedOriginRole.isNull())
     {     {
         PEG_METHOD_ENTER(TRC_CONTROLPROVIDER, "InteropProvider::deleteInstance");          PEG_METHOD_EXIT();
           return false;
         CIMNamespaceName childNamespaceName;      }
         CIMNamespaceName deleteNamespaceName;  
         Boolean isRelativeName;  
   
         _operationNamespace = instanceName.getNameSpace();  
         handler.processing();  
         // Verify that ClassName is correct and get value  
         targetClass classEnum  = _verifyValidClassInput(instanceName.getClassName());  
   
         String userName = _validateUserID(context);  
   
   
         if ((classEnum == PG_CIMXMLCOMMUNICATIONMECHANISM))  
             throw CIMNotSupportedException("Delete Not allowed");  
  
         // Delete the instance since it may be in persistent storage      if(targetProperty.size() == 0)
         if ((classEnum == CIM_OBJECTMANAGER))  
         {         {
             CIMInstance instance;          targetProperty = expectedTargetRole.getString();
             try  
             {  
             instance = _repository->getInstance(_operationNamespace, instanceName);  
   
             // If instance found, then delete it.  
             _repository->deleteInstance(_operationNamespace,instanceName);  
   
             PEG_METHOD_EXIT();  
             handler.complete();  
             return;  
             }             }
             catch(CIMException& e)      else if(!expectedTargetRole.equal(targetProperty))
             {             {
                 PEG_METHOD_EXIT();                 PEG_METHOD_EXIT();
                 throw e;          return false;
             }  
         }         }
  
         Array<CIMNamespaceName> namespaceNames;      if(originProperty.size() == 0)
         namespaceNames = _enumerateNameSpaces();  
         if (classEnum == CIM_NAMESPACE)  
         {         {
             // validate requred keys.  Exception out if not valid          originProperty = expectedOriginRole.getString();
             _validateCIMNamespaceKeys(instanceName);  
   
             deleteNamespaceName = _getKeyValue(instanceName, CIM_NAMESPACE_PROPERTY_NAME);  
             CDEBUG("Delete namespace = " << deleteNamespaceName );  
         }         }
         else  // Procesing for __namespace      else if(!expectedOriginRole.equal(originProperty))
         {         {
           PEG_METHOD_EXIT();
             CIMNamespaceName childNamespaceName;          return false;
             CIMNamespaceName deleteNamespaceName;  
             Boolean isRelativeName;  
             _getKeyValue(instanceName, childNamespaceName, isRelativeName);  
             CIMNamespaceName parentNamespaceName = instanceName.getNameSpace();  
   
             PEG_TRACE_STRING(TRC_CONTROLPROVIDER, Tracer::LEVEL4,  
                "childNamespaceName = " + childNamespaceName.getString() +  
                (isRelativeName?String("true"):String("false")) +  
                ", parentNamespaceName = " + parentNamespaceName.getString());  
   
             // begin processing the request  
   
             deleteNamespaceName = _generateFullNamespaceName(  
                namespaceNames, parentNamespaceName,  
                          childNamespaceName, isRelativeName);  
         }  
   
             // ATTN: KS Why THis???  
         if (deleteNamespaceName.equal (ROOTNS))  
        {  
            throw CIMNotSupportedException("root namespace cannot be deleted.");  
        }        }
  
            _repository->deleteNameSpace(deleteNamespaceName);  
   
            PEG_TRACE_STRING(TRC_CONTROLPROVIDER, Tracer::LEVEL4,  
                "Namespace = " + deleteNamespaceName.getString() +  
                " successfully deleted.");  
   
        Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::INFORMATION,  
            "Interop Provider Delete Namespace: $0",  
            deleteNamespaceName.getString());  
   
        handler.processing();  
   
        // complete processing the request  
        handler.complete();  
   
        PEG_METHOD_EXIT();        PEG_METHOD_EXIT();
        return ;      return true;
     }     }
  
 //***************************************************************************  //
 //                getInstance  // Local version of the references operation. It validates the input
 //***************************************************************************  // parameters, setting the origin and target property values if not set
 void InteropProvider::getInstance(  // already, and then performs an enumeration on the association class. It then
   // filters the results of that enumeration to see if one of the reference
   // properties matches the objectName parameter passed into the method. If so,
   // then it is added to the array of association instances to be returned.
   //
   Array<CIMInstance> InteropProvider::localReferences(
     const OperationContext & context,     const OperationContext & context,
     const CIMObjectPath & instanceName,      const CIMObjectPath & objectName,
     const Boolean includeQualifiers,      const CIMName & assocClass,
     const Boolean includeClassOrigin,      String & originProperty,
       String & targetProperty,
     const CIMPropertyList & propertyList,     const CIMPropertyList & propertyList,
     InstanceResponseHandler & handler)      const CIMName & targetClass)
     {     {
         PEG_METHOD_ENTER(TRC_CONTROLPROVIDER, "InteropProvider::getInstance");      PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,
           "InteropProvider::localReferences()");
         // Verify that ClassName is correct and get value  
         targetClass classEnum  = _verifyValidClassInput(instanceName.getClassName());  
  
         String userName = _validateUserID(context);      Array<CIMInstance> instances;
       CIMName originClass = objectName.getClassName();
  
         // begin processing the request      Array<CIMName> targetSubclasses;
         handler.processing();      CIMNamespaceName lastTargetNamespace;
         if (classEnum == CIM_OBJECTMANAGER)      CIMNamespaceName originNamespace(objectName.getNameSpace());
   
       // Check that the association traversal request is valid
       if (validAssocClassForObject(
           context,
           assocClass,
           objectName,
           originNamespace,
           originProperty,
           targetProperty))
       {
           // retrieve all of the association class instances
           Array<CIMInstance> localInstances = localEnumerateInstances(context,
               CIMObjectPath(hostName, originNamespace,
                   assocClass));
           // Filter the association class instances based on the origin instance
           // and other input parameters.
           for(Uint32 i = 0, n = localInstances.size(); i < n; ++i)
           {
               CIMInstance & currentInstance = localInstances[i];
               CIMObjectPath originPath = getRequiredValue<CIMObjectPath>(
                   currentInstance, originProperty);
               originPath.setNameSpace(objectName.getNameSpace());
               originPath.setHost(objectName.getHost());
               // Only include instances where the origin instance is present in
               // the association.
               if(originPath.identical(objectName))
               {
                   if(!targetClass.isNull())
                   {
                       // Have to check if the target reference is of the
                       // targetClass type. We first must determine all the
                       // possible subclasses of the targetClass in the target
                       // namespace.
                       CIMObjectPath targetPath = getRequiredValue<CIMObjectPath>(
                           currentInstance, targetProperty);
   
                       CIMNamespaceName targetNamespace(
                           targetPath.getNameSpace());
                       if(targetNamespace.isNull())
         {         {
             CIMInstance instance = _buildInstanceCIMObjectManager(includeQualifiers,                          targetNamespace = originNamespace;
                                         includeClassOrigin, propertyList);                          targetPath.setNameSpace(targetNamespace);
             handler.deliver(instance);  
             handler.complete();  
             PEG_METHOD_EXIT();  
             return;  
         }         }
                       if(targetNamespace != lastTargetNamespace)
   
         if (classEnum == PG_CIMXMLCOMMUNICATIONMECHANISM)  
         {         {
             // ATTN: test for correct instance KS: Priority 1                          try
             Array <CIMInstance> instances = _buildInstancesPGCIMXMLCommunicationMechanism(  
                                     includeQualifiers,  
                                     includeClassOrigin, propertyList);  
             handler.deliver(instances[0]);  
             handler.complete();  
             PEG_METHOD_EXIT();  
             return;  
         }  
   
         // Get List of namespaces  
         Array<CIMNamespaceName> namespaceNames;  
         namespaceNames = _enumerateNameSpaces();  
         CIMInstance instance;  
   
         if (classEnum == CIM_NAMESPACE)  
         {         {
             // Not clear what we have to take into account here.                              targetSubclasses = repository->enumerateClassNames(
             // get the namespace from the name value.                                  targetNamespace, targetClass, true);
             // should check the other keys to see if valid.                          }
             CIMNamespaceName namespaceName;                          catch(...)
             namespaceName = _getKeyValue(instanceName, CIM_NAMESPACE_PROPERTY_NAME);  
   
             // ATTN: Why this CIMNamespaceName parentNamespaceName = instanceName.getNameSpace();  
             if (!_isNamespace(namespaceNames, namespaceName))  
             {             {
                 throw CIMObjectNotFoundException("Namespace does not exist: "                              // If an exception was thrown during enumeration,
                                      + namespaceName.getString());                              // then the base class didn't exist in the
                               // namespace, so the target instance retrieved
                               // must not match the targetClass parameter.
                               continue;
             }             }
             PEG_TRACE_STRING(TRC_CONTROLPROVIDER, Tracer::LEVEL4,                          targetSubclasses.append(targetClass);
                "Namespace = " + namespaceName.getString() + " successfully found.");                          lastTargetNamespace = targetNamespace;
   
             instance = _getInstanceCIMNamespace(namespaceName);  
         }         }
         else  // processing for __Namespace  
         {  
             CIMNamespaceName childNamespaceName;  
             CIMNamespaceName getNamespaceName;  
             Boolean isRelativeName;  
   
             _getKeyValue(instanceName, childNamespaceName, isRelativeName);  
             CIMNamespaceName parentNamespaceName = instanceName.getNameSpace();  
   
             PEG_TRACE_STRING(TRC_CONTROLPROVIDER, Tracer::LEVEL4,  
                "childNamespaceName = " + childNamespaceName.getString() +  
                (isRelativeName?String("true"):String("false")) +  
                ", parentNamespaceName = " + parentNamespaceName.getString());  
   
  
             getNamespaceName = _generateFullNamespaceName(                      // Try to find the targetPath's class in the search space
                 namespaceNames, parentNamespaceName,                      CIMName targetPathClass = targetPath.getClassName();
                          childNamespaceName, isRelativeName);                      for(Uint32 j = 0, m = targetSubclasses.size(); j < m; ++j)
                       {
             // exception if not valid namespace                          if(targetPathClass == targetSubclasses[j])
             if (!_isNamespace(namespaceNames, getNamespaceName))  
             {             {
               throw CIMObjectNotFoundException("Namespace deos not exist: "                              instances.append(currentInstance);
                                      + getNamespaceName.getString());                              break;
             }             }
             PEG_TRACE_STRING(TRC_CONTROLPROVIDER, Tracer::LEVEL4,  
                "Namespace = " + getNamespaceName.getString() +  
                    " successfully found.");  
   
             //Set name of class  
             CIMInstance instance(__NAMESPACE_CLASSNAME);  
   
             //  
             // construct the instance  
             //  
             instance.addProperty(CIMProperty(NAMESPACE_PROPERTYNAME,  
             isRelativeName?childNamespaceName.getString():  
                               parentNamespaceName.getString()));  
             //instance.setPath(instanceName);  
        }        }
   
        handler.deliver(instance);  
   
        // complete processing the request  
        handler.complete();  
   
        PEG_METHOD_EXIT();  
        return ;  
     }     }
                   else
 //***************************************************************************  
 //                enumerateInstances  
 //***************************************************************************  
 void InteropProvider::enumerateInstances(  
     const OperationContext & context,  
     const CIMObjectPath & ref,  
     const Boolean includeQualifiers,  
     const Boolean includeClassOrigin,  
     const CIMPropertyList& propertyList,  
     InstanceResponseHandler & handler)  
     {  
         PEG_METHOD_ENTER(TRC_CONTROLPROVIDER, "InteropProvider::enumerateInstances()");  
         // Verify that ClassName is correct and get value  
   
         targetClass classEnum  = _verifyValidClassInput(ref.getClassName());  
   
         // operation namespace needed internally to get class.  
         _operationNamespace = ref.getNameSpace();  
         //String userName = _validateUserID(context);  
   
         // The following 3 classes deliver a single instance because  
         // that is all there is today.  
         if (classEnum == CIM_OBJECTMANAGER)  
         {         {
             CIMInstance instance = _buildInstanceCIMObjectManager(includeQualifiers,                      instances.append(currentInstance);
                                     includeClassOrigin,                  }
                                     propertyList);              }
             handler.deliver(instance);          }
             handler.complete();  
             PEG_METHOD_EXIT();  
             return;  
         }         }
  
         if (classEnum == PG_CIMXMLCOMMUNICATIONMECHANISM)  
         {  
             Array<CIMInstance> instances = _buildInstancesPGCIMXMLCommunicationMechanism(includeQualifiers,  
                                     includeClassOrigin, propertyList);  
             CDEBUG("Build instances of PGCIMXML. count= " << instances.size());  
             handler.deliver(instances);  
             handler.complete();  
             PEG_METHOD_EXIT();             PEG_METHOD_EXIT();
             return;      return instances;
         }         }
  
  
         if (classEnum == CIM_NAMESPACE)  //
   // Builds an instance of the class named className. Gets Class defintion and
   // fills in the correct properties from the class.  This requires a repository
   // getClass request for each instance built. The skeleton is built by
   // creating the instance and copying qualifiers and properties from
   // the class. Finally the instance is cloned to separate it from the
   // original objects.
   // NOTE: This is very inefficient for anything larger than a few instances.
   // We should separate the get from the createSkeleton.
   // @param className CIMName of the class for which the instance is to be built
   // @return CIMInstance of this class with properties complete.
   // @exception passes on any exceptions received from the repository request.
   //
   CIMInstance InteropProvider::buildInstanceSkeleton(
         const CIMNamespaceName & nameSpace,
         const CIMName& className,
         Boolean includeQualifiers,
         CIMClass& returnedClass)
         {         {
             Array<CIMInstance> instances = _getInstancesCIMNamespace(includeQualifiers,      PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,
                                     includeClassOrigin, propertyList);          "InteropProvider::_buildInstanceSkeleton()");
       // get class with lo = false, qualifier = true classorig = true
       returnedClass = repository->getClass(nameSpace,
           className, false, true, true);
       CIMInstance skeleton = returnedClass.buildInstance(
           includeQualifiers, true, CIMPropertyList());
  
             handler.deliver(instances);  
             handler.complete();  
             PEG_METHOD_EXIT();             PEG_METHOD_EXIT();
             return;      return skeleton;
         }         }
  
         // ATTN: Fix this up.  should not be here.  
         CIMNamespaceName parentNamespaceName = ref.getNameSpace();  
   
         // ATTN KS Fix this so references both types of namespace  
         PEG_TRACE_STRING(TRC_CONTROLPROVIDER, Tracer::LEVEL4,  
            "parentNamespaceName = " + parentNamespaceName.getString());  
   
         // begin processing the request  
         handler.processing();  
   
         Array<CIMNamespaceName> namespaceNames = _enumerateNameSpaces();  
  
         Array<CIMInstance> instanceArray;  CIMInstance InteropProvider::buildDependencyInstance(
         CDEBUG("Found " << namespaceNames.size() << " namespaces.");      const String & antecedentId,
         // Build response objects based on class requested      const CIMName & antecedentClass,
         for (Uint32 i = 0; i < namespaceNames.size(); i++)      const String & dependentId,
       const CIMName & dependentClass,
       const CIMClass & dependencyClass)
         {         {
             // Build the instances. For now simply build the __Namespace instances      Array<CIMKeyBinding> dependentKeys;
             // the only property is name.  
             if (_isChild(parentNamespaceName, namespaceNames[i]))  
             {  
                 CIMInstance instance(__NAMESPACE_CLASSNAME);  
                 instance.addProperty(  
                     (CIMProperty(NAMESPACE_PROPERTYNAME,  
                     namespaceNames[i].getString().subString  
                         (parentNamespaceName.getString().size()+1,  
                         namespaceNames[i].getString().size()-  
                     parentNamespaceName.getString().size()-1))));  
   
                 instanceArray.append(instance);  
   
                 //instance.setPath(instanceName);  
                 PEG_TRACE_STRING(TRC_CONTROLPROVIDER, Tracer::LEVEL4,  
                 "childNamespace = " + namespaceNames[i].getString());  
             }  
         }  
         handler.deliver(instanceArray);  
  
         // complete processing the request      dependentKeys.append(CIMKeyBinding(
         handler.complete();          COMMON_PROPERTY_INSTANCEID,
           dependentId,CIMKeyBinding::STRING));
  
         PEG_METHOD_EXIT();      return buildDependencyInstanceFromPaths(
           buildDependencyReference(hostName, antecedentId, antecedentClass),
           buildDependencyReference(hostName, dependentId, dependentClass),
           dependencyClass);
     }     }
  
 //***************************************************************************  void InteropProvider::initProvider()
 //                enumerateInstanceNames  
 //***************************************************************************  
   
 void InteropProvider::enumerateInstanceNames(  
         const OperationContext & context,  
         const CIMObjectPath & classReference,  
         ObjectPathResponseHandler & handler)  
     {     {
         PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,      if(providerInitialized)
                 "InteropProvider::enumerateInstanceNames()");  
   
         // operation namespace needed internally to get class.  
         _operationNamespace = classReference.getNameSpace();  
   
         targetClass classEnum  = _verifyValidClassInput(classReference.getClassName());  
   
         String userName = _validateUserID(context);  
         // begin processing the request  
         handler.processing();  
   
         // The following 3 classes deliver a single instance because  
         // that is all there is today.  
         if (classEnum == CIM_OBJECTMANAGER)  
         {  
             CIMInstance instance = _buildInstanceCIMObjectManager( true, true, CIMPropertyList());  
             CIMObjectPath ref = _buildInstancePath(CIMNamespaceName(),  
                 CIM_OBJECTMANAGER_CLASSNAME, instance);  
             handler.deliver(ref);  
             handler.complete();  
             PEG_METHOD_EXIT();  
             return;             return;
         }      // Placed METHOD_ENTER trace statement after checking whether the
       // provider is initialized because this method will be called for every
       // operation through the InteropProvider, and this method is only
       // interesting the first time it is successfully run.
       PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,
           "InteropProvider::initProvider()");
  
         if (classEnum == PG_CIMXMLCOMMUNICATIONMECHANISM)      AutoMutex lock(interopMut);
       if(!providerInitialized)
         {         {
             Array<CIMInstance> instances = _buildInstancesPGCIMXMLCommunicationMechanism(true,          //
                  true, CIMPropertyList());          // Initialize the object manager instance for the CIM Server, and
           // retrieve the object manager's name property. This is retrieved once
           // and stored for use in constructing other instances requiring its
           // value.
           //
           CIMInstance objectManager = getObjectManagerInstance();
           objectManager.getProperty(objectManager.findProperty(
               OM_PROPERTY_NAME)).getValue().get(objectManagerName);
  
             for (Uint32 i = 0 ; i < instances.size() ; i++)          //
           // Determine whether the CIMOM should be gathering statistical data
           // based on the GatherStatisticalData property in the object manager.
           //
           Uint32 gatherDataIndex = objectManager.findProperty(
               OM_PROPERTY_GATHERSTATISTICALDATA);
           if(gatherDataIndex != PEG_NOT_FOUND)
             {             {
                 CIMObjectPath ref = _buildInstancePath(CIMNamespaceName(),              CIMConstProperty gatherDataProp =
                     PG_CIMXMLCOMMUNICATIONMECHANISM_CLASSNAME, instances[i]);                  objectManager.getProperty(gatherDataIndex);
                 handler.deliver(ref);              if (gatherDataProp.getType() == CIMTYPE_BOOLEAN)
             }  
             handler.complete();  
             PEG_METHOD_EXIT();  
             return;  
         }  
   
         if (classEnum == CIM_NAMESPACE)  
         {         {
             CDEBUG("Eval names, namespace");                  CIMValue gatherDataVal  = gatherDataProp.getValue();
             Array<CIMInstance> instances = _getInstancesCIMNamespace(false,                  if (!gatherDataVal.isNull())
                                     false, CIMPropertyList());  
             CDEBUG("EvalNames. Found instances. Count= " << instances.size());  
             for (Uint32 i = 0 ; i < instances.size() ; i++)  
             {             {
                 CIMObjectPath ref = _buildInstancePath(_operationNamespace,                      Boolean gatherData;
                                             CIM_NAMESPACE_CLASSNAME, instances[i]);                      gatherDataVal.get(gatherData);
                 handler.deliver(ref);                      if (gatherData == true)
                       {
                           StatisticalData* sd = StatisticalData::current();
                           sd->setCopyGSD(true);
             }             }
   
             handler.complete();  
             PEG_METHOD_EXIT();  
             return;  
         }         }
   
         // __Namespace processing.  
         CIMNamespaceName parentNamespaceName = classReference.getNameSpace();  
         PEG_TRACE_STRING(TRC_CONTROLPROVIDER, Tracer::LEVEL4,  
            "parentNamespaceName = " + parentNamespaceName.getString());  
         CDEBUG("Enumerate Instance Names. ns = " << parentNamespaceName.getString());  
   
         // Get list of all namespaces  
         Array<CIMNamespaceName> namespaceNames = _enumerateNameSpaces();  
   
         // Build the cimObjectPath for each namespace found  
         for (Uint32 i = 0; i < namespaceNames.size(); i++)  
         {  
             Array<CIMKeyBinding> keyBindings;  
             // Build the __Namespace objectpath  
             // Note that for the moment, the only property is name.  
             if (_isChild(parentNamespaceName, namespaceNames[i]))  
             {  
                 keyBindings.clear();  
                   keyBindings.append(CIMKeyBinding(NAMESPACE_PROPERTYNAME,  
                       namespaceNames[i].getString().subString  
                       (parentNamespaceName.getString().size()+1,  
                       namespaceNames[i].getString().size()-  
                       parentNamespaceName.getString().size()-1),  
                       CIMKeyBinding::STRING));  
   
                   CIMObjectPath ref(String::EMPTY, parentNamespaceName,  
                   __NAMESPACE_CLASSNAME, keyBindings);  
   
                   handler.deliver(ref);  
                   PEG_TRACE_STRING(TRC_CONTROLPROVIDER, Tracer::LEVEL4,  
                       "childNamespace = " + namespaceNames[i].getString());  
             }             }
         }         }
         handler.complete();  
  
         PEG_METHOD_EXIT();          // Cache this class definition for use later.
     }          profileCapabilitiesClass = repository->getClass(
               PEGASUS_NAMESPACENAME_INTEROP,
               PEGASUS_CLASSNAME_PG_PROVIDERPROFILECAPABILITIES,
               false,
               true,
               false);
  
           providerClassifications.append(Uint16(5)); // "Instrumentation"
  
 //**************************************************************          // initialize namespaces.
 //**************************************************************          initializeNamespaces();
 // Association Functions  
 //**************************************************************  
 //**************************************************************  
  
 void InteropProvider::associators(          // Now cache the Registration info used for ElementConformsToProfile
         const OperationContext & context,          cacheProfileRegistrationInfo();
         const CIMObjectPath & objectName,  
         const CIMName & associationClass,          providerInitialized = true;
         const CIMName & resultClass,      }
         const String & role,      PEG_METHOD_EXIT();
         const String & resultRole,  
         const Boolean includeQualifiers,  
         const Boolean includeClassOrigin,  
         const CIMPropertyList & propertyList,  
         ObjectResponseHandler & handler)  
 {  
         throw CIMNotSupportedException("AssociationProvider::associators");  
 } }
  
 void InteropProvider::associatorNames(  //
         const OperationContext & context,  // Initialize the namespaces so that all namespaces with the
         const CIMObjectPath & objectName,  // CIM_ElementConformsToProfile class also have the
         const CIMName & associationClass,  // PG_ElementConformsToProfile class. Needed in order to implement
         const CIMName & resultClass,  // the cross-namespace ElementConformsToProfile association in both
         const String & role,  // directions.
         const String & resultRole,  //
         ObjectPathResponseHandler & handler)  void InteropProvider::initializeNamespaces()
 { {
         throw CIMNotSupportedException("AssociationProvider::associatorNames");      Array<CIMNamespaceName> namespaceNames =  repository->enumerateNameSpaces();
       // get the PG_ElementConformstoProfile class without the qualifiers
       // and then add just the required ASSOCIATION qualifier, so that
       // resolveclass doesn't fail for the test/EmbeddedInstance/Dynamic
       // namespace, which uses the CIM25 schema that doesn't include any
       // of the new qualifiers added to this class in later versions of
       // the CIMSchema.
       CIMClass conformsClass = repository->getClass(
           PEGASUS_NAMESPACENAME_INTEROP,
           PEGASUS_CLASSNAME_PG_ELEMENTCONFORMSTOPROFILE,
           true,
           false);
       conformsClass.addQualifier(
           CIMQualifier(CIMName("ASSOCIATION"), CIMValue(true)));
       CIMClass profileClass = repository->getClass(
           PEGASUS_NAMESPACENAME_INTEROP,
           PEGASUS_CLASSNAME_PG_REGISTEREDPROFILE,
           true,
           false);
       for(Uint32 i = 0, n = namespaceNames.size(); i < n; ++i)
       {
           // Check if the PG_ElementConformsToProfile class is present
           CIMNamespaceName & currentNamespace = namespaceNames[i];
           CIMClass tmpCimClass;
           CIMClass tmpPgClass;
           CIMClass tmpPgProfileClass;
           try
           {
               // Look for these classes in the same try-block since the
               // second depends on the first
               tmpCimClass = repository->getClass(
                   currentNamespace,
                   PEGASUS_CLASSNAME_CIM_ELEMENTCONFORMSTOPROFILE);
               tmpPgClass = repository->getClass(
                   currentNamespace,
                   PEGASUS_CLASSNAME_PG_ELEMENTCONFORMSTOPROFILE);
 } }
           catch(const Exception &)
 void InteropProvider::references(  
         const OperationContext & context,  
         const CIMObjectPath & objectName,  
         const CIMName & resultClass,  
         const String & role,  
         const Boolean includeQualifiers,  
         const Boolean includeClassOrigin,  
         const CIMPropertyList & propertyList,  
         ObjectResponseHandler & handler)  
 { {
         throw CIMNotSupportedException("AssociationProvider::references");  
 } }
           try
 void InteropProvider::referenceNames(  
         const OperationContext & context,  
         const CIMObjectPath & objectName,  
         const CIMName & resultClass,  
         const String & role,  
         ObjectPathResponseHandler & handler)  
 { {
         throw CIMNotSupportedException("AssociationProvider::referenceNames");              tmpPgProfileClass = repository->getClass(
                   currentNamespace,
                   PEGASUS_CLASSNAME_PG_REGISTEREDPROFILE);
           }
           catch(const Exception &)
           {
               // Note: if any of the above three classes aren't found,
               // an exception will be thrown, which we can ignore since it's
               // an expected case
               // TBD: Log trace message?
           }
   
           // If the CIM_ElementConformsToProfile class is present, but
           // the PG_ElementConformsToProfile or PG_RegisteredProfile
           // class is not, then add it to that namespace.
           //
           // Note that we don't have to check for the
           // CIM_RegisteredProfile class because if the
           // CIM_ElementConformsToProfile class is present, the
           // CIM_RegisteredProfile class must also be present.
           if(!tmpCimClass.isUninitialized())
           {
               if(tmpPgClass.isUninitialized())
               {
                   CIMClass newclass = conformsClass.clone();
                   CIMObjectPath newPath = conformsClass.getPath();
                   newPath.setNameSpace(currentNamespace);
                   newclass.setPath(newPath);
                   repository->createClass(
                       currentNamespace,
                       newclass);
               }
               if(tmpPgProfileClass.isUninitialized())
               {
                   CIMClass newclass = profileClass.clone();
                   CIMObjectPath newPath = profileClass.getPath();
                   newPath.setNameSpace(currentNamespace);
                   newclass.setPath(newPath);
                   repository->createClass(
                       currentNamespace,
                       newclass);
               }
           }
       }
 } }
  
 PEGASUS_NAMESPACE_END PEGASUS_NAMESPACE_END
 // END_OF_FILE  // END OF FILE


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

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2