(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.36 and 1.57.4.5

version 1.36, 2005/05/24 10:42:51 version 1.57.4.5, 2006/03/21 19:20:25
Line 1 
Line 1 
 //%2005////////////////////////////////////////////////////////////////////////  //%2006////////////////////////////////////////////////////////////////////////
 // //
 // Copyright (c) 2000, 2001, 2002 BMC Software; Hewlett-Packard Development // Copyright (c) 2000, 2001, 2002 BMC Software; Hewlett-Packard Development
 // Company, L.P.; IBM Corp.; The Open Group; Tivoli Systems. // Company, L.P.; IBM Corp.; The Open Group; Tivoli Systems.
Line 8 
Line 8 
 // IBM Corp.; EMC Corporation; VERITAS Software Corporation; The Open Group. // IBM Corp.; EMC Corporation; VERITAS Software Corporation; The Open Group.
 // Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.; // Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.;
 // EMC Corporation; VERITAS Software Corporation; The Open Group. // EMC Corporation; VERITAS Software Corporation; The Open Group.
   // Copyright (c) 2006 Hewlett-Packard Development Company, L.P.; IBM Corp.;
   // EMC Corporation; Symantec Corporation; The Open Group.
 // //
 // Permission is hereby granted, free of charge, to any person obtaining a copy // Permission is hereby granted, free of charge, to any person obtaining a copy
 // of this software and associated documentation files (the "Software"), to // of this software and associated documentation files (the "Software"), to
Line 37 
Line 39 
 //              David Dillard, VERITAS Software Corp. //              David Dillard, VERITAS Software Corp.
 //                  (david.dillard@veritas.com) //                  (david.dillard@veritas.com)
 //              Aruran, IBM (ashanmug@in.ibm.com) for Bug# 3659 //              Aruran, IBM (ashanmug@in.ibm.com) for Bug# 3659
   //              Alex Dunfey, EMC (Dunfey_alexander@emc.com) for PEP 244
 // //
 //%//////////////////////////////////////////////////////////////////////////// //%////////////////////////////////////////////////////////////////////////////
  
Line 50 
Line 53 
 //      CIM_ObjectManagerCommunicationMechanism //      CIM_ObjectManagerCommunicationMechanism
 //      CIM_CIMXMLCommunicationMechanism //      CIM_CIMXMLCommunicationMechanism
 //      CIM_ProtocolAdapter  (Note: Removed because deprecated class in cim 2.9) //      CIM_ProtocolAdapter  (Note: Removed because deprecated class in cim 2.9)
 //      CIM_Namespace (Effective Pegasus 2.4 we use PG_Namespace which  //      CIM_Namespace -- Only creates are allowed directly against this class.
 //      is a subclass of CIM_Namespace with additional properties for  //              This allows the publice class CIM_Namespace to be used to
 //      shared namespaces.  //              create namespaces.  Modifies, deletes must use the returned
   //              paths. Enumerates references, etc. all use hiearchy.
   //              NOTE: Changes the class to PG_Namespace and returns that
   //              objectpath
   //
   //      PG_Namespace - Pegasus particular subclass of CIM_Namespace that
   //      add the parameters for shared namespaces
   //
   //      PG_CIMXMLCommunicationMechanism - Pegasus subclass of
   //      CIM_CIMXMLCommunicationMechanism that adds support for passing
   //      additional communication parameters (ie. port, https vs. http, etc.)
 // //
 //      It also services the Interop associations tied to these classes //      It also services the Interop associations tied to these classes
 //      including: //      including:
 //      CIM_NamespaceInManager //      CIM_NamespaceInManager
 //      ... //      ...
   //      Interop forces all creates to the PEGASUS_NAMESPACENAME_INTEROP
   //      namespace. There is a test on each operation that returns
   //      the Invalid Class CIMDError
 //      This is a control provider and as such uses the Tracer functions //      This is a control provider and as such uses the Tracer functions
 //      for data and function traces.  Since we do not expect high volume //      for data and function traces.  Since we do not expect high volume
 //      use we added a number of traces to help diagnostics. //      use we added a number of traces to help diagnostics.
Line 71 
Line 87 
     3. Review the key parameters on create, etc. to be sort out which are     3. Review the key parameters on create, etc. to be sort out which are
        required from user and which we can supply.  I think we are asking too        required from user and which we can supply.  I think we are asking too
        much of the user right now.        much of the user right now.
   
 */ */
  
 #include <Pegasus/Common/Config.h> #include <Pegasus/Common/Config.h>
Line 94 
Line 111 
 #include <Pegasus/Common/OperationContext.h> #include <Pegasus/Common/OperationContext.h>
 #include <Pegasus/Config/ConfigManager.h> #include <Pegasus/Config/ConfigManager.h>
 #include <Pegasus/Common/XmlWriter.h> #include <Pegasus/Common/XmlWriter.h>
 #include <Pegasus/Config/ConfigManager.h>  
 #include <Pegasus/Common/StatisticalData.h> #include <Pegasus/Common/StatisticalData.h>
 #include <Pegasus/Common/HashTable.h> #include <Pegasus/Common/HashTable.h>
   #include <Pegasus/Common/PegasusVersion.h>
  
  
 #include <stdlib.h> #include <stdlib.h>
Line 111 
Line 128 
  
 PEGASUS_USING_STD; PEGASUS_USING_STD;
  
 PEGASUS_NAMESPACE_BEGIN  
   
 #define CDEBUG(X) #define CDEBUG(X)
 #define LDEBUG() #define LDEBUG()
 //#define CDEBUG(X) PEGASUS_STD(cout) << "InteropProvider " << X << PEGASUS_STD(endl)  //#define CDEBUG(X) PEGASUS_STD(cout) << "InteropProvider (" << __LINE__ << ") " << X << PEGASUS_STD(endl)
 //#define LDEBUG(X) Logger::put (Logger::DEBUG_LOG, "InteropProvider", Logger::TRACE, "$0", X) //#define LDEBUG(X) Logger::put (Logger::DEBUG_LOG, "InteropProvider", Logger::TRACE, "$0", X)
  
 //************************************************************************** //**************************************************************************
Line 125 
Line 140 
 //************************************************************************** //**************************************************************************
  
 const char * thisProvider = "InteropProvider"; const char * thisProvider = "InteropProvider";
 // The following should be moved to somewhere like constants.  
 static const String PegasusInstanceIDGlobalPrefix = "PEG";  
   
 /**  
     The constants representing the class names we process  
 */  
 // ATTN DELETE: static const CIMName __NAMESPACE_CLASSNAME  = CIMName ("__Namespace");  
 static const CIMName CIM_NAMESPACE_CLASSNAME  = CIMName ("CIM_Namespace");  
 static const CIMName PG_NAMESPACE_CLASSNAME  = CIMName ("PG_Namespace");  
   
 static const CIMName CIM_OBJECTMANAGER_CLASSNAME  = CIMName ("CIM_ObjectManager");  
 static const CIMName CIM_OBJECTMANAGERCOMMUNICATIONMECHANISM_CLASSNAME  =  
         CIMName ("CIM_ObjectManagerCommunicationMechanism");  
 static const CIMName PG_CIMXMLCOMMUNICATIONMECHANISM_CLASSNAME  =  
         CIMName ("PG_CIMXMLCommunicationMechanism");  
 static const CIMName CIM_COMMMECHANISMFORMANAGER_CLASSNAME  =  
         CIMName ("CIM_CommMechanismForManager");  
 static const CIMName CIM_NAMESPACEINMANAGER_CLASSNAME  =  
         CIMName ("CIM_NamespaceInManager");  
   
 // 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  // This Mutex serializes access to the instance change CIM requests. Keeps from
   // mixing instance creates, modifications, and deletes. This keeps the provider
 static const CIMName CIMVALIDATED  =  // from simultaneously execute creates, modifications, and deletes of instances.
  CIMName ("CIMValidated");  // While these operations are largely protected by the locking mechanisms of the
   // repository this mutex guarantees that the provider will not simultaneously
   // execute the instance change operations.
   Mutex changeControlMutex;
   
   // Values and ValueMap qualifier names
   static const CIMName VALUES_QUALIFIERNAME("Values");
   static const CIMName VALUEMAP_QUALIFIERNAME("ValueMap");
   
   // Some Commonly shared property names
   static const CIMName COMMON_PROPERTY_NAME("Name");
   static const CIMName COMMON_PROPERTY_CREATIONCLASSNAME("CreationClassName");
   static const CIMName COMMON_PROPERTY_SYSTEMNAME("SystemName");
   static const CIMName COMMON_PROPERTY_SYSTEMCREATIONCLASSNAME(
       "SystemCreationClassName");
   static const CIMName COMMON_PROPERTY_ELEMENTNAME("ElementName");
   static const CIMName COMMON_PROPERTY_INSTANCEID("InstanceId");
  
 static const String CIMXMLProtocolVersion = "1.0"; static const String CIMXMLProtocolVersion = "1.0";
  
 // Property names for CIM_Namespace Class // Property names for CIM_Namespace Class
   #define CIM_NAMESPACE_PROPERTY_NAME  COMMON_PROPERTY_NAME
 static const CIMName CIM_NAMESPACE_PROPERTY_SYSTEMCREATIONCLASSNAME =  #define CIM_NAMESPACE_PROPERTY_CREATIONCLASSNAME \
         CIMName ("SystemCreationClassName");      COMMON_PROPERTY_CREATIONCLASSNAME
 static const CIMName CIM_NAMESPACE_PROPERTY_SYSTEMNAME =  #define CIM_NAMESPACE_PROPERTY_SYSTEMCREATIONCLASSNAME \
         CIMName ("SystemName");      COMMON_PROPERTY_SYSTEMCREATIONCLASSNAME
   #define CIM_NAMESPACE_PROPERTY_SYSTEMNAME COMMON_PROPERTY_SYSTEMNAME
 static const CIMName CIM_NAMESPACE_PROPERTY_OBJECTMANAGERCREATIONCLASSNAME = static const CIMName CIM_NAMESPACE_PROPERTY_OBJECTMANAGERCREATIONCLASSNAME =
         CIMName ("ObjectManagerCreationClassName");         CIMName ("ObjectManagerCreationClassName");
 static const CIMName CIM_NAMESPACE_PROPERTY_OBJECTMANAGERNAME = static const CIMName CIM_NAMESPACE_PROPERTY_OBJECTMANAGERNAME =
         CIMName ("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 = static const CIMName CIM_NAMESPACE_PROPERTY_CLASSINFO =
         CIMName ("ClassInfo");         CIMName ("ClassInfo");
 static const CIMName CIM_NAMESPACE_PROPERTY_DESCRIPTIONOFCLASSINFO = static const CIMName CIM_NAMESPACE_PROPERTY_DESCRIPTIONOFCLASSINFO =
         CIMName ("DescriptionOfClassInfo");         CIMName ("DescriptionOfClassInfo");
   static const CIMName CIM_NAMESPACE_PROPERTY_CLASSTYPE("ClassType");
  
 // Additional Property names for PG_Namespace Class // Additional Property names for PG_Namespace Class
  
Line 206 
Line 189 
         CIMName ("IsShareable");         CIMName ("IsShareable");
 static const CIMName PG_NAMESPACE_PROPERTY_PARENTNAMESPACE = static const CIMName PG_NAMESPACE_PROPERTY_PARENTNAMESPACE =
         CIMName ("ParentNamespace");         CIMName ("ParentNamespace");
 static const CIMName PG_NAMESPACE_PROPERTY_NAME =  #define PG_NAMESPACE_PROPERTY_NAME COMMON_PROPERTY_NAME
         CIMName ("Name");  
   // Property names for ObjectManager Class
   #define OM_PROPERTY_NAME COMMON_PROPERTY_NAME
   #define OM_PROPERTY_ELEMENTNAME COMMON_PROPERTY_ELEMENTNAME
   #define OM_PROPERTY_CREATIONCLASSNAME COMMON_PROPERTY_CREATIONCLASSNAME
   static const CIMName OM_PROPERTY_GATHERSTATISTICALDATA(
       "GatherStatisticalData");
   static const CIMName OM_PROPERTY_DESCRIPTION("Description");
   static const CIMName OM_PROPERTY_COMMUNICATIONMECHANISM(
       "CommunicationMechanism");
   static const CIMName OM_PROPERTY_FUNCTIONALPROFILESSUPPORTED(
       "FunctionalProfilesSupported");
   static const CIMName OM_PROPERTY_FUNCTIONALPROFILEDESCRIPTIONS(
       "FunctionalProfileDescriptions");
   static const CIMName OM_PROPERTY_AUTHENTICATIONMECHANISMSSUPPORTED(
       "AuthenticationMechanismsSupported");
   static const CIMName OM_PROPERTY_AUTHENTICATIONMECHANISMDESCRIPTIONS(
       "AuthenticationMechanismDescriptions");
   static const CIMName OM_PROPERTY_MULTIPLEOPERATIONSSUPPORTED(
       "MultipleOperationsSupported");
   static const CIMName OM_PROPERTY_VERSION("Version");
   static const CIMName OM_PROPERTY_OPERATIONALSTATUS("OperationalStatus");
   static const CIMName OM_PROPERTY_STARTED("Started");
  
   // Property Names for CIMXML CommunicationMechanism
   static const CIMName CIMXMLCOMMMECH_PROPERTY_CIMVALIDATED("CIMValidated");
   static const CIMName CIMXMLCOMMMECH_PROPERTY_COMMUNICATIONMECHANISM(
           "CommunicationMechanism");
   static const CIMName CIMXMLCOMMMECH_PROPERTY_FUNCTIONALPROFILESSUPPORTED(
           "FunctionalProfilesSupported");
   static const CIMName CIMXMLCOMMMECH_PROPERTY_FUNCTIONALPROFILEDESCRIPTIONS(
           "FunctionalProfileDescriptions");
   static const CIMName CIMXMLCOMMMECH_PROPERTY_AUTHENTICATIONMECHANISMSSUPPORTED(
           "AuthenticationMechanismsSupported");
   static const
   CIMName CIMXMLCOMMMECH_PROPERTY_AUTHENTICATIONMECHANISMDESCRIPTIONS(
           "AuthenticationMechanismDescriptions");
   static const CIMName CIMXMLCOMMMECH_PROPERTY_MULTIPLEOPERATIONSSUPPORTED(
           "MultipleOperationsSupported");
   static const CIMName CIMXMLCOMMMECH_PROPERTY_VERSION("Version");
   static const CIMName CIMXMLCOMMMECH_PROPERTY_NAMESPACETYPE("namespaceType");
   static const CIMName CIMXMLCOMMMECH_PROPERTY_NAMESPACEACCESSPROTOCOL(
       "namespaceAccessProtocol");
   static const CIMName CIMXMLCOMMMECH_PROPERTY_IPADDRESS("IPAddress");
   #define CIMXMLCOMMMECH_PROPERTY_ELEMENTNAME OM_PROPERTY_ELEMENTNAME
   #define CIMXMLCOMMMECH_PROPERTY_OPERATIONALSTATUS OM_PROPERTY_OPERATIONALSTATUS
   #define CIMXMLCOMMMECH_PROPERTY_NAME OM_PROPERTY_NAME
   #define CIMXMLCOMMMECH_PROPERTY_CREATIONCLASSNAME OM_PROPERTY_CREATIONCLASSNAME
   
   // Property names for RegisteredProfile
   #define REGISTEREDPROFILE_PROPERTY_INSTANCEID COMMON_PROPERTY_INSTANCEID
   static const CIMName REGISTEREDPROFILE_PROPERTY_ADVERTISETYPES(
       "AdvertiseTypes");
   static const CIMName REGISTEREDPROFILE_PROPERTY_REGISTEREDNAME(
       "RegisteredName");
   static const CIMName REGISTEREDPROFILE_PROPERTY_REGISTEREDVERSION(
       "RegisteredVersion");
   static const CIMName REGISTEREDPROFILE_PROPERTY_REGISTEREDORGANIZATION(
       "RegisteredOrganization");
   static const CIMName REGISTEREDPROFILE_PROPERTY_OTHERREGISTEREDORGANIZATION(
       "OtherRegisteredOrganization");
   
   // Property names for ElementConformsToProfile
   static const CIMName ELEMENTCONFORMSTOPROFILE_PROPERTY_CONFORMANTSTANDARD(
       "ConformantStandard");
   static const CIMName ELEMENTCONFORMSTOPROFILE_PROPERTY_MANAGEDELEMENT(
       "ManagedElement");
   
   // Property names for ProviderProfileCapabilities
   static const CIMName PROFILECAPABILITIES_PROPERTY_REGISTEREDPROFILE(
       "RegisteredProfile");
   static const CIMName PROFILECAPABILITIES_PROPERTY_REGISTEREDSUBPROFILES(
       "RegisteredSubProfiles");
   static const CIMName PROFILECAPABILITIES_PROPERTY_PROFILEVERSION(
       "ProfileVersion");
   static const CIMName PROFILECAPABILITIES_PROPERTY_OTHERREGISTEREDPROFILE(
       "OtherRegisteredProfile");
   static const CIMName PROFILECAPABILITIES_PROPERTY_OTHERREGISTEREDSUBPROFILES(
       "OtherRegisteredSubProfiles");
   static const CIMName PROFILECAPABILITIES_PROPERTY_OTHERREGISTEREDORGANIZATION(
       "OtherRegisteredOrganization");
   static const CIMName PROFILECAPABILITIES_PROPERTY_CONFORMINGELEMENTS(
       "ConformingElements");
   
   // Property names for Provider Referenced Profiles
   static const CIMName REFERENCEDPROFILES_PROPERTY_REGISTEREDPROFILES(
       "RegisteredProfiles");
   static const CIMName REFERENCEDPROFILES_PROPERTY_DEPENDENTPROFILES(
       "DependentProfiles");
   static const CIMName REFERENCEDPROFILES_PROPERTY_REGISTEREDPROFILEVERSIONS(
       "RegisteredProfileVersions");
   static const CIMName REFERENCEDPROFILES_PROPERTY_DEPENDENTPROFILEVERSIONS(
       "DependentProfileVersions");
   static const CIMName REFERENCEDPROFILES_PROPERTY_OTHERREGISTEREDPROFILES(
       "OtherRegisteredProfiles");
   static const CIMName REFERENCEDPROFILES_PROPERTY_OTHERDEPENDENTPROFILES(
       "OtherDependentProfiles");
   static const CIMName
   REFERENCEDPROFILES_PROPERTY_OTHERREGISTEREDPROFILEORGANIZATIONS(
       "OtherRegisteredProfileOrganizations");
   static const CIMName
   REFERENCEDPROFILES_PROPERTY_OTHERDEPENDENTPROFILEORGANIZATIONS(
       "OtherDependentProfileOrganizations");
   
   // Property names for ProviderModule class
   #define PROVIDERMODULE_PROPERTY_NAME  COMMON_PROPERTY_NAME
   static const CIMName PROVIDERMODULE_PROPERTY_VENDOR("Vendor");
   static const CIMName PROVIDERMODULE_PROPERTY_VERSION("Version");
   static const CIMName PROVIDERMODULE_PROPERTY_INTERFACETYPE("InterfaceType");
   static const CIMName PROVIDERMODULE_PROPERTY_MAJORVERSION("MajorVersion");
   static const CIMName PROVIDERMODULE_PROPERTY_MINORVERSION("MinorVersion");
   static const CIMName PROVIDERMODULE_PROPERTY_REVISIONNUMBER("RevisionNumber");
   static const CIMName PROVIDERMODULE_PROPERTY_BUILDNUMBER("BuildNumber");
   
   // Property names for Provider class
   #define PROVIDER_PROPERTY_NAME  COMMON_PROPERTY_NAME
   static const CIMName PROVIDER_PROPERTY_PROVIDERMODULENAME(
       "ProviderModuleName");
   
   // Property names for PG_Capabilities class
   #define CAPABILITIES_PROPERTY_PROVIDERMODULENAME \
       PROVIDER_PROPERTY_PROVIDERMODULENAME
   static const CIMName CAPABILITIES_PROPERTY_PROVIDERNAME("ProviderName");
   
   // Property names for PG_ProviderCapabilities
   #define PROVIDERCAPABILITIES_PROPERTY_PROVIDERMODULENAME \
       PROVIDER_PROPERTY_PROVIDERMODULENAME
   #define PROVIDERCAPABILITIES_PROPERTY_PROVIDERNAME \
       CAPABILITIES_PROPERTY_PROVIDERNAME
   static const CIMName PROVIDERCAPABILITIES_PROPERTY_CLASSNAME("ClassName");
   static const CIMName PROVIDERCAPABILITIES_PROPERTY_NAMESPACES("Namespaces");
   
   // Generic property names for Dependency and its subclasses
   static const CIMName PROPERTY_ANTECEDENT("Antecedent");
   static const CIMName PROPERTY_DEPENDENT("Dependent");
   
   // Property names for SoftwareIdentity
   #define SOFTWAREIDENTITY_PROPERTY_NAME  COMMON_PROPERTY_NAME
   #define SOFTWAREIDENTITY_PROPERTY_MAJORVERSION \
       PROVIDERMODULE_PROPERTY_MAJORVERSION
   #define SOFTWAREIDENTITY_PROPERTY_MINORVERSION \
       PROVIDERMODULE_PROPERTY_MINORVERSION
   #define SOFTWAREIDENTITY_PROPERTY_REVISIONNUMBER \
       PROVIDERMODULE_PROPERTY_REVISIONNUMBER
   #define SOFTWAREIDENTITY_PROPERTY_BUILDNUMBER \
       PROVIDERMODULE_PROPERTY_BUILDNUMBER
   static const CIMName SOFTWAREIDENTITY_PROPERTY_INSTANCEID("InstanceID");
   static const CIMName SOFTWAREIDENTITY_PROPERTY_VERSION("VersionString");
   static const CIMName SOFTWAREIDENTITY_PROPERTY_MANUFACTURER("Manufacturer");
   static const CIMName SOFTWAREIDENTITY_PROPERTY_CLASSIFICATIONS(
       "Classifications");
   
   // Property names for InstalledSoftwareIdentity
   static const CIMName INSTALLEDSOFTWAREIDENTITY_PROPERTY_SYSTEM("System");
   static const CIMName INSTALLEDSOFTWAREIDENTITY_PROPERTY_INSTALLEDSOFTWARE(
       "InstalledSoftware");
   
   // Implementation-specific constant strings
   static const String SNIA_NAME("SNIA");
   static const String SNIA_VER_110("1.1.0");
   static const String INTEROP_PROVIDER_NAME("Interoperability Provider");
   static const String PEGASUS_MODULE_NAME = String(PEGASUS_CIMOM_GENERIC_NAME) +
       String(" ") + String(PEGASUS_PRODUCT_NAME);
   static const String PEGASUS_INTERNAL_PROVIDER_TYPE("Internal Control Provider");
   static const String PEGASUS_DYNAMIC("__DYNAMIC_");
   static const Uint32 PEGASUS_DYNAMIC_LEN(PEGASUS_DYNAMIC.size());
   
   // Create a context container to prevent reentry into the
 // Defines to serve as the ENUM for class selection for instance // Defines to serve as the ENUM for class selection for instance
 // operations. // operations.
  
 enum targetClass{  enum TARGET_CLASS {
         //__NAMESPACE = 1,          PG_NAMESPACE,
         PG_NAMESPACE = 1,          PG_OBJECTMANAGER,
         CIM_OBJECTMANAGER = 2,          PG_CIMXMLCOMMUNICATIONMECHANISM,
         PG_CIMXMLCOMMUNICATIONMECHANISM = 3,          PG_NAMESPACEINMANAGER,
         CIM_NAMESPACEINMANAGERINST =4,          PG_COMMMECHANISMFORMANAGER,
         CIM_COMMMECHANISMFORMANAGERINST=5,          PG_REGISTEREDPROFILE,
         CIM_NAMESPACEINMANAGER=6          PG_REGISTEREDSUBPROFILE,
           PG_REFERENCEDPROFILE,
           PG_ELEMENTCONFORMSTOPROFILE,
           PG_SUBPROFILEREQUIRESPROFILE,
           PG_SOFTWAREIDENTITY,
           PG_ELEMENTSOFTWAREIDENTITY,
           PG_INSTALLEDSOFTWAREIDENTITY,
           PG_COMPUTERSYSTEM,
           PG_HOSTEDOBJECTMANAGER,
           PG_HOSTEDACCESSPOINT
     };     };
  
  enum targetAssocClass{  inline String concatPathArray(Array<CIMObjectPath>& p)
      CIM_NAMESPACEINMANAGERASSOC = 1,  {
      CIM_COMMMECHANISMFORMANAGERASSOC=2      String rtn;
  };      for (Uint32 i = 0 ; i < p.size() ; i++)
       {
           if (i > 0)
               rtn.append(" ");
           rtn.append(p[i].toString());
       }
       return(rtn);
   }
   
   inline CIMObjectPath buildInstancePath(const CIMClass & cimClass,
                                   const String & hostName,
                                   const CIMNamespaceName & nameSpace,
                                   const CIMInstance & instance)
   {
       CIMObjectPath objPath = instance.buildPath(cimClass);
       objPath.setHost(hostName);
       objPath.setNameSpace(nameSpace);
       return objPath;
   }
  
   template <class RetClass>
   RetClass getRequiredValue(const CIMInstance & instance,
                             const CIMName & propName)
   {
       RetClass retVal;
       Uint32 index = instance.findProperty(propName);
       if(index == PEG_NOT_FOUND)
       {
           throw CIMOperationFailedException("Instance " +
               instance.getPath().toString() +
               " missing expected property " + propName.getString());
       }
       const CIMValue & tmpVal = instance.getProperty(index).getValue();
       if(tmpVal.isNull())
       {
           throw CIMOperationFailedException("Instance " +
               instance.getPath().toString() +
               " has unexpected NULL value for property " + propName.getString());
       }
   
       tmpVal.get(retVal);
   
       return retVal;
   }
  
 //************************************************************* //*************************************************************
 //  Constructor //  Constructor
 //********************************************************** //**********************************************************
 InteropProvider::InteropProvider(CIMRepository* repository)  InteropProvider::InteropProvider(CIMRepository * rep) : repository(rep),
       hostName(System::getHostName()), namespacesInitialized(false)
 { {
     PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,"InteropProvider::InteropProvider");     PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,"InteropProvider::InteropProvider");
      _repository = repository;  
  
     //***********************************************      // Initialize the object manager
     // This is a tempory fix untill there is a method created for the InteropProvider to      CIMInstance objectManager = getObjectManagerInstance();
     // do it's inaliaztion work. This fix sets StatisticalData::CopyGSD, enabling the      objectManager.getProperty(objectManager.findProperty(
     //statistical gathering function.          OM_PROPERTY_NAME)).getValue().get(objectManagerName);
     Array<CIMInstance> instance = repository->enumerateInstances(CIMNamespaceName("root/cimv2"), CIMName ("CIM_ObjectManager"));  
       Uint32 gatherDataIndex = objectManager.findProperty(
           OM_PROPERTY_GATHERSTATISTICALDATA);
       if(gatherDataIndex != PEG_NOT_FOUND)
       {
           CIMConstProperty gatherDataProp =
               objectManager.getProperty(gatherDataIndex);
           if (gatherDataProp.getType() == CIMTYPE_BOOLEAN)
           {
               CIMValue gatherDataVal  = gatherDataProp.getValue();
               if (!gatherDataVal.isNull())
               {
                   Boolean gatherData;
                   gatherDataVal.get(gatherData);
                   if (gatherData == true)
                   {
                       StatisticalData* sd = StatisticalData::current();
                       sd->setCopyGSD(true);
                   }
               }
           }
       }
  
     if(instance.size() > 0)      profileCapabilitiesClass = repository->getClass(
           PEGASUS_NAMESPACENAME_INTEROP,
           PEGASUS_CLASSNAME_PG_PROVIDERPROFILECAPABILITIES, false, true, false);
       providerClassifications.append(Uint16(5)); // "Instrumentation"
   
       // Initialize the namespaces so that all namespaces with the
       // CIM_elementConformsToProfile class also have the
       // PG_elementConformsToProfile class
       if(!namespacesInitialized)
       {
           Array<CIMNamespaceName> namespaceNames =
               repository->enumerateNameSpaces();
           CIMClass conformsClass = repository->getClass(
               PEGASUS_NAMESPACENAME_INTEROP,
               PEGASUS_CLASSNAME_PG_ELEMENTCONFORMSTOPROFILE);
           CIMClass profileClass = repository->getClass(
               PEGASUS_NAMESPACENAME_INTEROP,
               PEGASUS_CLASSNAME_PG_REGISTEREDPROFILE);
           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
     {     {
         Boolean output = false;                  // Look for these classes in the same try-block since the
         Uint32 pos;                  // second depends on the first
         if ((pos = instance[0].findProperty(CIMName("GatherStatisticalData"))) != PEG_NOT_FOUND)                  tmpCimClass = repository->getClass(currentNamespace,
                       PEGASUS_CLASSNAME_CIM_ELEMENTCONFORMSTOPROFILE);
                   tmpPgClass = repository->getClass(currentNamespace,
                       PEGASUS_CLASSNAME_PG_ELEMENTCONFORMSTOPROFILE);
               }
               catch(...)
         {         {
             CIMConstProperty p1 = instance[0].getProperty(pos);              }
             if (p1.getType() == CIMTYPE_BOOLEAN)              try
             {             {
                 CIMValue v1  = p1.getValue();                  tmpPgProfileClass = repository->getClass(currentNamespace,
                 if (!v1.isNull())                      PEGASUS_CLASSNAME_PG_REGISTEREDPROFILE);
               }
               catch(...)
                 {                 {
                     v1.get(output);                  // Note: if any of the above three classes aren't found,
                     if (v1 == true)                  // 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())
                     {                     {
                         StatisticalData* sd = StatisticalData::current();                  if(tmpPgClass.isUninitialized())
                         sd->setCopyGSD(true);                  {
                       CIMObjectPath newPath = conformsClass.getPath();
                       newPath.setNameSpace(currentNamespace);
                       conformsClass.setPath(newPath);
                       repository->createClass(currentNamespace,
                           conformsClass);
                     }                     }
                   if(tmpPgProfileClass.isUninitialized())
                   {
                       CIMObjectPath newPath = conformsClass.getPath();
                       newPath.setNameSpace(currentNamespace);
                       conformsClass.setPath(newPath);
                       repository->createClass(currentNamespace,
                           profileClass);
                 }                 }
             }             }
         }         }
   
           namespacesInitialized = true;
     }     }
     //******************************************* end of temporary fix  
       // Now cache the Registration info used for ElementConformsToProfile assoc
       cacheProfileRegistrationInfo();
     PEG_METHOD_EXIT();     PEG_METHOD_EXIT();
  }  }
  
   
   
 //*************************************************************** //***************************************************************
 // Provider Utility Functions // Provider Utility Functions
 //*************************************************************** //***************************************************************
  
 String _showBool(Boolean x)  inline String boolToString(Boolean x)
 { {
     return(x? "true" : "false");     return(x? "true" : "false");
 } }
  
 static String _toStringPropertyList(const CIMPropertyList& pl)  inline String propertyListToString(const CIMPropertyList& pl)
 { {
       if(pl.isNull())
           return "NULL";
       else if(pl.size() == 0)
           return "EMPTY";
   
     String tmp;     String tmp;
     for (Uint32 i = 0; i < pl.size() ; i++)     for (Uint32 i = 0; i < pl.size() ; i++)
     {     {
Line 288 
Line 574 
             tmp.append(", ");             tmp.append(", ");
         tmp.append(pl[i].getString());         tmp.append(pl[i].getString());
     }     }
     return(tmp);      return tmp;
 } }
  
 static String _showPropertyList(const CIMPropertyList& pl)  /** Determines if the namespace is allowable for this operation.
       This provider is designed to accept either all namespaces or
       limit itself to just one for operations.  In all cases, it
       will provide the required answers and use the correct namespace
       for any persistent information.  However, it may be configured
       to either accept input operations from any namespace or simply
       from one (normally the interop namespace).
       @ objectReference for the operation.  This must include the
       namespace and class name for the operation.
       @return Returns normally if the namespace test is passed. Otherwise
       it generates a CIMException (CIM_ERR_NOT_SUPPORTED)
       @exception CIMException(CIM_ERR_NOT_SUPPORTED)
   */
   bool namespaceSupported(const CIMObjectPath & path)
 { {
     if (pl.isNull())      // To allow use of all namespaces, uncomment the following line
         return("NULL");      // return;
       if(path.getNameSpace().getString() == PEGASUS_NAMESPACENAME_INTEROP)
         return true;
  
     String tmp;      throw CIMNotSupportedException(path.getClassName().getString() +
         " in namespace " + path.getNameSpace().getString());
   
       return false;
   }
   
   /* complete the instance by setting the complete path into the instance
      and executing the instance filter to set the qualifiers, classorigin and
      propertylist in accordance with the input.  Note that this can only remove
      characteristics, except for the path completion so that it expects instances
      with qualifiers included, class origin included and a complete property
      list.
   */
   void normalizeInstance(CIMInstance& instance, const CIMObjectPath& path,
                          Boolean includeQualifiers, Boolean includeClassOrigin,
                          const CIMPropertyList& propertyList)
   {
       CIMObjectPath p = instance.getPath();
       p.setHost(path.getHost());
       p.setNameSpace(path.getNameSpace());
  
     tmp.append((pl.size() == 0) ? "Empty" : _toStringPropertyList(pl));      instance.setPath(p);
     return(tmp);      instance.filter(includeQualifiers,
                       includeClassOrigin,
                       propertyList );
 } }
  
 /** get one string property from an instance. Note that these functions simply /** get one string property from an instance. Note that these functions simply
Line 308 
Line 630 
     error indication.     error indication.
     @param instance CIMInstance from which we get property value     @param instance CIMInstance from which we get property value
     @param propertyName String name of the property containing the value     @param propertyName String name of the property containing the value
     @param default String optional parameter that is substituted if the property does      @param default String optional parameter that is substituted if the property
     not exist, is Null, or is not a string type. The substitute is String::EMPTY      does not exist, is Null, or is not a string type. The substitute is
       String::EMPTY
     @return String value found or defaultValue.     @return String value found or defaultValue.
 */ */
 String _getPropertyValue(const CIMInstance& instance, const CIMName& propertyName, const String& defaultValue)  String getPropertyValue(const CIMInstance& instance,
       const CIMName& propertyName, const String& defaultValue)
 { {
     String output = defaultValue;     String output = defaultValue;
     Uint32 pos;      Uint32 pos = instance.findProperty(propertyName);
     if ((pos = instance.findProperty(propertyName)) != PEG_NOT_FOUND)      if(pos != PEG_NOT_FOUND)
     {     {
         CIMConstProperty p1 = instance.getProperty(pos);         CIMConstProperty p1 = instance.getProperty(pos);
         if (p1.getType() == CIMTYPE_STRING)         if (p1.getType() == CIMTYPE_STRING)
Line 326 
Line 650 
             if (!v1.isNull())             if (!v1.isNull())
                 v1.get(output);                 v1.get(output);
         }         }
           else
           {
               throw CIMInvalidParameterException(
                   "Incorrect Property Type for Property " +
                   propertyName.getString());
           }
     }     }
     return(output);  
       return output;
 } }
  
 // Overload of _getPropertyValue for boolean type  // Overload of getPropertyValue for boolean type
 Boolean _getPropertyValue(const CIMInstance& instance, const CIMName& propertyName, const Boolean defaultValue)  Boolean getPropertyValue(const CIMInstance& instance,
       const CIMName& propertyName, const Boolean defaultValue)
 { {
     Boolean output = defaultValue;     Boolean output = defaultValue;
     Uint32 pos;      Uint32 pos = instance.findProperty(propertyName);
     if ((pos = instance.findProperty(propertyName)) != PEG_NOT_FOUND)      if(pos != PEG_NOT_FOUND)
     {     {
         CIMConstProperty p1 = instance.getProperty(pos);         CIMConstProperty p1 = instance.getProperty(pos);
         if (p1.getType() == CIMTYPE_BOOLEAN)         if (p1.getType() == CIMTYPE_BOOLEAN)
Line 345 
Line 677 
             if (!v1.isNull())             if (!v1.isNull())
                 v1.get(output);                 v1.get(output);
         }         }
           else
           {
               throw CIMInvalidParameterException(
                   "Incorrect Property Type for Property " +
                   propertyName.getString());
           }
     }     }
     return(output);     return(output);
 } }
Line 354 
Line 692 
     If everything fails, gets the definition normally     If everything fails, gets the definition normally
     used for localhost (127.0.0.1).     used for localhost (127.0.0.1).
  
     @param hostName String with the name of the host      @param hostName String with the name of the host. Allows
     @return String with the IP address to be used      String:EMPTY and in that case, gets it directly from system.
     NOTE: This code should not be in slpprovider. This      @param namespaceType - Uint32 representing the
     should be in the Interop classes but for the moment      access protocol for this request.  This is exactly
     it is not.      the definition in the PG_CIMXMLCommunicationMechanism
       mof for the property namespaceAccessProtocol.
       @param port String defining the port to be used.  If
       String::EMPTY, it is not valid and the defaultPortNumber
       is to be inserted.
       @param defaultPortNumber Uint32 defining a default port
       number to be used if port string is not provided.
       @return String with the IP address to be used. This must
       be the complete address sufficient to access the
       IP address. Therefore, it includes the port number.
 */ */
 String _getHostAddress(String hostName)  String getHostAddress(const String & hostName, Uint32 namespaceType,
       const String & port, Uint32 defaultPortNumber)
 { {
   String ipAddress;   String ipAddress;
   
   if (hostName == String::EMPTY)   if (hostName == String::EMPTY)
         hostName = System::getHostName();        ipAddress = System::getHostIP(System::getHostName());
     else
         ipAddress = System::getHostIP(hostName);
  
   if ((ipAddress = System::getHostIP(hostName)) == String::EMPTY)    if(ipAddress == String::EMPTY)
   {   {
       // set default address if everything else failed       // set default address if everything else failed
       ipAddress = String("127.0.0.1");       ipAddress = String("127.0.0.1");
   }   }
   return ipAddress;  
 }  
  
  Array<String> _getFunctionalProfiles(Array<Uint16> & profiles)    // Question: is there a case where we leave off the port number.
     // Code to get the property service_location_tcp ( which is equivalent to
     // "IP address:5988")
   
     // if port is valid port number, we use it.  Else use
     // the default portnumber provided.
     // One or the other MUST not be zero.
     ipAddress.append(":");
     if(port == String::EMPTY)
     {
         // convert portNumber to ascii
         char buffer[32];
         sprintf(buffer, "%u", defaultPortNumber);
         ipAddress.append(buffer);
     }
     else
  {  {
      Array<String> profileDescriptions;        ipAddress.append(port);
      profiles.append(2); profileDescriptions.append("Basic Read");  
      profiles.append(3); profileDescriptions.append("Basic Write");  
      profiles.append(4); profileDescriptions.append("Schema Manipulation");  
      profiles.append(5); profileDescriptions.append("Instance Manipulation");  
      profiles.append(6); profileDescriptions.append("Association Traversal");  
      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    return ipAddress;
     This can be either the default PEG or if the environment  }
     variable PEGASUS_TRADEMARK_PREFIX is defined this is used.   /** Fills in the CIMOperation functional profiles and corresponding description
     NOTE: getting from the environment variable is a hack until       array.  This function is closely linked to compile and configuration
     we can come up with a better source.       features in the CIM Server to determine if certain features are
     @return String containing the unique name for the CIMOM ID       enabled and/or compiled.  Definitions correspond to the DMTF SLP template
        version 1.0.
        @param Array<Uint16> profiles provides an array for the profiles
        @return Array<String> with the corresponding profile text descriptions
 */ */
    Array<String> getFunctionalProfiles(Array<Uint16> & profiles)
 String getTrademarkCIMOMIDPrefix()  
 { {
        Array<String> profileDescriptions;
        // Note that zero and 1 are unknown and other. Not used by us
        // 2 - 5 are not optional in Pegasus
        profiles.append(2);
        profileDescriptions.append("Basic Read");
  
     char * trademark;       profiles.append(3);
     trademark = getenv("PEGASUS_TRADEMARK_PREFIX");       profileDescriptions.append("Basic Write");
     return((trademark)? trademark : PegasusInstanceIDGlobalPrefix);  
 }       profiles.append(4);
 /** Builds the UUID string for this CIMOM.       profileDescriptions.append("Schema Manipulation");
 **/  
 String getUUIDString()       profiles.append(5);
        profileDescriptions.append("Instance Manipulation");
   
        ConfigManager* configManager = ConfigManager::getInstance();
        if (String::equal(configManager->getCurrentValue(
            "enableAssociationTraversal"), "true"))
 { {
     return(Guid::getGuid());           profiles.append(6);
            profileDescriptions.append("Association Traversal");
 } }
   #ifndef PEGASUS_DISABLE_EXECQUERY
        profiles.append(7);
        profileDescriptions.append("Query Execution");
   #endif
        profiles.append(8);
        profileDescriptions.append("Qualifier Declaration");
  
 /* Test the keys in the CIM_Namespace for valid values       if (String::equal(configManager->getCurrentValue(
    This includes all of the keys above the name key.           "enableIndicationService"), "true"))
    THis is a dummy for now.  
    ATTN: KS Extend and finish this function.  
 */  
 Boolean _validateProperties(const CIMObjectPath& path)  
 { {
     return true;           profiles.append(9);
            profileDescriptions.append("Indications");
 } }
  
 Boolean _validateProperties(const CIMInstance& instance)       return(profileDescriptions);
 {  
     return true;  
 } }
  
 /* Validate that the property exists, is string type and /* Validate that the property exists, is string type and
Line 434 
Line 802 
    value in the property    value in the property
    @return True if passes all tests    @return True if passes all tests
 */ */
 Boolean _validateRequiredProperty(const CIMInstance& instance,  Boolean validateRequiredProperty(const CIMInstance& instance,
                           const CIMName& propertyName,      const CIMName& propertyName, const String& value)
                           const String& value)  
 { {
     PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,     PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,
             "InteropProvider::_validateRequiredProperty()");             "InteropProvider::_validateRequiredProperty()");
     Uint32 pos;      Uint32 pos = instance.findProperty (propertyName);
  
     if ((pos = instance.findProperty (propertyName)) == PEG_NOT_FOUND)      if(pos == PEG_NOT_FOUND)
     {     {
         PEG_METHOD_EXIT();         PEG_METHOD_EXIT();
         return(false);          return false;
     }     }
     //     //
     //  Get the property     //  Get the property
Line 472 
Line 839 
     return(false);     return(false);
 } }
  
 Boolean _validateRequiredProperty(const CIMInstance& instance,  
   Boolean validateRequiredProperty(const CIMInstance& instance,
                           const CIMName& propertyName,                           const CIMName& propertyName,
                           const Uint16& value)                           const Uint16& value)
 { {
Line 506 
Line 874 
     return(true);     return(true);
 } }
  
 Boolean _validateRequiredProperty(const CIMObjectPath& objectPath,  Boolean validateRequiredProperty(const CIMObjectPath& objectPath,
                           const CIMName& propertyName,                           const CIMName& propertyName,
                           const String value)                           const String value)
 { {
Line 533 
Line 901 
     return(true);     return(true);
 } }
  
 /* Query the repository for array of all namespacenames  /* Verify that this is one of the legal classnames for instance operations and
    @return Array<CIMNamespaceName> with all namespaces     return an indicator as to which one it is.
    @exception Passes all exception that repository may generate.     @param - Classname
      @return - Uint32 indicating type
      @Exceptions - throws CIMNotSupportedException if invalid class.
 */ */
 Array<CIMNamespaceName> InteropProvider::_enumerateNameSpaces()  TARGET_CLASS translateClassInput(const CIMName& className)
 { {
     PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,     PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,
             "InteropProvider::_enumerateNameSpaces()");              "InteropProvider::translateClassInput");
       if(className.equal(PEGASUS_CLASSNAME_PG_OBJECTMANAGER))
           return PG_OBJECTMANAGER;
  
     Array<CIMNamespaceName> namespaceNames;      else if(className.equal(PEGASUS_CLASSNAME_PG_CIMXMLCOMMUNICATIONMECHANISM))
           return PG_CIMXMLCOMMUNICATIONMECHANISM;
  
     namespaceNames = _repository->enumerateNameSpaces();      else if(className.equal(PEGASUS_CLASSNAME_PG_NAMESPACEINMANAGER))
           return PG_NAMESPACEINMANAGER;
  
     PEG_METHOD_EXIT();      else if(className.equal(PEGASUS_CLASSNAME_PG_COMMMECHANISMFORMANAGER))
     return(namespaceNames);          return PG_COMMMECHANISMFORMANAGER;
 }  
  
 /* get a class defintion. Gets the class defined by      else if(className.equal(PEGASUS_CLASSNAME_PG_REGISTEREDPROFILE))
     the parameters. Generates exception of class not defined.          return PG_REGISTEREDPROFILE;
    @param namespace in which to look for the class.  
    @param name of class to get.  
    @return the CIMClass object  
    @Exceptions any repository exceptions if class not found.  
 */  
 CIMClass InteropProvider::_getClass(const CIMNamespaceName& nameSpace,  
                                     const CIMName& className)  
 {  
     PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,  
             "InteropProvider::_getClass");  
  
     CIMClass myClass = _repository->getClass(nameSpace, className,      else if(className.equal(PEGASUS_CLASSNAME_PG_REGISTEREDSUBPROFILE))
                             false,true,true);          return PG_REGISTEREDSUBPROFILE;
     PEG_METHOD_EXIT();  
     return myClass;  
 }  
  
 /* Verify that this is one of the legal classnames and      else if(className.equal(PEGASUS_CLASSNAME_PG_REFERENCEDPROFILE))
    return indicator which.          return PG_REFERENCEDPROFILE;
    @param - Classname  
    @return - Uint32 indicating type  
    @Exceptions - throws CIMNotSupportedException if invalid class.  
 */  
 static targetClass _verifyValidClassInput(const CIMName& className)  
 {  
     PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,  
             "InteropProvider::_verifyValidClassInput");  
     if (className.equal(CIM_OBJECTMANAGER_CLASSNAME))  
         return CIM_OBJECTMANAGER;  
  
     if (className.equal(PG_CIMXMLCOMMUNICATIONMECHANISM_CLASSNAME))      else if(className.equal(PEGASUS_CLASSNAME_PG_ELEMENTCONFORMSTOPROFILE))
         return PG_CIMXMLCOMMUNICATIONMECHANISM;          return PG_ELEMENTCONFORMSTOPROFILE;
   
       else if(className.equal(PEGASUS_CLASSNAME_PG_SUBPROFILEREQUIRESPROFILE))
           return PG_SUBPROFILEREQUIRESPROFILE;
   
       else if(className.equal(PEGASUS_CLASSNAME_PG_SOFTWAREIDENTITY))
           return PG_SOFTWAREIDENTITY;
   
       else if(className.equal(PEGASUS_CLASSNAME_PG_ELEMENTSOFTWAREIDENTITY))
           return PG_ELEMENTSOFTWAREIDENTITY;
  
     if (className.equal(CIM_NAMESPACEINMANAGER_CLASSNAME))      else if(className.equal(PEGASUS_CLASSNAME_PG_INSTALLEDSOFTWAREIDENTITY))
         return CIM_NAMESPACEINMANAGER;          return PG_INSTALLEDSOFTWAREIDENTITY;
   
       else if(className.equal(PEGASUS_CLASSNAME_PG_COMPUTERSYSTEM))
           return PG_COMPUTERSYSTEM;
   
       else if(className.equal(PEGASUS_CLASSNAME_PG_HOSTEDOBJECTMANAGER))
           return PG_HOSTEDOBJECTMANAGER;
   
       else if(className.equal(PEGASUS_CLASSNAME_PG_HOSTEDACCESSPOINT))
           return PG_HOSTEDACCESSPOINT;
  
     // Last entry, reverse test and return OK if PG_Namespace     // Last entry, reverse test and return OK if PG_Namespace
     // Note: Changed to PG_Namespace for CIM 2.4     // Note: Changed to PG_Namespace for CIM 2.4
     if (!className.equal(PG_NAMESPACE_CLASSNAME))      else if(!className.equal(PEGASUS_CLASSNAME_PG_NAMESPACE))
         throw CIMNotSupportedException         throw CIMNotSupportedException
             (className.getString() + " not supported by Interop Provider");             (className.getString() + " not supported by Interop Provider");
  
Line 598 
Line 966 
     return PG_NAMESPACE;     return PG_NAMESPACE;
 } }
  
 static targetAssocClass _verifyValidAssocClassInput(const CIMName& className)  TARGET_CLASS translateAssocClassInput(const CIMName& className)
 { {
     PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,     PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,
             "InteropProvider::_verifyValidAssocClassInput");              "InteropProvider::translateAssocClassInput");
     if (className.equal(CIM_NAMESPACEINMANAGER_CLASSNAME))  
         return CIM_NAMESPACEINMANAGERASSOC;  
  
     // Last entry, reverse test and return OK if CIM_CommMech....      if(className.equal(PEGASUS_CLASSNAME_PG_NAMESPACEINMANAGER))
     if (!className.equal(CIM_COMMMECHANISMFORMANAGER_CLASSNAME))          return PG_NAMESPACEINMANAGER;
         throw CIMNotSupportedException  
             (className.getString() + " not supported by Interop Provider");      else if(className.equal(PEGASUS_CLASSNAME_PG_COMMMECHANISMFORMANAGER))
           return PG_COMMMECHANISMFORMANAGER;
   
       else if(className.equal(PEGASUS_CLASSNAME_PG_REFERENCEDPROFILE))
           return PG_REFERENCEDPROFILE;
   
       else if(className.equal(PEGASUS_CLASSNAME_PG_ELEMENTCONFORMSTOPROFILE))
           return PG_ELEMENTCONFORMSTOPROFILE;
   
       else if(className.equal(PEGASUS_CLASSNAME_PG_ELEMENTSOFTWAREIDENTITY))
           return PG_ELEMENTSOFTWAREIDENTITY;
   
       // Last entry, reverse test and return OK if PG_SubProfileRequiresProfile
       else if(!className.equal(PEGASUS_CLASSNAME_PG_SUBPROFILEREQUIRESPROFILE))
       {
           throw CIMNotSupportedException(className.getString() +
             " not supported by association operations in the Interop Provider");
       }
  
     PEG_METHOD_EXIT();     PEG_METHOD_EXIT();
     return CIM_COMMMECHANISMFORMANAGERASSOC;      return PG_SUBPROFILEREQUIRESPROFILE;
 } }
  
 /* validate the authorization of the user name against the namespace.  
   /*
    * Retrieves the user ID from the operation context.
 */ */
 String _validateUserID(const OperationContext & context)  String retrieveUserID(const OperationContext & context)
 { {
     PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,     PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,
             "InteropProvider::_validateUserID");             "InteropProvider::_validateUserID");
     //ATTN-DME-P3-20020522: ADD AUTHORIZATION CHECK TO __NAMESPACE PROVIDER  
     String userName;     String userName;
     try     try
     {     {
         IdentityContainer container = context.get(IdentityContainer::NAME);         IdentityContainer container = context.get(IdentityContainer::NAME);
         userName = container.getUserName();         userName = container.getUserName();
     }     }
   
     catch (...)     catch (...)
     {     {
        userName = String::EMPTY;        userName = String::EMPTY;
Line 637 
Line 1020 
     return userName;     return userName;
 } }
  
 /** Set the value of a property defined by property name in the instance provided.  /** 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.     Sets a String into the value field unless the property name cannot be found.
     If the property cannot be found, it simply returns.     If the property cannot be found, it simply returns.
     ATTN: This function does not pass an error back if property not found.     ATTN: This function does not pass an error back if property not found.
Line 646 
Line 1030 
     @param value String value to set into property     @param value String value to set into property
  
 */ */
 void _setPropertyValue(CIMInstance& instance, const CIMName propertyName, const String& value)  void setPropertyValue(CIMInstance& instance, const CIMName& propertyName,
 {      const CIMValue & value)
     Uint32 pos;  
     if ((pos = instance.findProperty(propertyName)) != PEG_NOT_FOUND)  
         instance.getProperty(pos).setValue(CIMValue(value));  
 }  
   
 void _setPropertyValue(CIMInstance& instance, const CIMName propertyName, const Boolean& value)  
 {  
     Uint32 pos;  
     if ((pos = instance.findProperty(propertyName)) != PEG_NOT_FOUND)  
         instance.getProperty(pos).setValue(CIMValue(value));  
 }  
   
 void _setPropertyValue(CIMInstance& instance, const CIMName propertyName, const Uint16& value)  
 {  
     Uint32 pos;  
     if ((pos = instance.findProperty(propertyName)) != PEG_NOT_FOUND)  
         instance.getProperty(pos).setValue(CIMValue(value));  
 }  
   
 void _setPropertyValue(CIMInstance& instance, const CIMName propertyName, const Array<String>& value)  
 {  
     Uint32 pos;  
     if ((pos = instance.findProperty(propertyName)) != PEG_NOT_FOUND)  
         instance.getProperty(pos).setValue(CIMValue(value));  
 }  
   
 void _setPropertyValue(CIMInstance& instance, const CIMName propertyName, const Array<Uint16>& value)  
 {  
     Uint32 pos;  
     if ((pos = instance.findProperty(propertyName)) != PEG_NOT_FOUND)  
         instance.getProperty(pos).setValue(CIMValue(value));  
 }  
   
 void _setPropertyValue(CIMInstance& instance, const CIMName propertyName, const CIMObjectPath& value)  
 { {
     Uint32 pos;      Uint32 pos = instance.findProperty(propertyName);
     if ((pos = instance.findProperty(propertyName)) != PEG_NOT_FOUND)      if(pos != PEG_NOT_FOUND)
         instance.getProperty(pos).setValue(CIMValue(value));          instance.getProperty(pos).setValue(value);
 } }
  
 /** add the correct values to the common keys defined for all of the classes. This is  /** add the correct values to the common keys defined for all of the classes.
     systemcreationclassname and systemname      This is systemcreationclassname and systemname
     Note that if the properties do not exist, we simply ignore them.     Note that if the properties do not exist, we simply ignore them.
 */ */
 void _fixInstanceCommonKeys(CIMInstance& instance)  void fixInstanceCommonKeys(CIMInstance& instance)
 { {
     PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,     PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,
             "InteropProvider::_fixInstanceCommonKeys()");             "InteropProvider::_fixInstanceCommonKeys()");
     String SystemCreationClassName = System::getSystemCreationClassName ();  
  
     _setPropertyValue(instance, CIM_NAMESPACE_PROPERTY_SYSTEMCREATIONCLASSNAME,SystemCreationClassName);      setPropertyValue(instance, COMMON_PROPERTY_SYSTEMCREATIONCLASSNAME,
               PEGASUS_CLASSNAME_PG_COMPUTERSYSTEM.getString());
  
     // Add property SystemName     // Add property SystemName
       setPropertyValue(instance, COMMON_PROPERTY_SYSTEMNAME,
     _setPropertyValue(instance, CIM_NAMESPACE_PROPERTY_SYSTEMNAME,System::getFullyQualifiedHostName());              System::getFullyQualifiedHostName());
     PEG_METHOD_EXIT();     PEG_METHOD_EXIT();
 } }
  
 /** builds one instance of the class named className. Gets Class defintion and f  /** builds one instance of the class named className. Gets Class defintion and
     fills in the correct properties from the class.  This requires a repository     fills in the correct properties from the class.  This requires a repository
     getclass request for each instance built. The skeleton is built by     getclass request for each instance built. The skeleton is built by
     creating the instance and copying qualifiers and properties from     creating the instance and copying qualifiers and properties from
Line 718 
Line 1068 
     @return CIMInstance of this class with properties complete.     @return CIMInstance of this class with properties complete.
     @exception passes on any exceptions received from the repository request.     @exception passes on any exceptions received from the repository request.
 */ */
 CIMInstance InteropProvider::_buildInstanceSkeleton(const CIMName& className)  CIMInstance InteropProvider::buildInstanceSkeleton(
         const CIMNamespaceName & nameSpace,
         const CIMName& className,
         CIMClass& returnedClass)
 { {
     PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,     PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,
             "InteropProvider::_buildInstanceSkeleton()");             "InteropProvider::_buildInstanceSkeleton()");
     CIMClass myClass;      // get class with lo = false, qualifier = true classorig = true
       returnedClass = repository->getClass(nameSpace,
     CIMInstance skeleton(className);          className, false, true, true);
         myClass = _repository->getClass(_operationNamespace, className, false, true, true);      CIMInstance skeleton = returnedClass.buildInstance(true,true,
           CIMPropertyList());
     // 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();     PEG_METHOD_EXIT();
     return(skeleton.clone());      return skeleton;
 } }
  
 /* build a single instance of the cimxmlcommunicationmechanism class /* build a single instance of the cimxmlcommunicationmechanism class
    using the parameter provided as the name property     using the parameter provided as the name property.
      Builds the complete instance and sets the path into it.
    @parm name String representing the name to be used for this object.    @parm name String representing the name to be used for this object.
    @return CIMInstance of the class    @return CIMInstance of the class
 */ */
 CIMInstance InteropProvider::_buildInstancePGCIMXMLCommunicationMechanism(  CIMInstance InteropProvider::buildCIMXMLCommunicationMechanismInstance(
                                             const String& namespaceType,                                             const String& namespaceType,
               const Uint16& accessProtocol,
                                             const String& IPAddress,                                             const String& IPAddress,
                                             const Boolean& includeQualifiers,              const CIMClass & targetClass)
                                             const Boolean& includeClassOrigin,  
                                             const CIMPropertyList& propertyList)  
 { {
     PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,     PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,
             "InteropProvider::_buildInstancePGCIMXMLCommunicationMechanism()");              "InteropProvider::buildCIMXMLCommunicationMechanismInstance()");
       CIMInstance instance = targetClass.buildInstance(false, false,
     CIMInstance instance = _buildInstanceSkeleton(PG_CIMXMLCOMMUNICATIONMECHANISM_CLASSNAME);          CIMPropertyList());
  
     _fixInstanceCommonKeys(instance);      fixInstanceCommonKeys(instance);
  
     //CreationClassName     //CreationClassName
     _setPropertyValue(instance, CIM_NAMESPACE_PROPERTY_CREATIONCLASSNAME,PG_CIMXMLCOMMUNICATIONMECHANISM_CLASSNAME.getString());      setPropertyValue(instance, CIMXMLCOMMMECH_PROPERTY_CREATIONCLASSNAME,
               PEGASUS_CLASSNAME_PG_CIMXMLCOMMUNICATIONMECHANISM.getString());
  
     //Name, this CommunicationMechanism.  We need to make it unique.  To do this     //Name, this CommunicationMechanism.  We need to make it unique.  To do this
     // we simply append the commtype to the classname since we have max of two right      // we simply append the commtype to the classname since we have max of two
     // now.      // right now.
     _setPropertyValue(instance, CIM_NAMESPACE_PROPERTY_NAME, (String("PEGASUSCOMM") + namespaceType));      setPropertyValue(instance, CIMXMLCOMMMECH_PROPERTY_NAME,
               (String("PEGASUSCOMM") + namespaceType));
  
     // CommunicationMechanism Property - Force to 2.     // CommunicationMechanism Property - Force to 2.
     _setPropertyValue(instance, OM_COMMUNICATIONMECHANISM, Uint16(2));      setPropertyValue(instance, CIMXMLCOMMMECH_PROPERTY_COMMUNICATIONMECHANISM,
           Uint16(2));
  
     //Functional Profiles Supported Property.     //Functional Profiles Supported Property.
     Array<Uint16> profiles;     Array<Uint16> profiles;
     Array<String> profileDescriptions = _getFunctionalProfiles(profiles);      Array<String> profileDescriptions = getFunctionalProfiles(profiles);
  
     // Set functional profiles in instance     // Set functional profiles in instance
     _setPropertyValue(instance, OM_FUNCTIONALPROFILESSUPPORTED, profiles);      setPropertyValue(instance,
           CIMXMLCOMMMECH_PROPERTY_FUNCTIONALPROFILESSUPPORTED, profiles);
  
     _setPropertyValue(instance, OM_FUNCTIONALPROFILEDESCRIPTIONS, profileDescriptions);      setPropertyValue(instance,
           CIMXMLCOMMMECH_PROPERTY_FUNCTIONALPROFILEDESCRIPTIONS,
           profileDescriptions);
  
     // Multiple OperationsSupported Property     // Multiple OperationsSupported Property
     _setPropertyValue(instance, OM_MULTIPLEOPERATIONSSUPPORTED, false);      setPropertyValue(instance,
           CIMXMLCOMMMECH_PROPERTY_MULTIPLEOPERATIONSSUPPORTED, false);
  
     // AuthenticationMechanismsSupported Property     // AuthenticationMechanismsSupported Property
     Array<Uint16> authentications;     Array<Uint16> authentications;
     Array<String> authenticationDescriptions;     Array<String> authenticationDescriptions;
  
     // Note that we have fixed authentication here.      //TODO - get from system.
     authentications.append(3); authenticationDescriptions.append("Basic");      authentications.append(3);
       //authenticationDescriptions.append("Basic");
   
       setPropertyValue(instance,
           CIMXMLCOMMMECH_PROPERTY_AUTHENTICATIONMECHANISMSSUPPORTED,
           authentications);
   
       setPropertyValue(instance,
           CIMXMLCOMMMECH_PROPERTY_AUTHENTICATIONMECHANISMDESCRIPTIONS,
           authenticationDescriptions);
  
     _setPropertyValue(instance, OM_AUTHENTICATIONMECHANISMSSUPPORTED, authentications);      setPropertyValue(instance, CIMXMLCOMMMECH_PROPERTY_VERSION,
           CIMXMLProtocolVersion);
  
     _setPropertyValue(instance, OM_AUTHENTICATIONMECHANISMDESCRIPTIONS, authenticationDescriptions);      // Obsolete function
       setPropertyValue(instance, CIMXMLCOMMMECH_PROPERTY_NAMESPACETYPE,
           namespaceType);
  
     _setPropertyValue(instance, OM_VERSION, CIMXMLProtocolVersion);      setPropertyValue(instance, CIMXMLCOMMMECH_PROPERTY_NAMESPACEACCESSPROTOCOL,
           accessProtocol);
  
     // Obsolete function      setPropertyValue(instance, CIMXMLCOMMMECH_PROPERTY_IPADDRESS,
     _setPropertyValue(instance, "namespaceType", namespaceType);          IPAddress);
  
     _setPropertyValue(instance, "IPAddress", IPAddress);      setPropertyValue(instance, CIMXMLCOMMMECH_PROPERTY_ELEMENTNAME,
           String("Pegasus CIMXML Communication Mechanism"));
   
       setPropertyValue(instance, CIMXMLCOMMMECH_PROPERTY_CIMVALIDATED,
           Boolean(false));
   
       Array<Uint16> opStatus;
       opStatus.append(2); // "OK"
       setPropertyValue(instance, CIMXMLCOMMMECH_PROPERTY_OPERATIONALSTATUS,
           opStatus);
   
       // build the instance path and set into instance
       CIMObjectPath objPath = instance.buildPath(targetClass);
       objPath.setNameSpace(PEGASUS_NAMESPACENAME_INTEROP);
       objPath.setHost(hostName);
       instance.setPath(objPath);
  
     PEG_METHOD_EXIT();     PEG_METHOD_EXIT();
     return(instance);      return instance;
 } }
  
 Array<CIMInstance> InteropProvider::_buildInstancesPGCIMXMLCommunicationMechanism(  Array<CIMInstance> InteropProvider::enumCIMXMLCommunicationMechanismInstances()
                                             const Boolean includeQualifiers,  
                                             const Boolean includeClassOrigin,  
                                             const CIMPropertyList& propertyList)  
 { {
     PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,     PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,
             "InteropProvider::_buildInstancesPGCIMXMLCommunicationMechanism");              "InteropProvider::enumCIMXMLCommunicationMechanismInstances");
  
     // This is a temporary hack to get the multiple connections.  
     ConfigManager* configManager = ConfigManager::getInstance();     ConfigManager* configManager = ConfigManager::getInstance();
     Boolean enableHttpConnection = String::equal(     Boolean enableHttpConnection = String::equal(
         configManager->getCurrentValue("enableHttpConnection"), "true");         configManager->getCurrentValue("enableHttpConnection"), "true");
     Boolean enableHttpsConnection = String::equal(     Boolean enableHttpsConnection = String::equal(
         configManager->getCurrentValue("enableHttpsConnection"), "true");         configManager->getCurrentValue("enableHttpsConnection"), "true");
  
     String IPAddress = _getHostAddress(System::getHostName());  
     Array<CIMInstance> instances;     Array<CIMInstance> instances;
       Uint32 namespaceAccessProtocol;
       String namespaceType;
  
       CIMClass commMechClass = repository->getClass(
               PEGASUS_NAMESPACENAME_INTEROP,
               PEGASUS_CLASSNAME_PG_CIMXMLCOMMUNICATIONMECHANISM, false, true,
               false);
     if (enableHttpConnection)     if (enableHttpConnection)
     {     {
         CDEBUG("building pgcimxmlinstances 1");          namespaceAccessProtocol = 2;
         CIMInstance instance = _buildInstancePGCIMXMLCommunicationMechanism(          namespaceType = "http";
                             "http", IPAddress,          Uint32 portNumberHttp;
                             includeQualifiers,          String httpPort = configManager->getCurrentValue("httpPort");
                             includeClassOrigin,          if (httpPort == String::EMPTY)
                             propertyList);          {
               portNumberHttp = System::lookupPort(WBEM_HTTP_SERVICE_NAME,
                   WBEM_DEFAULT_HTTP_PORT);
           }
           CIMInstance instance =
               buildCIMXMLCommunicationMechanismInstance(
                   namespaceType,
                   namespaceAccessProtocol,
                   getHostAddress(hostName, namespaceAccessProtocol, httpPort,
                       portNumberHttp), commMechClass);
         instances.append(instance);         instances.append(instance);
     }     }
  
     if (enableHttpsConnection)     if (enableHttpsConnection)
     {     {
         CDEBUG("building pgcimxmlinstances 2");          namespaceAccessProtocol = 3;
         CIMInstance instance = _buildInstancePGCIMXMLCommunicationMechanism(          namespaceType = "https";
                                                 "https", IPAddress,          Uint32 portNumberHttps;
                                                 includeQualifiers,          String httpsPort = configManager->getCurrentValue("httpsPort");
                                                 includeClassOrigin,          if (httpsPort == String::EMPTY)
                                                 propertyList);          {
               portNumberHttps = System::lookupPort(WBEM_HTTPS_SERVICE_NAME,
                   WBEM_DEFAULT_HTTPS_PORT);
           }
           CIMInstance instance =
               buildCIMXMLCommunicationMechanismInstance(
                   namespaceType,
                   namespaceAccessProtocol,
                   getHostAddress(hostName, namespaceAccessProtocol, httpsPort,
                       portNumberHttps), commMechClass);
   
         instances.append(instance);         instances.append(instance);
     }     }
   
   
     PEG_METHOD_EXIT();     PEG_METHOD_EXIT();
     return(instances);      return instances;
 }  
 /*  Gets the value for the CIMObjectManager name.  This is a key  
     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());  
 }  
   
 /** get either the local or disk CIMObjectmanager instance.  
     @return Boolean true if already exists. False if  
     not initialized. Also returns with the current version set  
     into local parameter.  
     ATTN: Probably should get rid of the local parameter since  
     this is used so infrequently, waste of space.  
 */  
 Boolean InteropProvider::_getInstanceFromRepositoryCIMObjectManager(  
                         CIMInstance& rtnInstance,  
                         const Boolean includeQualifiers,  
                         const Boolean includeClassOrigin,  
                         const CIMPropertyList& propertyList)  
 {  
     PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,  
             "InteropProvider::_getInstanceCIMObjectManager");  
     // Try to get persistent instance from repository  
     Array<CIMInstance> instances;  
     try  
     {  
         instances = _repository->enumerateInstances(_operationNamespace,  
                       CIM_OBJECTMANAGER_CLASSNAME, true, false, includeQualifiers,  
                         includeClassOrigin, propertyList);  
   
         CDEBUG("_getInstancefrom... " << instances.size());  
         if (instances.size() >= 1)  
         {  
             // set this instance into global variable.  
             rtnInstance = instances[0];  
   
             // log entry if there is more than one instance.  
             // Some day we may support multiple entries to see other CIMOMs but  
             // for now this should be illegal and represent an internal error.  
             // but we will still continue to use the first entry.  
             if (instances.size() > 1)  
             {  
                 Logger::put(Logger::ERROR_LOG, System::CIMSERVER, Logger::INFORMATION,  
                     "Error. Multiple definitons of : $0", CIM_OBJECTMANAGER_CLASSNAME.getString());  
             }  
             CDEBUG("getInstanceFromRepository returning true");  
             return(true);  
         }  
         else  
         {  
             CDEBUG("getInstanceFromRepository returning false");  
             return(false);  
         }  
     }  
     catch(const CIMException&)  
     {  
         Logger::put(Logger::ERROR_LOG, System::CIMSERVER, Logger::INFORMATION,  
             "Error. Cannot access $0 in repository", CIM_OBJECTMANAGER_CLASSNAME.getString());  
         PEG_METHOD_EXIT();  
         throw;  
     }  
     catch(const Exception&)  
     {  
         Logger::put(Logger::ERROR_LOG, System::CIMSERVER, Logger::INFORMATION,  
             "Error. Cannot access $0 in repository", CIM_OBJECTMANAGER_CLASSNAME.getString());  
         PEG_METHOD_EXIT();  
         throw;  
     }  
 } }
  
 /** build an instance of the CIM_ObjectManager class filling out  /** get an instance of the CIM_ObjectManager class filling out
     the required properties if one does not already exist in the     the required properties if one does not already exist in the
     repository. This function will either return an instance     repository. This function will either return an instance
     or throw an exception.     or throw an exception.
Line 934 
Line 1260 
     @exception repository instances if exception to enumerateInstances     @exception repository instances if exception to enumerateInstances
         for this class.         for this class.
 */ */
 CIMInstance InteropProvider::_getInstanceCIMObjectManager(  CIMInstance InteropProvider::getObjectManagerInstance()
                         const Boolean includeQualifiers,  
                         const Boolean includeClassOrigin,  
                         const CIMPropertyList& propertyList)  
 { {
     PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,     PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,
             "InteropProvider::_buildInstanceCIMObjectManager");              "InteropProvider::getObjectManagerInstance");
  
     // Try to get the current object.  If true then it is already created.     // Try to get the current object.  If true then it is already created.
     CIMInstance instance;     CIMInstance instance;
     if (!_getInstanceFromRepositoryCIMObjectManager(instance, includeQualifiers,includeClassOrigin,propertyList))      bool found = false;
       // If a real object path is not specified (only the class and
       // and namespace are present), then we can enumerate and pick
       // the first instance (if any) and then set found to true
       Array<CIMInstance> tmpInstances = repository->enumerateInstances(
           PEGASUS_NAMESPACENAME_INTEROP,
           PEGASUS_CLASSNAME_PG_OBJECTMANAGER, true, false, false, false,
           CIMPropertyList());
       Uint32 numInstances = tmpInstances.size();
       if(numInstances == 1)
       {
           instance = tmpInstances[0];
       }
       PEGASUS_ASSERT(numInstances <= 1);
   
   
       if(instance.isUninitialized())
     {     {
         //         //
         // No instance in the repository. Build new instance and save it.         // No instance in the repository. Build new instance and save it.
         //         //
         CDEBUG("Creating New instance of CIMOBjectManager");          CIMClass omClass;
         instance = _buildInstanceSkeleton(CIM_OBJECTMANAGER_CLASSNAME);          instance = buildInstanceSkeleton(PEGASUS_NAMESPACENAME_INTEROP,
               PEGASUS_CLASSNAME_PG_OBJECTMANAGER, omClass);
         _fixInstanceCommonKeys(instance);  
           fixInstanceCommonKeys(instance);
         _setPropertyValue(instance, CIM_NAMESPACE_PROPERTY_CREATIONCLASSNAME,CIM_OBJECTMANAGER_CLASSNAME.getString());  
         _setPropertyValue(instance, CIM_NAMESPACE_PROPERTY_NAME,buildObjectManagerName());          setPropertyValue(instance, OM_PROPERTY_CREATIONCLASSNAME,
         _setPropertyValue(instance, CIMName("ElementName"), String("Pegasus"));              PEGASUS_CLASSNAME_PG_OBJECTMANAGER.getString());
           setPropertyValue(instance, OM_PROPERTY_NAME,
               String(PEGASUS_INSTANCEID_GLOBAL_PREFIX) + ":" + Guid::getGuid());
           setPropertyValue(instance, OM_PROPERTY_ELEMENTNAME, String("Pegasus"));
           Array<Uint16> operationalStatus;
           operationalStatus.append(2);
           setPropertyValue(instance, OM_PROPERTY_OPERATIONALSTATUS,
               operationalStatus);
           setPropertyValue(instance, OM_PROPERTY_STARTED,
               CIMValue(Boolean(true)));
  
         //         //
         //Description property this object manager instance         //Description property this object manager instance
         // default is Pegasus CIM_Server Version.          // default is Pegasus CIM_Server Version. Get from
         // Provided undocumented option to get this from the environment.          // fields defined in PegasusVersion.
         // This should probably be removed or documented.          // TODO. Add as an alternative the capability to get this
         //          // from config parameters.
         String description;          // If PEGASUS_CIMOM_DESCRIPTION is non-zero length, use it.
         char * envDescription;          // Otherwise build form the components below.
         envDescription = getenv("PEGASUS_CIMOM_DESCRIPTION");          String descriptionStatus;
           String pegasusProductStatus(PEGASUS_PRODUCT_STATUS);
         description = (envDescription) ? envDescription :          if(pegasusProductStatus.size() > 0)
               descriptionStatus = " " + pegasusProductStatus;
   
           String description = (String(PEGASUS_CIMOM_DESCRIPTION).size() != 0) ?
                   String(PEGASUS_CIMOM_DESCRIPTION)
               :
                   String(PEGASUS_CIMOM_GENERIC_NAME) + " " +
             String(PEGASUS_PRODUCT_NAME) + " Version " +             String(PEGASUS_PRODUCT_NAME) + " Version " +
                 String(PEGASUS_PRODUCT_VERSION);                  String(PEGASUS_PRODUCT_VERSION) +
                   descriptionStatus;
  
         _setPropertyValue(instance, CIMName("Description"), description);          setPropertyValue(instance, OM_PROPERTY_DESCRIPTION, description);
  
         //Property GatherStatisticalData. Initially this is set to false         //Property GatherStatisticalData. Initially this is set to false
         // and can then be modified by a modify instance on the instance.         // and can then be modified by a modify instance on the instance.
  
         Boolean gatherStatDataFlag = false;         Boolean gatherStatDataFlag = false;
  
         _setPropertyValue(instance, OM_GATHERSTATISTICALDATA, Boolean(gatherStatDataFlag));          setPropertyValue(instance, OM_PROPERTY_GATHERSTATISTICALDATA,
               Boolean(gatherStatDataFlag));
  
         // ATTN: This one is a problem KS rethink this.          // Set the statistics property into the Statisticaldata class so that
         // the following is a temporary hack to set the value of the statistics          // it can perform statistics gathering if necessary.
         // gathering function dynamically.  We simply get the correct value  
         // and call the internal method to set it each time this object is  
         // built.  
     #ifndef PEGASUS_DISABLE_PERFINST     #ifndef PEGASUS_DISABLE_PERFINST
         StatisticalData* sd = StatisticalData::current();         StatisticalData* sd = StatisticalData::current();
         sd->setCopyGSD(gatherStatDataFlag);         sd->setCopyGSD(gatherStatDataFlag);
Line 993 
Line 1346 
  
         // write instance to the repository         // write instance to the repository
         CIMObjectPath instancePath;         CIMObjectPath instancePath;
         // Add the instance path to this if necessary ATTN ATTN:  
         try          instancePath = repository->createInstance(
         {              PEGASUS_NAMESPACENAME_INTEROP, instance);
             CDEBUG("Create Instance for CIM_ObjectManager");  
             instancePath = _repository->createInstance(_operationNamespace,  
                            instance );  
         }  
         catch(const CIMException&)  
         {  
             // ATTN: KS generate log error if this not possible  
             PEG_METHOD_EXIT();  
             throw;  
         }  
         catch(const Exception&)  
         {  
             // ATTN: Generate log error.  
             PEG_METHOD_EXIT();  
             throw;  
         }  
         instance.setPath(instancePath);         instance.setPath(instancePath);
     }     }
     instance.filter(includeQualifiers, includeClassOrigin, propertyList);  
       CIMObjectPath currentPath = instance.getPath();
       currentPath.setHost(hostName);
       currentPath.setNameSpace(PEGASUS_NAMESPACENAME_INTEROP);
       instance.setPath(currentPath);
     PEG_METHOD_EXIT();     PEG_METHOD_EXIT();
     return(instance);      return instance;
 } }
  
 /** Get the instances of CIM_Namespace. Gets all instances of the namespace from  /** get an instance of the PG_ComputerSystem class produced by the
     the repository namespace management functions      ComputerSystem provider in the root/cimv2 namespace.
     Pegasus 2.4 - This now gets CIM_Namespace and its subclass PG_Namespace      This function will either return an instance
 */      or throw an exception.
 Array<CIMInstance> InteropProvider::_getInstancesCIMNamespace(const Boolean& includeQualifiers,      @param includeQualifiers Boolean
                             const Boolean& includeClassOrigin,      @param includeClassOrigin Boolean
                             const CIMPropertyList& propertyList)      @param propertylist CIMPropertyList
 {      @return CIMInstance with a single built instance of the class
     PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,      @exception ObjectNotFound exception if a ComputerSystem instance cannot
             "InteropProvider::_getInstancesCIMNamespace()");          be retrieved.
   */
   CIMInstance InteropProvider::getComputerSystemInstance()
   {
       PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,
               "InteropProvider::getComputerSystemInstance");
  
     CDEBUG("_getinstancesPGNamespace");      // Try to get the current object.  If true then it is already created.
     Array<CIMNamespaceName> namespaceNames = _enumerateNameSpaces();      CIMInstance instance;
     CDEBUG("_getInstancesCIMNamespace. count = " << namespaceNames.size());  
     Array<CIMInstance> instanceArray;  
  
     // We build instances of PG namespace since that is the leaf class      // If a real object path is not specified (only the class and
     for (Uint32 i = 0; i < namespaceNames.size(); i++)      // and namespace are present), then we can enumerate and pick
       // the first instance (if any) and then set found to true
       AutoMutex mut(interopMut);
       Array<CIMInstance> tmpInstances = cimomHandle.enumerateInstances(
           OperationContext(),
           PEGASUS_NAMESPACENAME_CIMV2,
           PEGASUS_CLASSNAME_PG_COMPUTERSYSTEM, true, false, false, false,
           CIMPropertyList());
       Uint32 numInstances = tmpInstances.size();
       PEGASUS_ASSERT(numInstances <= 1);
       if(numInstances > 0)
     {     {
        instanceArray.append( _buildInstancePGNamespace(namespaceNames[i]));          instance = tmpInstances[0];
           CIMObjectPath tmpPath = instance.getPath();
           tmpPath.setHost(hostName);
           tmpPath.setNameSpace(PEGASUS_NAMESPACENAME_INTEROP);
           instance.setPath(tmpPath);
       }
   
       if(instance.isUninitialized())
       {
           PEG_METHOD_EXIT();
           throw PEGASUS_CIM_EXCEPTION (CIM_ERR_NOT_FOUND,
               "Could not find ComputerSystem instance");
     }     }
     CDEBUG("Build this many PG_Namespace Instances. count= " << instanceArray.size());  
     PEG_METHOD_EXIT();     PEG_METHOD_EXIT();
     return(instanceArray);      return instance;
 } }
  
 /** get the instance of namespace defined by the input parameter which is the object path  /** get an instance of the PG_HostedObjectManager class produced by the
     for the instance required.      ComputerSystem provider in the root/cimv2 namespace.
     ATTN: Note that this is incorrect. We are supplying the namespace name and need to supply      This function will either return an instance
     the objectpath      or throw an exception.
     @param TBD      @param includeQualifiers Boolean
     @return CIMInstance with the found instance or CIMInstance() if nothing found.      @param includeClassOrigin Boolean
       @param propertylist CIMPropertyList
       @return CIMInstance with a single built instance of the class
       @exception ObjectNotFound exception if a ComputerSystem instance cannot
           be retrieved.
 */ */
 CIMInstance InteropProvider::_getInstanceCIMNamespace(const CIMNamespaceName & nameSpace)  CIMInstance InteropProvider::getHostedObjectManagerInstance()
 { {
     PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,     PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,
             "InteropProvider::_getInstancesCIMNamespace()");              "InteropProvider::getHostedObjectManagerInstance");
   
       // Try to get the current object.  If true then it is already created.
       CIMInstance instance;
       bool found = false;
  
     Array<CIMInstance> instances = _getInstancesCIMNamespace(true, true, CIMPropertyList());      CIMObjectPath csPath = getComputerSystemInstance().getPath();
       CIMObjectPath omPath = getObjectManagerInstance().getPath();
       String csPathString = csPath.toString();
       String omPathString = omPath.toString();
   
       CIMClass hostedOMClass = repository->getClass(
           PEGASUS_NAMESPACENAME_INTEROP,
           PEGASUS_CLASSNAME_PG_HOSTEDOBJECTMANAGER,
           false, true, false);
   
       instance = hostedOMClass.buildInstance(false, false, CIMPropertyList());
   
       setPropertyValue(instance, PROPERTY_ANTECEDENT,
           CIMValue(csPath));
       setPropertyValue(instance, PROPERTY_DEPENDENT,
           CIMValue(omPath));
   
       instance.setPath(instance.buildPath(hostedOMClass));
  
     // search the instances for one with the name property value = input parameter.  
     for (Uint32 i = 0 ; i < instances.size() ; i++)  
     {  
         if (_getPropertyValue(instances[i], CIMName("name"), String::EMPTY) == nameSpace.getString())  
         {  
             PEG_METHOD_EXIT();             PEG_METHOD_EXIT();
             return(instances[i]);      return instance;
         }         }
   
   Array<CIMInstance> InteropProvider::enumHostedAccessPointInstances()
   {
       PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,
               "InteropProvider::enumHostedAccessPointInstance");
       Array<CIMInstance> instances;
   
       CIMObjectPath csPath = getComputerSystemInstance().getPath();
       Array<CIMInstance> commMechs = enumCIMXMLCommunicationMechanismInstances();
       CIMClass hapClass = repository->getClass(PEGASUS_NAMESPACENAME_INTEROP,
           PEGASUS_CLASSNAME_PG_HOSTEDACCESSPOINT, false, true, false);
       for(Uint32 i = 0, n = commMechs.size(); i < n; ++i)
       {
           CIMInstance & currentCommMech = commMechs[i];
           CIMInstance hapInstance = hapClass.buildInstance(false, false,
               CIMPropertyList());
           setPropertyValue(hapInstance, PROPERTY_ANTECEDENT, csPath);
           setPropertyValue(hapInstance, PROPERTY_DEPENDENT,
               currentCommMech.getPath());
           hapInstance.setPath(hapInstance.buildPath(hapClass));
           instances.append(hapInstance);
     }     }
   
     PEG_METHOD_EXIT();     PEG_METHOD_EXIT();
     CIMInstance nullInstance;      return instances;
     return(nullInstance);  
 } }
  
 CIMObjectPath InteropProvider::_buildReference(const CIMInstance& instance, const CIMName& className)  /** Get the instances of CIM_Namespace. Gets all instances of the namespace from
       the repository namespace management functions. Builds instances that
       match all of the request attributes.
   */
   Array<CIMInstance> InteropProvider::enumNamespaceInstances()
   {
       PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,
               "InteropProvider::_getInstancesCIMNamespace()");
   
       Array<CIMNamespaceName> namespaceNames = repository->enumerateNameSpaces();
       Array<CIMInstance> instanceArray;
   
       // Build instances of PG namespace since that is the leaf class
       for (Uint32 i = 0, n = namespaceNames.size(); i < n; i++)
 { {
     return(_buildObjectPath(_operationNamespace,className, instance));         instanceArray.append(
              buildNamespaceInstance(namespaceNames[i].getString()));
       }
   
       PEG_METHOD_EXIT();
       return instanceArray;
 } }
  
 Array<CIMInstance> InteropProvider::_buildInstancesNamespaceInManager()  /* build the full instances set of of the association class NamespacInManager.
   
       NOTE: THe input object path is not really use at this point.
   */
   Array<CIMInstance> InteropProvider::enumNamespaceInManagerInstances()
 { {
     PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,     PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,
             "InteropProvider::_buildInstancesNamespaceInManager");              "InteropProvider::buildInstancesNamespaceInManager");
  
     Array<CIMInstance> namespaceInstances = _getInstancesCIMNamespace(false,      Array<CIMInstance> namespaceInstances = enumNamespaceInstances();
                             false, CIMPropertyList());  
   
     CIMInstance instanceObjMgr = _getInstanceCIMObjectManager( true, true, CIMPropertyList());  
  
     CIMObjectPath refObjMgr = _buildReference(instanceObjMgr, CIM_OBJECTMANAGER_CLASSNAME);      CIMObjectPath objectManagerPath = getObjectManagerInstance().getPath();
  
     Array<CIMInstance> assocInstances;     Array<CIMInstance> assocInstances;
       CIMClass targetClass;
  
       CIMInstance instanceskel = buildInstanceSkeleton(
           PEGASUS_NAMESPACENAME_INTEROP,
           PEGASUS_CLASSNAME_PG_NAMESPACEINMANAGER, targetClass);
       // Build and instance for each namespace instance.
     for (Uint32 i = 0 ; i < namespaceInstances.size() ; i++)     for (Uint32 i = 0 ; i < namespaceInstances.size() ; i++)
     {     {
         CIMInstance instance = _buildInstanceSkeleton(CIM_NAMESPACEINMANAGER_CLASSNAME);          CIMInstance instance = instanceskel.clone();
           setPropertyValue(instance, PROPERTY_ANTECEDENT, objectManagerPath);
         _setPropertyValue(instance, CIMName("Antecedent"), refObjMgr);          setPropertyValue(instance, PROPERTY_DEPENDENT,
         //ATTNATTN: this is weak qualifier.              namespaceInstances[i].getPath());
         _setPropertyValue(instance, CIMName("Dependent"), _buildReference(namespaceInstances[i],  
                                                             CIM_NAMESPACEINMANAGER_CLASSNAME));          CIMObjectPath objPath = instance.buildPath(targetClass);
           objPath.setHost(hostName);
           objPath.setNameSpace(PEGASUS_NAMESPACENAME_INTEROP);
           instance.setPath(objPath);
         assocInstances.append(instance);         assocInstances.append(instance);
     }     }
   
     PEG_METHOD_EXIT();     PEG_METHOD_EXIT();
     return(assocInstances);      return assocInstances;
 } }
   /* build the instances of the defined association.
 Array<CIMInstance> InteropProvider::_buildInstancesCommMechanismForManager()  */
   Array<CIMInstance> InteropProvider::enumCommMechanismForManagerInstances()
 { {
     PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,     PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,
             "InteropProvider::_buildInstancesCommMechanismForManager");              "InteropProvider::enumCommMechanismForManagerInstances");
  
     Array<CIMInstance> commInstances = _buildInstancesPGCIMXMLCommunicationMechanism(true,      Array<CIMInstance> commInstances =
          true, CIMPropertyList());          enumCIMXMLCommunicationMechanismInstances();
  
     CIMInstance instanceObjMgr = _getInstanceCIMObjectManager( true, true, CIMPropertyList());      CIMInstance instanceObjMgr = getObjectManagerInstance();
  
     CIMObjectPath refObjMgr = _buildReference(instanceObjMgr, CIM_OBJECTMANAGER_CLASSNAME);      CIMObjectPath refObjMgr = instanceObjMgr.getPath();
     Array<CIMInstance> assocInstances;  
  
     for (Uint32 i = 0 ; i < commInstances.size() ; i++)      Array<CIMInstance> assocInstances;
       CIMClass targetClass;
       CIMInstance instanceskel = buildInstanceSkeleton(
           PEGASUS_NAMESPACENAME_INTEROP,
           PEGASUS_CLASSNAME_PG_COMMMECHANISMFORMANAGER, targetClass);
       for (Uint32 i = 0, n = commInstances.size(); i < n; ++i)
     {     {
           CIMInstance instance = instanceskel.clone();
  
         CIMInstance instance = _buildInstanceSkeleton(CIM_COMMMECHANISMFORMANAGER_CLASSNAME);          setPropertyValue(instance, PROPERTY_ANTECEDENT, refObjMgr);
  
         _setPropertyValue(instance,CIMName("Antecedent"), refObjMgr);          setPropertyValue(instance, PROPERTY_DEPENDENT,
         //ATTNATTN: this is weak qualifier.            commInstances[i].getPath());
         _setPropertyValue(instance,CIMName("Dependent"), _buildReference(commInstances[i],CIM_COMMMECHANISMFORMANAGER_CLASSNAME));  
           instance.setPath(instance.buildPath(targetClass));
         assocInstances.append(instance);         assocInstances.append(instance);
     }     }
  
Line 1142 
Line 1581 
    @exceptions - exceptions carried forward from create instance    @exceptions - exceptions carried forward from create instance
    and addProperty.    and addProperty.
 */ */
 CIMInstance InteropProvider::_buildInstancePGNamespace(const CIMNamespaceName & nameSpace)  CIMInstance InteropProvider::buildNamespaceInstance(
       const String & nameSpace)
 { {
     PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,     PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,
             "InteropProvider::_buildInstancePGNamespace");              "InteropProvider::buildInstancePGNamespace");
   
     // 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(PG_NAMESPACE_CLASSNAME);      CIMClass targetClass;
       CIMInstance instance = buildInstanceSkeleton(
           PEGASUS_NAMESPACENAME_INTEROP, PEGASUS_CLASSNAME_PG_NAMESPACE,
           targetClass);
  
     _fixInstanceCommonKeys(instance);      fixInstanceCommonKeys(instance);
  
     //ObjectManagerCreationClassName     //ObjectManagerCreationClassName
     _setPropertyValue(instance, CIM_NAMESPACE_PROPERTY_OBJECTMANAGERCREATIONCLASSNAME, CIM_OBJECTMANAGER_CLASSNAME.getString());      setPropertyValue(instance,
           CIM_NAMESPACE_PROPERTY_OBJECTMANAGERCREATIONCLASSNAME,
           PEGASUS_CLASSNAME_PG_OBJECTMANAGER.getString());
  
     //ObjectManagerName     //ObjectManagerName
     _setPropertyValue(instance, CIM_NAMESPACE_PROPERTY_OBJECTMANAGERNAME, ObjectManagerName);      setPropertyValue(instance, CIM_NAMESPACE_PROPERTY_OBJECTMANAGERNAME,
           objectManagerName);
  
     //CreationClassName     //CreationClassName
     // Class in which this was created,     // Class in which this was created,
     _setPropertyValue(instance, CIM_NAMESPACE_PROPERTY_CREATIONCLASSNAME, CIM_NAMESPACE_CLASSNAME.getString());      setPropertyValue(instance, CIM_NAMESPACE_PROPERTY_CREATIONCLASSNAME,
           PEGASUS_CLASSNAME_PG_NAMESPACE.getString());
     //Name     //Name
     // This is the namespace name itself     // This is the namespace name itself
     _setPropertyValue(instance, CIM_NAMESPACE_PROPERTY_NAME, nameSpace.getString());      setPropertyValue(instance, CIM_NAMESPACE_PROPERTY_NAME,
           nameSpace);
  
     //ClassInfo     //ClassInfo
     // Set the classinfo to unknown and the description to namespace.     // Set the classinfo to unknown and the description to namespace.
     _setPropertyValue(instance, CIM_NAMESPACE_PROPERTY_CLASSINFO, Uint16(0));      setPropertyValue(instance, CIM_NAMESPACE_PROPERTY_CLASSINFO, Uint16(0));
     _setPropertyValue(instance, CIM_NAMESPACE_PROPERTY_DESCRIPTIONOFCLASSINFO, String("namespace"));      setPropertyValue(instance, CIM_NAMESPACE_PROPERTY_DESCRIPTIONOFCLASSINFO,
           String("namespace"));
   
       setPropertyValue(instance, CIM_NAMESPACE_PROPERTY_CLASSTYPE,
           Uint16(2));
   
   
  
     //     //
     //  Everything above was commmon to CIM Namespace.  The following is PG_Namespace Properties      //  Everything above was commmon to CIM Namespace.  The following is
       //  PG_Namespace Properties
     //     //
     // ATTN: KS Get the correct values for these entities from repository interface.      // ATTN: KS Get the correct values for these entities from repository
       //       interface.
  
     CIMRepository::NameSpaceAttributes attributes;     CIMRepository::NameSpaceAttributes attributes;
     _repository->getNameSpaceAttributes(nameSpace.getString(), attributes);      repository->getNameSpaceAttributes(nameSpace, attributes);
     String parent="";      String parent = String::EMPTY;
         String name = "";      String name = String::EMPTY;
     Boolean shareable=false;     Boolean shareable=false;
     Boolean updatesAllowed=true;     Boolean updatesAllowed=true;
     for (CIMRepository::NameSpaceAttributes::Iterator i = attributes.start(); i; i++)      for (CIMRepository::NameSpaceAttributes::Iterator i = attributes.start();
           i; i++)
     {     {
        String key=i.key();        String key=i.key();
        String value = i.value();        String value = i.value();
   
        if (String::equalNoCase(key,"shareable"))        if (String::equalNoCase(key,"shareable"))
            {            {
           if (String::equalNoCase(value,"true"))           if (String::equalNoCase(value,"true"))
Line 1204 
Line 1654 
        // Test to be sure we are returning proper namespace name        // Test to be sure we are returning proper namespace name
        else if (String::equalNoCase(key,"name"))        else if (String::equalNoCase(key,"name"))
        {        {
           if (!String::equalNoCase(value, nameSpace.getString()))              if (!String::equalNoCase(value, nameSpace))
           {           {
               PEG_METHOD_EXIT();               PEG_METHOD_EXIT();
               // This is poor exception since it reflects internal error. Do error log                  // This is poor exception since it reflects internal error. Do
               throw PEGASUS_CIM_EXCEPTION (CIM_ERR_NOT_SUPPORTED,                  // error log
                   "Namespace attribute rtnd error for key " + key + "expected " +                  throw CIMNotSupportedException(
                    nameSpace.getString()+ value + " in " + String(thisProvider));                      "Namespace attribute rtnd error for key " + key +
                       "expected " + nameSpace + value + " in " +
                       String(thisProvider));
           }           }
  
                   name = value;                   name = value;
Line 1222 
Line 1674 
        else        else
        {        {
           PEG_METHOD_EXIT();           PEG_METHOD_EXIT();
           // Poor error definition since it reflects internal error. do error log              // Poor error definition since it reflects internal error. do error
           throw PEGASUS_CIM_EXCEPTION (CIM_ERR_NOT_SUPPORTED, nameSpace.getString()+              // log
               " namespace attribute " + key + " option not supported in"+ String(thisProvider));              throw PEGASUS_CIM_EXCEPTION (CIM_ERR_NOT_SUPPORTED, nameSpace +
                   " namespace attribute " + key + " option not supported in" +
                   String(thisProvider));
        }        }
     }     }
     _setPropertyValue(instance, PG_NAMESPACE_PROPERTY_SCHEMAUPDATESALLOWED, updatesAllowed);      setPropertyValue(instance, PG_NAMESPACE_PROPERTY_SCHEMAUPDATESALLOWED,
     _setPropertyValue(instance, PG_NAMESPACE_PROPERTY_ISSHAREABLE, shareable);          updatesAllowed);
     _setPropertyValue(instance, PG_NAMESPACE_PROPERTY_PARENTNAMESPACE, parent);      setPropertyValue(instance, PG_NAMESPACE_PROPERTY_ISSHAREABLE, shareable);
         _setPropertyValue(instance, PG_NAMESPACE_PROPERTY_NAME, name);      setPropertyValue(instance, PG_NAMESPACE_PROPERTY_PARENTNAMESPACE, parent);
             setPropertyValue(instance, PG_NAMESPACE_PROPERTY_NAME, name);
  
       CIMObjectPath objPath = instance.buildPath(targetClass);
       objPath.setHost(hostName);
       objPath.setNameSpace(PEGASUS_NAMESPACENAME_INTEROP);
       instance.setPath(objPath);
     PEG_METHOD_EXIT();     PEG_METHOD_EXIT();
     return(instance);      return instance;
 } }
 void _validateCIMNamespaceKeys(const CIMObjectPath& objectPath)  
   void validatePGNamespaceKeys(const CIMObjectPath& objectPath)
 { {
     PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,     PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,
             "InteropProvider::_validateCIMNamespaceKeys");              "InteropProvider::validatePGNamespaceKeys");
  
     Boolean valid = true;     Boolean valid = true;
     CIMName propertyName;     CIMName propertyName;
     if (!_validateRequiredProperty(objectPath,      if (!validateRequiredProperty(objectPath,
                 CIM_NAMESPACE_PROPERTY_SYSTEMCREATIONCLASSNAME,                 CIM_NAMESPACE_PROPERTY_SYSTEMCREATIONCLASSNAME,
                 System::getSystemCreationClassName ()))                 System::getSystemCreationClassName ()))
     {     {
         propertyName = CIM_NAMESPACE_PROPERTY_SYSTEMCREATIONCLASSNAME;         propertyName = CIM_NAMESPACE_PROPERTY_SYSTEMCREATIONCLASSNAME;
         valid = false;         valid = false;
     }     }
     if (!_validateRequiredProperty(objectPath,      if (!validateRequiredProperty(objectPath,
                 CIM_NAMESPACE_PROPERTY_SYSTEMNAME,                 CIM_NAMESPACE_PROPERTY_SYSTEMNAME,
                 System::getFullyQualifiedHostName()))                 System::getFullyQualifiedHostName()))
     {     {
         propertyName = CIM_NAMESPACE_PROPERTY_SYSTEMNAME;         propertyName = CIM_NAMESPACE_PROPERTY_SYSTEMNAME;
         valid = false;         valid = false;
     }     }
     if (!_validateRequiredProperty(objectPath,      if (!validateRequiredProperty(objectPath,
                 CIM_NAMESPACE_PROPERTY_OBJECTMANAGERCREATIONCLASSNAME,                 CIM_NAMESPACE_PROPERTY_OBJECTMANAGERCREATIONCLASSNAME,
                 CIM_OBJECTMANAGER_CLASSNAME.getString()))                  PEGASUS_CLASSNAME_PG_OBJECTMANAGER.getString()))
     {     {
         propertyName = CIM_NAMESPACE_PROPERTY_OBJECTMANAGERCREATIONCLASSNAME;         propertyName = CIM_NAMESPACE_PROPERTY_OBJECTMANAGERCREATIONCLASSNAME;
         valid = false;         valid = false;
     }     }
  
     // ATTN: This one still a problem.  We have to get the name first     // ATTN: This one still a problem.  We have to get the name first
     if (!_validateRequiredProperty(objectPath,      if (!validateRequiredProperty(objectPath,
                 CIM_NAMESPACE_PROPERTY_OBJECTMANAGERNAME,                 CIM_NAMESPACE_PROPERTY_OBJECTMANAGERNAME,
                 String::EMPTY))                 String::EMPTY))
     {     {
         propertyName = CIM_NAMESPACE_PROPERTY_OBJECTMANAGERNAME;         propertyName = CIM_NAMESPACE_PROPERTY_OBJECTMANAGERNAME;
         valid = false;         valid = false;
     }     }
     if (!_validateRequiredProperty(objectPath,      if (!validateRequiredProperty(objectPath,
                 CIM_NAMESPACE_PROPERTY_CREATIONCLASSNAME,                 CIM_NAMESPACE_PROPERTY_CREATIONCLASSNAME,
                 System::getHostName()))                 System::getHostName()))
     {     {
Line 1280 
Line 1740 
         valid = false;         valid = false;
     }     }
  
     if (!_validateRequiredProperty(objectPath,      if (!validateRequiredProperty(objectPath,
                 CIM_NAMESPACE_PROPERTY_NAME,                 CIM_NAMESPACE_PROPERTY_NAME,
                 String::EMPTY))                 String::EMPTY))
     {     {
Line 1296 
Line 1756 
     }     }
     PEG_METHOD_EXIT();     PEG_METHOD_EXIT();
 } }
   
 /** completes a property in the defined instance either /** completes a property in the defined instance either
     by adding the complete property if it does not exist     by adding the complete property if it does not exist
     or by adding the value if the property does exist.     or by adding the value if the property does exist.
Line 1305 
Line 1764 
     creation of new instances and that the     creation of new instances and that the
     values are logical for the CIMOM.     values are logical for the CIMOM.
 */ */
 Boolean _completeProperty(CIMInstance& instance,  Boolean completeProperty(CIMInstance& instance,
     const CIMName& propertyName,     const CIMName& propertyName,
     const String& value)     const String& value)
 { {
  
     PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,     PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,
             "InteropProvider::_completeProperty()");              "InteropProvider::completeProperty()");
  
     Uint32 pos;     Uint32 pos;
  
     if (!_validateRequiredProperty(instance,      if (!validateRequiredProperty(instance,
                 propertyName,                 propertyName,
                 value))                 value))
     {     {
Line 1327 
Line 1786 
         }         }
         else         else
         {         {
             //              setPropertyValue(instance, propertyName, value);
             _setPropertyValue(instance, propertyName, value);  
         }         }
     }     }
  
     PEG_METHOD_EXIT();     PEG_METHOD_EXIT();
     return(true);     return(true);
 } }
 Boolean _completeCIMNamespaceKeys(CIMInstance& instance)  Boolean completeCIMNamespaceKeys(CIMInstance& instance)
 { {
   
     PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,     PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,
             "InteropProvider::_completeCIMNamespaceKeys");             "InteropProvider::_completeCIMNamespaceKeys");
  
     Boolean valid = true;     Boolean valid = true;
     CIMName propertyName;     CIMName propertyName;
  
     if (!_completeProperty(instance,      if (!completeProperty(instance,
                 CIM_NAMESPACE_PROPERTY_SYSTEMCREATIONCLASSNAME,                 CIM_NAMESPACE_PROPERTY_SYSTEMCREATIONCLASSNAME,
                 System::getSystemCreationClassName ()))                 System::getSystemCreationClassName ()))
     {     {
   
         propertyName = CIM_NAMESPACE_PROPERTY_SYSTEMCREATIONCLASSNAME;         propertyName = CIM_NAMESPACE_PROPERTY_SYSTEMCREATIONCLASSNAME;
         valid = false;         valid = false;
     }     }
  
     if (!_completeProperty(instance,      if (!completeProperty(instance,
                 CIM_NAMESPACE_PROPERTY_SYSTEMNAME,                 CIM_NAMESPACE_PROPERTY_SYSTEMNAME,
                 System::getFullyQualifiedHostName()))                 System::getFullyQualifiedHostName()))
     {     {
Line 1361 
Line 1817 
         valid = false;         valid = false;
     }     }
  
     if (!_completeProperty(instance,      if (!completeProperty(instance,
                 CIM_NAMESPACE_PROPERTY_OBJECTMANAGERCREATIONCLASSNAME,                 CIM_NAMESPACE_PROPERTY_OBJECTMANAGERCREATIONCLASSNAME,
                 CIM_OBJECTMANAGER_CLASSNAME.getString()))                  PEGASUS_CLASSNAME_PG_OBJECTMANAGER.getString()))
     {     {
         propertyName = CIM_NAMESPACE_PROPERTY_OBJECTMANAGERCREATIONCLASSNAME;         propertyName = CIM_NAMESPACE_PROPERTY_OBJECTMANAGERCREATIONCLASSNAME;
         valid = false;         valid = false;
     }     }
  
     if (!_completeProperty(instance,      if (!completeProperty(instance,
                 CIM_NAMESPACE_PROPERTY_OBJECTMANAGERNAME,                 CIM_NAMESPACE_PROPERTY_OBJECTMANAGERNAME,
                 String::EMPTY))                 String::EMPTY))
     {     {
         propertyName = CIM_NAMESPACE_PROPERTY_OBJECTMANAGERNAME;         propertyName = CIM_NAMESPACE_PROPERTY_OBJECTMANAGERNAME;
         valid = false;         valid = false;
     }     }
     if (!_completeProperty(instance,      if (!completeProperty(instance,
                 CIM_NAMESPACE_PROPERTY_CREATIONCLASSNAME,                 CIM_NAMESPACE_PROPERTY_CREATIONCLASSNAME,
                 System::getHostName()))                 System::getHostName()))
     {     {
Line 1384 
Line 1840 
         valid = false;         valid = false;
     }     }
  
     if (!_completeProperty(instance,      if (!completeProperty(instance,
                 CIM_NAMESPACE_PROPERTY_NAME,                 CIM_NAMESPACE_PROPERTY_NAME,
                 String::EMPTY))                 String::EMPTY))
     {     {
Line 1400 
Line 1856 
         throw CIMInvalidParameterException(         throw CIMInvalidParameterException(
             "Invalid CIM_Namespace key property: " + propertyName.getString());             "Invalid CIM_Namespace key property: " + propertyName.getString());
     }     }
     PEG_TRACE_STRING(TRC_CONTROLPROVIDER, Tracer::LEVEL4, "CIM_Namespace Keys Valid");      PEG_TRACE_STRING(TRC_CONTROLPROVIDER, Tracer::LEVEL4,
           "CIM_Namespace Keys Valid");
     PEG_METHOD_EXIT();     PEG_METHOD_EXIT();
     return(valid);     return(valid);
 } }
  
  
 void _validateCIMNamespaceKeys(const CIMInstance& instance)  void validateCIMNamespaceKeys(const CIMInstance& instance)
 { {
     PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,     PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,
             "InteropProvider::_validateCIMNamespaceKeys");              "InteropProvider::validateCIMNamespaceKeys");
     Boolean valid = true;     Boolean valid = true;
     CIMName propertyName;     CIMName propertyName;
     if (!_validateRequiredProperty(instance,      if (!validateRequiredProperty(instance,
                 CIM_NAMESPACE_PROPERTY_SYSTEMCREATIONCLASSNAME,                 CIM_NAMESPACE_PROPERTY_SYSTEMCREATIONCLASSNAME,
                 System::getSystemCreationClassName ()))                 System::getSystemCreationClassName ()))
     {     {
Line 1420 
Line 1877 
         valid = false;         valid = false;
     }     }
  
     if (!_validateRequiredProperty(instance,      if (!validateRequiredProperty(instance,
                 CIM_NAMESPACE_PROPERTY_SYSTEMNAME,                 CIM_NAMESPACE_PROPERTY_SYSTEMNAME,
                 System::getFullyQualifiedHostName ()))                 System::getFullyQualifiedHostName ()))
     {     {
Line 1428 
Line 1885 
         valid = false;         valid = false;
     }     }
  
     if (!_validateRequiredProperty(instance,      if (!validateRequiredProperty(instance,
                 CIM_NAMESPACE_PROPERTY_OBJECTMANAGERCREATIONCLASSNAME,                 CIM_NAMESPACE_PROPERTY_OBJECTMANAGERCREATIONCLASSNAME,
                 CIM_OBJECTMANAGER_CLASSNAME.getString()))                  PEGASUS_CLASSNAME_PG_OBJECTMANAGER.getString()))
     {     {
         propertyName = CIM_NAMESPACE_PROPERTY_OBJECTMANAGERCREATIONCLASSNAME;         propertyName = CIM_NAMESPACE_PROPERTY_OBJECTMANAGERCREATIONCLASSNAME;
         valid = false;         valid = false;
     }     }
  
     // ATTN: This one still a problem.  We have to get the name first     // ATTN: This one still a problem.  We have to get the name first
     if (!_validateRequiredProperty(instance,      if (!validateRequiredProperty(instance,
                 CIM_NAMESPACE_PROPERTY_OBJECTMANAGERNAME,                 CIM_NAMESPACE_PROPERTY_OBJECTMANAGERNAME,
                 String::EMPTY))                 String::EMPTY))
     {     {
         propertyName = CIM_NAMESPACE_PROPERTY_OBJECTMANAGERNAME;         propertyName = CIM_NAMESPACE_PROPERTY_OBJECTMANAGERNAME;
         valid = false;         valid = false;
     }     }
     if (!_validateRequiredProperty(instance,      if (!validateRequiredProperty(instance,
                 CIM_NAMESPACE_PROPERTY_CREATIONCLASSNAME,                 CIM_NAMESPACE_PROPERTY_CREATIONCLASSNAME,
                 System::getHostName()))                 System::getHostName()))
     {     {
Line 1452 
Line 1909 
         valid = false;         valid = false;
     }     }
  
     if (!_validateRequiredProperty(instance,      if (!validateRequiredProperty(instance,
                 CIM_NAMESPACE_PROPERTY_NAME,                 CIM_NAMESPACE_PROPERTY_NAME,
                 String::EMPTY))                 String::EMPTY))
     {     {
Line 1468 
Line 1925 
         throw CIMInvalidParameterException(         throw CIMInvalidParameterException(
             "Invalid CIM_Namespace key property: " + propertyName.getString());             "Invalid CIM_Namespace key property: " + propertyName.getString());
     }     }
     PEG_TRACE_STRING(TRC_CONTROLPROVIDER, Tracer::LEVEL4, "CIM_Namespace Keys Valid");      PEG_TRACE_STRING(TRC_CONTROLPROVIDER, Tracer::LEVEL4,
     PEG_METHOD_EXIT();          "CIM_Namespace Keys Valid");
 }  
   
 /** builds complete object path from instance and classinfo by building the full path  
     with host and namespace names included.  
 */  
 CIMObjectPath InteropProvider::_buildObjectPath(const CIMNamespaceName& name,  
                                                 const CIMName& className,  
                                                 const CIMInstance& instance)  
 {  
     PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,  
             "InteropProvider::_buildObjectPath");  
   
     CIMObjectPath objectPath;  
     objectPath = _buildInstancePath(name,className,instance);  
   
     objectPath.setHost(System::getHostName());  
   
     objectPath.setNameSpace(name);  
   
     PEG_METHOD_EXIT();  
     return(objectPath);  
 }  
   
 /* Given a class and instance build the instance path for a  
    the object.  This builds all components of the path  
    @param namespace name to build  
    @return CIMObjectPath containing namespace, class and keybinding  
    components of path  
    @exceptions - Passes repository exceptions.  
 */  
   
 CIMObjectPath InteropProvider::_buildInstancePath(const CIMNamespaceName& name,  
                                            const CIMName& className,  
                                            const CIMInstance& instance)  
 {  
     PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,  
             "InteropProvider::_buildInstancePath");  
   
     // 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);  
   
     CIMObjectPath ref = instance.buildPath(thisClass);  
   
     PEG_METHOD_EXIT();     PEG_METHOD_EXIT();
     return(ref);  
 } }
  
 //************************************************************** //**************************************************************
Line 1529 
Line 1941 
     @return value of name property     @return value of name property
     @exceptions CIMInvalidParameterException     @exceptions CIMInvalidParameterException
 */ */
 String _getKeyValue(const CIMObjectPath& instanceName, const CIMName& keyName)  String getKeyValue(const CIMObjectPath& instanceName, const CIMName& keyName)
 { {
     Array<CIMKeyBinding> kbArray = instanceName.getKeyBindings();     Array<CIMKeyBinding> kbArray = instanceName.getKeyBindings();
  
Line 1540 
Line 1952 
             return (kbArray[i].getValue());             return (kbArray[i].getValue());
     }     }
  
     throw CIMInvalidParameterException("Invalid key property: " + keyName.getString());      throw CIMInvalidParameterException("Invalid key property: " +
           keyName.getString());
 } }
  
 String _getKeyValue(const CIMInstance& instance, const CIMName& keyName)  String getKeyValue(const CIMInstance& instance, const CIMName& keyName)
 { {
     Uint32 pos;     Uint32 pos;
     CIMValue propertyValue;     CIMValue propertyValue;
Line 1551 
Line 1964 
     pos = instance.findProperty(keyName);     pos = instance.findProperty(keyName);
     if (pos == PEG_NOT_FOUND)     if (pos == PEG_NOT_FOUND)
        throw CIMPropertyNotFoundException        throw CIMPropertyNotFoundException
            (NAMESPACE_PROPERTYNAME.getString());             (keyName.getString());
  
     propertyValue = instance.getProperty(pos).getValue();     propertyValue = instance.getProperty(pos).getValue();
     if (propertyValue.getType() != CIMTYPE_STRING)     if (propertyValue.getType() != CIMTYPE_STRING)
        throw CIMInvalidParameterException("Invalid type for property: "        throw CIMInvalidParameterException("Invalid type for property: "
                              + NAMESPACE_PROPERTYNAME.getString());                               + keyName.getString());
     String name;     String name;
     propertyValue.get(name);     propertyValue.get(name);
     return(name);     return(name);
     //ATTN: KS Returns String whereas below returns CIMNamespaceName.  
 } }
  
   /** Test for valid CIMReferences from an association instance. If there is a
       role property, tests if there is a match for this role and the target
       object. Confirms that this role and this reference exist in the target
       instance.
   
       @param target - The target path for the association. Localization assumed.
       @param instance - The association class instance we are searching for
                         references
       @param role - The role we require. I there is no role, this is String::EMPTY
       @return - returns Boolean true if target is found in a reference that is
       the same role
    */
   Boolean isInstanceValidReference(const CIMObjectPath& target,
                                     const CIMInstance& instance,
                                     const String& role)
   {
       // Test if role parameter is valid property.
       Uint32 pos;
       if (role != String::EMPTY)
       {
           // Test if property with this role exists.
           if ((pos = instance.findProperty(role)) == PEG_NOT_FOUND)
               throw CIMException(CIM_ERR_INVALID_PARAMETER);
   
            // Check to be sure this is a reference property
            // This test may not be necessary. Combine it into the loop.
            if (instance.getProperty(pos).getType() != CIMTYPE_REFERENCE)
                throw CIMException(CIM_ERR_INVALID_PARAMETER);
       }
       //Search instance for all reference properties
       for (Uint32 j = 0; j < instance.getPropertyCount() ; j++)
       {
           const CIMConstProperty p = instance.getProperty(j);
           if (p.getType() == CIMTYPE_REFERENCE)
           {
               // If there is no role or the role is the same as this property name
               CIMValue v = p.getValue();
               CIMObjectPath path;
               v.get(path);
   
               // if no role or role ==this role and target = this path, rtn true.
               if ((role == String::EMPTY) || (CIMName(role) == p.getName()))
               {
                   // and if target is identical to reference path
                   if (target.identical(path))
                       return(true);
               }
           }
       }
       return( false );
   }
   /** Filters the input of instances (which contain path info)
       using the assocClassName, assocRole, ResultClassName and
       resultRole. Removes any instances from the list that
       do not match the filters.
       @instances Array<CIMInstance to filter.
       @
    * TODO - Shouldn't we remove rather than copy??? faster.
    * TODO - why extra check for no resultClass??
   */
   Array<CIMObject> filterReferenceInstances(Array<CIMInstance>& instances,
                         const CIMObjectPath& targetobjectName,
                         const CIMName& resultClass,
                         const String& resultRole)
   {
       PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,
               "filterReferenceInstances()");
   
       CIMObjectPath targetReference = CIMObjectPath(
                               String(),
                               CIMNamespaceName(),
                               targetobjectName.getClassName(),
                               targetobjectName.getKeyBindings());
       Array<CIMObject> rtnObjects;
       for (Uint32 i = 0 ; i < instances.size() ; i++)
       {
           if (resultClass.isNull() ||
               resultClass.equal(instances[i].getClassName()))
           {
               // if this association instance has this role in targetReference
               if (isInstanceValidReference(targetobjectName, instances[i],
                   resultRole))
               {
                   rtnObjects.append(instances[i]);
               }
           }
       }
       PEG_METHOD_EXIT();
       return( rtnObjects );
   }
 //*************************************************************************** //***************************************************************************
 //  The following section is the Instance Operation processors //  The following section is the Instance Operation processors
 //*************************************************************************** //***************************************************************************
Line 1576 
Line 2078 
     {     {
         PEG_METHOD_ENTER(TRC_CONTROLPROVIDER, "InteropProvider::createInstance()");         PEG_METHOD_ENTER(TRC_CONTROLPROVIDER, "InteropProvider::createInstance()");
  
       AutoMutex autoMut(changeControlMutex);
   
         Tracer::trace(TRC_CONTROLPROVIDER, Tracer::LEVEL4,         Tracer::trace(TRC_CONTROLPROVIDER, Tracer::LEVEL4,
             "%s createInstance. InstanceReference= %s",             "%s createInstance. InstanceReference= %s",
             thisProvider,             thisProvider,
             (const char *) instanceReference.toString().getCString());             (const char *) instanceReference.toString().getCString());
  
       // test for legal namespace for this provider. Exception if not
       namespaceSupported(instanceReference);
   
         handler.processing();         handler.processing();
         CIMNamespaceName newNamespaceName;  
  
         CDEBUG("CreateInstance " << instanceReference.toString());      CIMInstance localInstance;
         // operation namespace needed internally to get class.      const CIMName & instClassName = instanceReference.getClassName();
         _operationNamespace = instanceReference.getNameSpace();      TARGET_CLASS classEnum = PG_NAMESPACE;
       if(instClassName.equal(PEGASUS_CLASSNAME_CIM_NAMESPACE))
       {
           localInstance = CIMInstance(PEGASUS_CLASSNAME_PG_NAMESPACE);
           // Copy the properties of the source instance
           for (Uint32 i = 0 ; i < myInstance.getQualifierCount() ; i++)
           {
               localInstance.addQualifier(myInstance.getQualifier(i).clone());
           }
  
         // Verify that ClassName is correct and get value          for (Uint32 i = 0 ; i < myInstance.getPropertyCount() ; i++)
         targetClass classEnum  = _verifyValidClassInput(instanceReference.getClassName());          {
               localInstance.addProperty(myInstance.getProperty(i).clone());
           }
       }
       else
       {
           classEnum = translateClassInput(instanceReference.getClassName());
       }
  
         String userName = _validateUserID(context);  
         CIMObjectPath newInstanceReference;  
  
         if ((classEnum == CIM_OBJECTMANAGER) ||      CIMObjectPath newInstanceReference;
             (classEnum == PG_CIMXMLCOMMUNICATIONMECHANISM))      CIMNamespaceName newNamespaceName;
             throw CIMNotSupportedException("InteropProvider, Create Not allowed");  
  
         if (classEnum == PG_NAMESPACE)         if (classEnum == PG_NAMESPACE)
         {         {
 #ifdef PEGASUS_OS_OS400 #ifdef PEGASUS_OS_OS400
             MessageLoaderParms mparms("ControlProviders.InteropProvider.CREATE_INSTANCE_NOT_ALLOWED",          MessageLoaderParms mparms(
               "ControlProviders.InteropProvider.CREATE_INSTANCE_NOT_ALLOWED",
                                       "Create instance operation not allowed by Interop Provider for class $0.",                                       "Create instance operation not allowed by Interop Provider for class $0.",
                                       PG_NAMESPACE_CLASSNAME.getString());              PEGASUS_CLASSNAME_PG_NAMESPACE.getString());
             throw CIMNotSupportedException(mparms);             throw CIMNotSupportedException(mparms);
 #else #else
             // Create local instance to complete any keys.          // Create local instance to complete any keys if not created above.
             CIMInstance localInstance = myInstance.clone();          if (localInstance.isUninitialized())
           {
               localInstance = myInstance.clone();
           }
  
             _completeCIMNamespaceKeys(localInstance);          completeCIMNamespaceKeys(localInstance);
             // Validate that keys are as required. Does its own exception.             // Validate that keys are as required. Does its own exception.
             newNamespaceName = _getKeyValue(myInstance, CIM_NAMESPACE_PROPERTY_NAME);          newNamespaceName = getKeyValue(myInstance,
               CIM_NAMESPACE_PROPERTY_NAME);
  
             newInstanceReference = _buildInstancePath(_operationNamespace,          CIMNamespaceName opNameSpace = instanceReference.getNameSpace();
                                         PG_NAMESPACE_CLASSNAME, localInstance);          newInstanceReference = buildInstancePath(
               repository->getClass(opNameSpace, PEGASUS_CLASSNAME_PG_NAMESPACE,
                   false, true, false),
               instanceReference.getHost(), opNameSpace,
               localInstance);
 #endif #endif
         }         }
   
         else   // Invalid class for the create functions.         else   // Invalid class for the create functions.
         {         {
             PEGASUS_ASSERT(false);          PEG_METHOD_EXIT();
           throw CIMNotSupportedException(
             "InteropProvider::CreateInstance Not allowed for class " +
             instanceReference.getClassName().getString());
         }         }
  
         // Create the new namespace         // Create the new namespace
Line 1636 
Line 2165 
             CIMRepository::NameSpaceAttributes attributes;             CIMRepository::NameSpaceAttributes attributes;
             // optional property.  Set false if not found.             // optional property.  Set false if not found.
             // ATTN: Should set to class default.             // ATTN: Should set to class default.
             if (myInstance.findProperty(PG_NAMESPACE_PROPERTY_ISSHAREABLE) != PEG_NOT_FOUND)          if(localInstance.findProperty(
               PG_NAMESPACE_PROPERTY_ISSHAREABLE) != PEG_NOT_FOUND)
             {             {
                 if (_getPropertyValue(myInstance, PG_NAMESPACE_PROPERTY_ISSHAREABLE, false))              if(getPropertyValue(myInstance,
                   PG_NAMESPACE_PROPERTY_ISSHAREABLE, false))
                 {                 {
                     attributes.insert("shareable","true");                     attributes.insert("shareable","true");
                     shareable = true;                     shareable = true;
                 }                 }
                 else                 else
               {
                     attributes.insert("shareable", "false");                     attributes.insert("shareable", "false");
             }             }
           }
             else             else
           {
                 attributes.insert("shareable", "false");                 attributes.insert("shareable", "false");
           }
  
             // Optional property.  Set false if not found.             // Optional property.  Set false if not found.
             if (myInstance.findProperty(PG_NAMESPACE_PROPERTY_SCHEMAUPDATESALLOWED) != PEG_NOT_FOUND)          if(localInstance.findProperty(
               PG_NAMESPACE_PROPERTY_SCHEMAUPDATESALLOWED) != PEG_NOT_FOUND)
             {             {
                 if (_getPropertyValue(myInstance, PG_NAMESPACE_PROPERTY_SCHEMAUPDATESALLOWED, false))              if (getPropertyValue(myInstance,
                   PG_NAMESPACE_PROPERTY_SCHEMAUPDATESALLOWED, false))
                 {                 {
                     attributes.insert("updatesAllowed","true");                     attributes.insert("updatesAllowed","true");
                     updatesAllowed = true;                     updatesAllowed = true;
                 }                 }
                 else                 else
               {
                     attributes.insert("updatesAllowed", "false");                     attributes.insert("updatesAllowed", "false");
             }             }
           }
             else             else
           {
                 attributes.insert("updatesAllowed", "false");                 attributes.insert("updatesAllowed", "false");
           }
  
             // ATTN: Need to reflect and dependencies between these properties. Right now          // ATTN: Need to reflect and dependencies between these properties.
             // this lets anything happen.          // Right now this lets anything happen.
             if (myInstance.findProperty(PG_NAMESPACE_PROPERTY_PARENTNAMESPACE) != PEG_NOT_FOUND)          if (localInstance.findProperty(
               PG_NAMESPACE_PROPERTY_PARENTNAMESPACE) != PEG_NOT_FOUND)
             {             {
                 String parent = _getPropertyValue(myInstance, PG_NAMESPACE_PROPERTY_PARENTNAMESPACE, String::EMPTY);              String parent = getPropertyValue(myInstance,
                   PG_NAMESPACE_PROPERTY_PARENTNAMESPACE, String::EMPTY);
                 if (parent != String::EMPTY)                 if (parent != String::EMPTY)
                     attributes.insert("parent",parent);                     attributes.insert("parent",parent);
             }             }
             _repository->createNameSpace(newNamespaceName, attributes);          repository->createNameSpace(newNamespaceName, attributes);
  
             PEG_TRACE_STRING(TRC_CONTROLPROVIDER, Tracer::LEVEL4,             PEG_TRACE_STRING(TRC_CONTROLPROVIDER, Tracer::LEVEL4,
                 "Namespace = " + newNamespaceName.getString() +                 "Namespace = " + newNamespaceName.getString() +
                     " successfully created.");                     " successfully created.");
             Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE,             Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE,
                 "Create Namespace: Shareable = $0, Updates allows: $1,  Parent: $2",              "Create Namespace: Shareable = $0, Updates allowed: $1,  Parent: $2",
                 newNamespaceName.getString(), shareable? "true" : "false", shareable? "true" : "false", parent );              newNamespaceName.getString(), shareable?
                       "true" : "false", shareable? "true" : "false", parent );
  
         }         }
         catch(const CIMException&)         catch(const CIMException&)
Line 1712 
Line 2256 
         ResponseHandler & handler)         ResponseHandler & handler)
     {     {
         PEG_METHOD_ENTER(TRC_CONTROLPROVIDER, "InteropProvider::deleteInstance");         PEG_METHOD_ENTER(TRC_CONTROLPROVIDER, "InteropProvider::deleteInstance");
       const CIMName instClassName = instanceName.getClassName();
   #ifndef PEGASUS_OS_OS400
       AutoMutex autoMut(changeControlMutex);
  
         Tracer::trace(TRC_CONTROLPROVIDER, Tracer::LEVEL4,         Tracer::trace(TRC_CONTROLPROVIDER, Tracer::LEVEL4,
             "%s deleteInstance. instanceName= %s",             "%s deleteInstance. instanceName= %s",
             thisProvider,             thisProvider,
             (const char *) instanceName.toString().getCString());             (const char *) instanceName.toString().getCString());
  
         _operationNamespace = instanceName.getNameSpace();      if(instClassName == PEGASUS_CLASSNAME_PG_NAMESPACE)
         handler.processing();  
         // Verify that ClassName is correct and get value  
         targetClass classEnum  = _verifyValidClassInput(instanceName.getClassName());  
   
         String userName = _validateUserID(context);  
   
         // Delete the instance since it may be in persistent storage  
         if ((classEnum == CIM_OBJECTMANAGER))  
         {  
             try  
             {  
                 _repository->deleteInstance(_operationNamespace,instanceName);  
             }  
             catch(const CIMException&)  
             {  
                 PEG_METHOD_EXIT();  
                 throw;  
             }  
         }  
         else if (classEnum == PG_NAMESPACE)  
         {         {
           handler.processing();
             CIMNamespaceName deleteNamespaceName;             CIMNamespaceName deleteNamespaceName;
 #ifdef PEGASUS_OS_OS400  
             MessageLoaderParms mparms("ControlProviders.InteropProvider.DELETE_INSTANCE_NOT_ALLOWED",  
                                       "Delete instance operation not allowed by Interop Provider for class $0.",  
                                       PG_NAMESPACE_CLASSNAME.getString());  
             throw CIMNotSupportedException(mparms);  
 #else  
             // validate requred keys.  Exception out if not valid             // validate requred keys.  Exception out if not valid
             _validateCIMNamespaceKeys(instanceName);          validatePGNamespaceKeys(instanceName);
   
             deleteNamespaceName = _getKeyValue(instanceName, CIM_NAMESPACE_PROPERTY_NAME);  
 #endif  
  
             Array<CIMNamespaceName> namespaceNames;          deleteNamespaceName = getKeyValue(instanceName,
             namespaceNames = _enumerateNameSpaces();              PG_NAMESPACE_PROPERTY_NAME);
  
             if (deleteNamespaceName.equal (ROOTNS))          if (deleteNamespaceName.equal(PEGASUS_NAMESPACENAME_ROOT))
             {             {
                throw CIMNotSupportedException("root namespace cannot be deleted.");                throw CIMNotSupportedException("root namespace cannot be deleted.");
             }             }
  
             _repository->deleteNameSpace(deleteNamespaceName);          repository->deleteNameSpace(deleteNamespaceName);
  
             PEG_TRACE_STRING(TRC_CONTROLPROVIDER, Tracer::LEVEL4,             PEG_TRACE_STRING(TRC_CONTROLPROVIDER, Tracer::LEVEL4,
                "Namespace = " + deleteNamespaceName.getString() +                "Namespace = " + deleteNamespaceName.getString() +
Line 1770 
Line 2289 
             Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE,             Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE,
                "Interop Provider Delete Namespace: $0",                "Interop Provider Delete Namespace: $0",
                deleteNamespaceName.getString());                deleteNamespaceName.getString());
         }  
         else  
         {  
             throw CIMNotSupportedException("Delete Not allowed for " + instanceName.getClassName().getString());  
         }  
   
         handler.processing();  
   
         handler.complete();         handler.complete();
  
         PEG_METHOD_EXIT();         PEG_METHOD_EXIT();
         return ;         return ;
     }     }
  
 //***************************************************************************  #endif
 //                getInstance      MessageLoaderParms mparms(
 //***************************************************************************          "ControlProviders.InteropProvider.DELETE_INSTANCE_NOT_ALLOWED",
 void InteropProvider::getInstance(          "Delete instance operation not allowed by Interop Provider for class $0.",
           instClassName.getString());
       throw CIMNotSupportedException(mparms);
   }
   
   /** 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 unitinialitized.
   */
   CIMInstance InteropProvider::localGetInstance(
     const OperationContext & context,     const OperationContext & context,
     const CIMObjectPath & instanceName,     const CIMObjectPath & instanceName,
     const Boolean includeQualifiers,      const CIMPropertyList & propertyList)
     const Boolean includeClassOrigin,  
     const CIMPropertyList & propertyList,  
     InstanceResponseHandler & handler)  
     {     {
         PEG_METHOD_ENTER(TRC_CONTROLPROVIDER, "InteropProvider::getInstance");      PEG_METHOD_ENTER(TRC_CONTROLPROVIDER, "InteropProvider::localGetInstance");
  
         Tracer::trace(TRC_CONTROLPROVIDER, Tracer::LEVEL4,         Tracer::trace(TRC_CONTROLPROVIDER, Tracer::LEVEL4,
             "%s getInstance. instanceName= %s , includeQualifiers= %s, includeClassOrigin= %s, PropertyList= %s",          "%s getInstance. instanceName= %s , PropertyList= %s",
             thisProvider,             thisProvider,
             (const char *)instanceName.toString().getCString(),             (const char *)instanceName.toString().getCString(),
             (const char *)_showBool(includeQualifiers).getCString(),          (const char *)propertyListToString(propertyList).getCString());
             (const char*) _showBool(includeClassOrigin).getCString(),  
             (const char *)_showPropertyList(propertyList).getCString());  
         // Verify that ClassName is correct and get value  
         targetClass classEnum  = _verifyValidClassInput(instanceName.getClassName());  
   
         _operationNamespace = instanceName.getNameSpace();  
         String userName = _validateUserID(context);  
         // begin processing the request  
         handler.processing();  
         if (classEnum == CIM_OBJECTMANAGER)  
         {  
             CIMInstance instance = _getInstanceCIMObjectManager(includeQualifiers,  
                                         includeClassOrigin, propertyList);  
             handler.deliver(instance);  
             handler.complete();  
             PEG_METHOD_EXIT();  
             return;  
         }  
   
         if (classEnum == PG_CIMXMLCOMMUNICATIONMECHANISM)  
         {  
             // ATTN: test for correct instance KS: Priority 1  
             Array <CIMInstance> instances = _buildInstancesPGCIMXMLCommunicationMechanism(  
                                     includeQualifiers,  
                                     includeClassOrigin, propertyList);  
             handler.deliver(instances[0]);  
             handler.complete();  
             PEG_METHOD_EXIT();  
             return;  
         }  
  
         if (classEnum == CIM_NAMESPACEINMANAGER)      // Test if we're looking for something outside of our namespace. This will
         {      // happen during associators calls from PG_RegisteredProfile instances
             handler.complete();      // through the PG_ElementConformsToProfile association
             PEG_METHOD_EXIT();      CIMNamespaceName opNamespace = instanceName.getNameSpace();
             return;      CIMName opClass = instanceName.getClassName();
         }      if(opNamespace != PEGASUS_NAMESPACENAME_INTEROP &&
           opClass != PEGASUS_CLASSNAME_PG_ELEMENTCONFORMSTOPROFILE)
       {
           AutoMutex mut(interopMut);
           return cimomHandle.getInstance(context, opNamespace,
               instanceName, false, false, false, propertyList);
       }
   
       // 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);
  
         // Get List of namespaces      // deliver a single instance if found.
         Array<CIMNamespaceName> namespaceNames;      CIMInstance rtnInstance;
         namespaceNames = _enumerateNameSpaces();  
         CIMInstance instance;  
  
         if (classEnum == PG_NAMESPACE)      for (Uint32 i = 0 ; i < instances.size() ; i++)
         {         {
             // Not clear what we have to take into account here.         if (instanceName == instances[i].getPath())
             // get the namespace from the name value.  
             // should check the other keys to see if valid.  
             CIMNamespaceName namespaceName;  
             namespaceName = _getKeyValue(instanceName, CIM_NAMESPACE_PROPERTY_NAME);  
   
             // ATTN: Why this CIMNamespaceName parentNamespaceName = instanceName.getNameSpace();  
             if (!Contains(namespaceNames, namespaceName))  
             {             {
                 throw CIMObjectNotFoundException("Namespace does not exist: "             /* DEBUG SUPPORT
                                      + namespaceName.getString());             Tracer::trace(TRC_CONTROLPROVIDER, Tracer::LEVEL4,
             }                 "%s getInstance return instance number %u\npath: %s\n %s\n",
             PEG_TRACE_STRING(TRC_CONTROLPROVIDER, Tracer::LEVEL4,                 thisProvider, i,
                "Namespace = " + namespaceName.getString() + " successfully found.");                 (instances[i].getPath().toString().getCString()),
                  ( ( CIMObject) instances[i]).toString().getCString());
             instance = _getInstanceCIMNamespace(namespaceName);             *****/
             rtnInstance = instances[i];
             break;
             // TODO Add test for duplicates somewhere.
         }         }
         else  // processing for __Namespace  
         {  
             PEGASUS_ASSERT(false);  
         }         }
   
        handler.deliver(instance);  
   
        // complete processing the request  
        handler.complete();  
   
        PEG_METHOD_EXIT();        PEG_METHOD_EXIT();
        return ;      return rtnInstance;
     }     }
   
 //*************************************************************************** //***************************************************************************
 //                enumerateInstances  //                getInstance
 //*************************************************************************** //***************************************************************************
 void InteropProvider::enumerateInstances(  void InteropProvider::getInstance(
     const OperationContext & context,     const OperationContext & context,
     const CIMObjectPath & ref,      const CIMObjectPath & instanceName,
     const Boolean includeQualifiers,     const Boolean includeQualifiers,
     const Boolean includeClassOrigin,     const Boolean includeClassOrigin,
     const CIMPropertyList& propertyList,     const CIMPropertyList& propertyList,
     InstanceResponseHandler & handler)     InstanceResponseHandler & handler)
     {     {
         PEG_METHOD_ENTER(TRC_CONTROLPROVIDER, "InteropProvider::enumerateInstances()");      // test for legal namespace for this provider. Exception if not
       namespaceSupported(instanceName);
  
         Tracer::trace(TRC_CONTROLPROVIDER, Tracer::LEVEL4,      handler.processing();
             "%s enumerateInstances. ref= %s, includeQualifiers= %s, includeClassOrigin= %s, PropertyList= %s",  
             thisProvider,  
             (const char *) ref.toString().getCString(),  
             (const char *) _showBool(includeQualifiers).getCString(),  
             (const char *) _showBool(includeClassOrigin).getCString(),  
             (const char *) _showPropertyList(propertyList).getCString());  
   
         // Verify that ClassName is correct and get value  
         targetClass classEnum  = _verifyValidClassInput(ref.getClassName());  
  
         // operation namespace needed internally to get class.      CIMInstance myInstance = localGetInstance(
         _operationNamespace = ref.getNameSpace();                      context,
         CDEBUG("Namespace = " << _operationNamespace.getString());                      instanceName,
         //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 = _getInstanceCIMObjectManager(includeQualifiers,  
                                     includeClassOrigin,  
                                     propertyList);                                     propertyList);
  
             //Array<Sint8> tmp;      if (!myInstance.isUninitialized())
             ///XmlWriter::appendInstanceElement(tmp, instance);          handler.deliver(myInstance);
             //tmp.append('\0');      else
             //Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE,          throw CIMObjectNotFoundException(instanceName.toString());
             //        "Instance - XML content: $0", tmp.getData());  
             ///XmlWriter::printInstanceElement(instance);      handler.complete();
             handler.deliver(instance);  
             //handler.complete();  
             //PEG_METHOD_EXIT();  
             //return;  
         }         }
  
         else if (classEnum == PG_CIMXMLCOMMUNICATIONMECHANISM)  //******************************************************************************
         {  //   localEnumerateInstances
             Array<CIMInstance> instances = _buildInstancesPGCIMXMLCommunicationMechanism(includeQualifiers,  //   EnumerateInstances equivalent to external but returns instances
                                     includeClassOrigin, propertyList);  //   Used by other operations to build instances for processing
             CDEBUG("Build instances of PGCIMXML. count= " << instances.size());  //   Note that this delivers instances as a group rather than incrementally.
             handler.deliver(instances);  //    This technique should only be used for small groups of instances.
             //handler.complete();  //******************************************************************************
             //PEG_METHOD_EXIT();  
             //return;  
         }  
  
         else if (classEnum == CIM_NAMESPACEINMANAGER)  Array<CIMInstance> InteropProvider::localEnumerateInstances(
       const OperationContext & context,
       const CIMObjectPath & ref,
       const CIMPropertyList& propertyList)
         {         {
             //handler.complete();      PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,
             //PEG_METHOD_EXIT();          "InteropProvider::localEnumerateInstances()");
             //return;      const CIMName & className = ref.getClassName();
       Tracer::trace(TRC_CONTROLPROVIDER, Tracer::LEVEL4,
           "%s enumerateInstances. referenc= %s , PropertyList= %s",
           thisProvider,
           (const char *)className.getString().getCString(),
           (const char *)propertyListToString(propertyList).getCString());
   
       // Verify that ClassName is correct and get value
       TARGET_CLASS classEnum  = translateClassInput(className);
   
       Array<CIMInstance> instances;
       switch(classEnum)
       {
           case PG_OBJECTMANAGER:
           {
               instances.append(getObjectManagerInstance());
               break;
           }
           case PG_CIMXMLCOMMUNICATIONMECHANISM:
           {
               instances = enumCIMXMLCommunicationMechanismInstances();
               break;
           }
           case PG_NAMESPACEINMANAGER:
           {
               instances = enumNamespaceInManagerInstances();
               break;
           }
           case PG_COMMMECHANISMFORMANAGER:
           {
               instances = enumCommMechanismForManagerInstances();
               break;
           }
           case PG_NAMESPACE:
           {
               instances = enumNamespaceInstances();
               break;
           }
           case PG_REGISTEREDPROFILE:
           {
               instances = enumRegisteredProfileInstances();
               break;
           }
           case PG_REGISTEREDSUBPROFILE:
           {
               instances = enumRegisteredSubProfileInstances();
               break;
           }
           case PG_REFERENCEDPROFILE:
           {
               instances = enumReferencedProfileInstances();
               break;
           }
           case PG_ELEMENTCONFORMSTOPROFILE:
           {
               instances = enumElementConformsToProfileInstances(context,
                   ref.getNameSpace());
               break;
           }
           case PG_SUBPROFILEREQUIRESPROFILE:
           {
               instances = enumSubProfileRequiresProfileInstances();
               break;
           }
           case PG_SOFTWAREIDENTITY:
           {
               instances = enumSoftwareIdentityInstances();
               break;
           }
           case PG_ELEMENTSOFTWAREIDENTITY:
           {
               instances = enumElementSoftwareIdentityInstances();
               break;
           }
           case PG_INSTALLEDSOFTWAREIDENTITY:
           {
               instances = enumInstalledSoftwareIdentityInstances();
               break;
           }
           case PG_COMPUTERSYSTEM:
           {
               instances.append(getComputerSystemInstance());
               break;
           }
           case PG_HOSTEDOBJECTMANAGER:
           {
               instances.append(getHostedObjectManagerInstance());
               break;
           }
           case PG_HOSTEDACCESSPOINT:
           {
               instances = enumHostedAccessPointInstances();
               break;
           }
           default:
               PEG_METHOD_EXIT();
               throw CIMNotSupportedException(className.getString() +
                 " not supported by Interop Provider enumerate");
         }         }
  
         else if (classEnum == PG_NAMESPACE)      // Filter and deliver the resulting instances
       for (Uint32 i = 0 ; i < instances.size() ; i++)
         {         {
             Array<CIMInstance> instances = _getInstancesCIMNamespace(includeQualifiers,          normalizeInstance(instances[i], ref, false,
                                     includeClassOrigin, propertyList);              false, propertyList);
       }
  
             handler.deliver(instances);      PEG_METHOD_EXIT();
             //handler.complete();      return instances;
             //PEG_METHOD_EXIT();  
             //return;  
         }         }
         else  
   //***************************************************************************
   //                EnumerateInstances - External Operation call
   //    Delivers instances back through response handler.
   //***************************************************************************
   void InteropProvider::enumerateInstances(
       const OperationContext & context,
       const CIMObjectPath & ref,
       const Boolean includeQualifiers,
       const Boolean includeClassOrigin,
       const CIMPropertyList& propertyList,
       InstanceResponseHandler & handler)
         {         {
             throw CIMNotSupportedException      PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,
                 ("EnumerateInstance for " + ref.getClassName().getString() + " not supported");          "InteropProvider::enumerateInstances()");
         }  
  
       // test for legal namespace for this provider. Exception if not
       namespaceSupported(ref);
       handler.processing();
       // Call the internal enumerateInstances to generate instances of defined
       // class.  This expects the instances to be returned complete including
       // complete path.
       handler.deliver(localEnumerateInstances(context, ref, propertyList));
         handler.complete();         handler.complete();
   
         PEG_METHOD_EXIT();         PEG_METHOD_EXIT();
     }     }
  
 void InteropProvider::modifyObjectManagerInstance(const OperationContext & context,  /** Modify the existing object Manager Object.  Only a single property
       modification is allowed, the statistical data setting.  Any other change is
       rejected with an exception
       @param instanceReference - Reference for the instance to be modified.
       @param modifiedIns CIMInstance defining the change. If this includes more
       than a single property, the propertyList must specify modification only of
       the statisticaldata property.
       @includeQualifiers Boolean which must be false unless there are no
       qualifiers in the modifiedIns.
       @propertyList CIMPropertyList defining the property to be modified if there
       is more than one property in the modifiedIns.
       @Exceptions CIMInvalidParameterException if the parameters are not valid for
       the modification.
    */
   void InteropProvider::modifyObjectManagerInstance(
       const OperationContext & context,
     const CIMObjectPath & instanceReference,     const CIMObjectPath & instanceReference,
     const CIMInstance& modifiedIns,     const CIMInstance& modifiedIns,
     const Boolean includeQualifiers,     const Boolean includeQualifiers,
     const CIMPropertyList& propertyList,      const CIMPropertyList& propertyList)
     ResponseHandler & handler)  
 { {
     PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,     PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,
             "InteropProvider::modifyInstanceManagerInstance");          "InteropProvider::modifyObjectManagerInstance");
     // the only allowed modification is this one property, statistical data  
     if (modifiedIns.findProperty(OM_GATHERSTATISTICALDATA) != PEG_NOT_FOUND)      // Modification only allowed when Performance staticistics are active
     {  
         // the following is a temporary hack to set the value of the statistics  
         // gathering function dynamically.  We simply get the  value from input  
         // and call the internal method to set it each time this object is  
         // built.  
 #ifndef PEGASUS_DISABLE_PERFINST #ifndef PEGASUS_DISABLE_PERFINST
         Boolean statisticsFlag = _getPropertyValue(modifiedIns, OM_GATHERSTATISTICALDATA, false);      // the only allowed modification is one property, statistical data
         CIMInstance instance;      Uint32 propListSize = propertyList.size();
         instance = _getInstanceCIMObjectManager(true, true, CIMPropertyList());      for(Uint32 i = 0, n = propertyList.size(); i < n; ++i)
       {
           if(propertyList[0] != OM_PROPERTY_GATHERSTATISTICALDATA)
           {
               throw CIMNotSupportedException(String("Only modification of ") +
                   OM_PROPERTY_GATHERSTATISTICALDATA.getString() + " allowed");
           }
       }
   
       /*
       Array<CIMName> plA;
       plA.append(CIMName(OM_PROPERTY_GATHERSTATISTICALDATA));
       CIMPropertyList allowedModifyPropertyList(plA);
   
       // returns only if no exception and there is property to modify.
       String errorMessage;
       if(!isModifyAllowed(context, instanceReference, modifiedIns,
           includeQualifiers, propertyList, allowedModifyPropertyList,
           errorMessage))
       {
           if(errorMessage.size() > 0)
           {
               throw CIMInvalidParameterException(errorMessage);
           }
           return;
       }*/
  
         if (statisticsFlag != _getPropertyValue(instance,  OM_GATHERSTATISTICALDATA, false))      Boolean statisticsFlag;
       CIMInstance myInstance;
   
       // We modify only if this property exists.
       // could either use the property from modifiedIns or simply replace
       // value in property from object manager.
       if (modifiedIns.findProperty(OM_PROPERTY_GATHERSTATISTICALDATA) !=
           PEG_NOT_FOUND)
       {
           myInstance = getObjectManagerInstance();
           if(myInstance.isUninitialized())
           {
               throw CIMObjectNotFoundException(instanceReference.toString());
           }
           statisticsFlag = getPropertyValue(modifiedIns,
               OM_PROPERTY_GATHERSTATISTICALDATA, false);
           // set the changed property into the instance
           setPropertyValue(myInstance, OM_PROPERTY_GATHERSTATISTICALDATA,
               statisticsFlag);
       }
       else
         {         {
             // set the changed property into the          // if statistics property not in place, simply exit. Nothing to do
             _setPropertyValue(instance, OM_GATHERSTATISTICALDATA, statisticsFlag);          // not considered an error
             // Modify the object on disk          PEG_METHOD_EXIT();
           return;
       }
       // Modify the instance on disk
             try             try
             {             {
                 _repository->modifyInstance(_operationNamespace,          repository->modifyInstance(instanceReference.getNameSpace(),
                                instance );              myInstance, false,  propertyList);
             }             }
             catch(const CIMException&)             catch(const CIMException&)
             {             {
                 // ATTN: KS generate log error if this not possible  
                 PEG_METHOD_EXIT();                 PEG_METHOD_EXIT();
                 throw;                 throw;
             }             }
             catch(const Exception&)             catch(const Exception&)
             {             {
                 // ATTN: Generate log error.  
                 PEG_METHOD_EXIT();                 PEG_METHOD_EXIT();
                 throw;                 throw;
             }             }
Line 2014 
Line 2655 
                 (statisticsFlag? "true" : "false"));                 (statisticsFlag? "true" : "false"));
             StatisticalData* sd = StatisticalData::current();             StatisticalData* sd = StatisticalData::current();
             sd->setCopyGSD(statisticsFlag);             sd->setCopyGSD(statisticsFlag);
         }      PEG_METHOD_EXIT();
         return;         return;
 #endif  
  
     }  #else
     PEG_METHOD_EXIT();     PEG_METHOD_EXIT();
     // ATTN Expand this defintion to be more precise since it allows only mod of  
     // one property and that property MUST be in the instance to be modifiable.  
     throw CIMNotSupportedException     throw CIMNotSupportedException
         (OM_GATHERSTATISTICALDATA.getString() + " modify operation not supported by Interop Provider");          (OM_PROPERTY_GATHERSTATISTICALDATA.getString() +
                   " modify operation not supported by Interop Provider");
   #endif
 } }
 //*************************************************************************** //***************************************************************************
   //***************************************************************************
 //                modifyInstance //                modifyInstance
 //*************************************************************************** //***************************************************************************
   //***************************************************************************
 void InteropProvider::modifyInstance(const OperationContext & context, void InteropProvider::modifyInstance(const OperationContext & context,
     const CIMObjectPath & instanceReference,     const CIMObjectPath & instanceReference,
     const CIMInstance& modifiedIns,     const CIMInstance& modifiedIns,
Line 2035 
Line 2677 
     const CIMPropertyList& propertyList,     const CIMPropertyList& propertyList,
     ResponseHandler & handler)     ResponseHandler & handler)
 { {
   
     PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,     PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,
             "InteropProvider::modifyInstance");             "InteropProvider::modifyInstance");
  
       AutoMutex autoMut(changeControlMutex);
   
     Tracer::trace(TRC_CONTROLPROVIDER, Tracer::LEVEL4,     Tracer::trace(TRC_CONTROLPROVIDER, Tracer::LEVEL4,
         "%s modifyInstance. instanceReference= %s, includeQualifiers= %s, PropertyList= %s",         "%s modifyInstance. instanceReference= %s, includeQualifiers= %s, PropertyList= %s",
         thisProvider,         thisProvider,
         (const char *) instanceReference.toString().getCString(),         (const char *) instanceReference.toString().getCString(),
         (const char *) _showBool(includeQualifiers).getCString(),          (const char *) boolToString(includeQualifiers).getCString(),
         (const char *) _showPropertyList(propertyList).getCString());          (const char *) propertyListToString(propertyList).getCString());
   
       // test for legal namespace for this provider. Exception if not
       namespaceSupported(instanceReference);
  
     // ATTN: KS 31 August 2004. This must test for privileged user.  
     _operationNamespace = instanceReference.getNameSpace();  
     CIMName className =  instanceReference.getClassName();     CIMName className =  instanceReference.getClassName();
     targetClass classEnum  = _verifyValidClassInput(instanceReference.getClassName());  
  
     String userName = _validateUserID(context);  
     // begin processing the request     // begin processing the request
     handler.processing();     handler.processing();
  
     if (classEnum == CIM_OBJECTMANAGER)      if (className.equal(PEGASUS_CLASSNAME_PG_OBJECTMANAGER))
     {     {
         modifyObjectManagerInstance(context, instanceReference,modifiedIns,         modifyObjectManagerInstance(context, instanceReference,modifiedIns,
             includeQualifiers, propertyList, handler);              includeQualifiers, propertyList);
         // for the moment allow modification of the statistics property only  
     }  
   
     else if (classEnum == PG_CIMXMLCOMMUNICATIONMECHANISM)  
     {  
   
         PEG_METHOD_EXIT();  
         throw CIMNotSupportedException  
             (className.getString() + " not supported by Interop Provider");  
     }  
     else if (classEnum == PG_NAMESPACE)  
     {  
 #ifdef PEGASUS_OS_OS400  
             MessageLoaderParms mparms("ControlProviders.InteropProvider.MODIFY_INSTANCE_NOT_ALLOWED",  
                                       "Modify instance operation not allowed by Interop Provider for class $0.",  
                                       PG_NAMESPACE_CLASSNAME.getString());  
             throw CIMNotSupportedException(mparms);  
 #else  
         // for the moment allow modification of the statistics property only  
         PEG_METHOD_EXIT();  
         throw CIMNotSupportedException  
             (className.getString() + " not supported by Interop Provider");  
 #endif  
     }     }
     else     else
     {     {
         PEGASUS_ASSERT(false);  // should never get here.          throw CIMNotSupportedException("Delete instance of class " +
             className.getString());
     }     }
  
     handler.complete();     handler.complete();
Line 2094 
Line 2714 
 } }
  
 //*************************************************************************** //***************************************************************************
   //***************************************************************************
 //                enumerateInstanceNames //                enumerateInstanceNames
 //*************************************************************************** //***************************************************************************
   //***************************************************************************
   
 void InteropProvider::enumerateInstanceNames( void InteropProvider::enumerateInstanceNames(
         const OperationContext & context,         const OperationContext & context,
         const CIMObjectPath & classReference,         const CIMObjectPath & classReference,
Line 2104 
Line 2727 
         PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,         PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,
                 "InteropProvider::enumerateInstanceNames()");                 "InteropProvider::enumerateInstanceNames()");
  
         // operation namespace needed internally to get class.      Tracer::trace(TRC_CONTROLPROVIDER, Tracer::LEVEL4,
         _operationNamespace = classReference.getNameSpace();          "%s enumerateInstanceNames. classReference= %s",
           thisProvider,
         targetClass classEnum  = _verifyValidClassInput(classReference.getClassName());          (const char *) classReference.toString().getCString());
  
         String userName = _validateUserID(context);      // test for legal namespace for this provider. Exception if not
       // namespaceSupported(classReference);
       // NOTE: Above is commented out because the routing tables will always
       // do the right thing and that's the only way requests get here.
  
         // begin processing the request         // begin processing the request
         handler.processing();         handler.processing();
  
         // Deliver a single instance because there should only be one instance.      Array<CIMInstance> instances = localEnumerateInstances(
         if (classEnum == CIM_OBJECTMANAGER)          context,
         {          classReference,
             CIMInstance instance = _getInstanceCIMObjectManager( true, true, CIMPropertyList());          CIMPropertyList());
             CIMObjectPath ref = _buildInstancePath(_operationNamespace,  
                 CIM_OBJECTMANAGER_CLASSNAME, instance);  
             handler.deliver(ref);  
             handler.complete();  
             PEG_METHOD_EXIT();  
             return;  
         }  
   
         // Deliver all possible instances of this class  
         if (classEnum == PG_CIMXMLCOMMUNICATIONMECHANISM)  
         {  
             Array<CIMInstance> instances = _buildInstancesPGCIMXMLCommunicationMechanism(true,  
                  true, CIMPropertyList());  
   
             for (Uint32 i = 0 ; i < instances.size() ; i++)  
             {  
                 CIMObjectPath ref = _buildInstancePath(_operationNamespace,  
                     PG_CIMXMLCOMMUNICATIONMECHANISM_CLASSNAME, instances[i]);  
                 handler.deliver(ref);  
             }  
             handler.complete();  
             PEG_METHOD_EXIT();  
             return;  
         }  
   
         if (classEnum == CIM_NAMESPACEINMANAGER)  
         {  
             handler.complete();  
             PEG_METHOD_EXIT();  
             return;  
         }  
  
         if (classEnum == PG_NAMESPACE)  
         {  
             Array<CIMInstance> instances = _getInstancesCIMNamespace(false,  
                                     false, CIMPropertyList());  
             CDEBUG("EvalNames. Found instances. Count= " << instances.size());  
             for (Uint32 i = 0 ; i < instances.size() ; i++)             for (Uint32 i = 0 ; i < instances.size() ; i++)
             {             {
                 CIMObjectPath ref = _buildInstancePath(_operationNamespace,          handler.deliver(instances[i].getPath());
                                             CIM_NAMESPACE_CLASSNAME, instances[i]);  
                 handler.deliver(ref);  
             }             }
  
             handler.complete();             handler.complete();
             PEG_METHOD_EXIT();             PEG_METHOD_EXIT();
             return;  
         }  
   
         if (classEnum == CIM_COMMMECHANISMFORMANAGERINST)  
         {  
             Array<CIMInstance> instances = _buildInstancesCommMechanismForManager();  
             for (Uint32 i = 0 ; i < instances.size() ; i++ )  
             {  
                 CIMObjectPath ref = _buildObjectPath(_operationNamespace,  
                         CIM_COMMMECHANISMFORMANAGER_CLASSNAME, instances[i]);  
                 handler.deliver(ref);  
             }  
         }  
   
         if (classEnum == CIM_NAMESPACEINMANAGERINST)  
         {  
             Array<CIMInstance> instances = _buildInstancesNamespaceInManager();  
             for (Uint32 i = 0 ; i < instances.size() ; i++ )  
             {  
                 CIMObjectPath ref = _buildObjectPath(_operationNamespace,  
                         CIM_NAMESPACEINMANAGER_CLASSNAME, instances[i]);  
                 handler.deliver(ref);  
             }  
         }  
   
   
         // ATTN: Exception response because of error  
         PEG_METHOD_EXIT();  
     }     }
  
 //************************************************************** //**************************************************************
 //************************************************************** //**************************************************************
 // Association Functions  // Associators Operation Call
 //************************************************************** //**************************************************************
 //************************************************************** //**************************************************************
  
Line 2213 
Line 2773 
         ObjectResponseHandler & handler)         ObjectResponseHandler & handler)
 { {
     PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,     PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,
             "InteropProvider::associatorNames()");              "InteropProvider::associators()");
         //throw CIMNotSupportedException("AssociationProvider::associators");      Tracer::trace(TRC_CONTROLPROVIDER, Tracer::LEVEL4,
           "%s associators. objectName= %s , assocClass= %s resultClass= %s role= %s resultRole %includeQualifiers= %s, includeClassOrigin= %s, PropertyList= %s",
           thisProvider,
           (const char *)objectName.toString().getCString(),
           (const char *)associationClass.getString().getCString(),
           (const char *)resultClass.getString().getCString(),
           (const char *)role.getCString(),
           (const char *)resultRole.getCString(),
           (const char *)boolToString(includeQualifiers).getCString(),
           (const char *) boolToString(includeClassOrigin).getCString(),
           (const char *)propertyListToString(propertyList).getCString());
   
       handler.processing();
       String originRole = role;
       String targetRole = resultRole;
       Array<CIMInstance> refs = localReferences(context, objectName,
           associationClass, originRole, targetRole, CIMPropertyList(),
           resultClass);
       for(Uint32 i = 0, n = refs.size(); i < n; ++i)
       {
           CIMInstance & currentRef = refs[i];
           CIMObjectPath currentTarget = getRequiredValue<CIMObjectPath>(
               currentRef, targetRole);
           CIMInstance tmpInstance = localGetInstance(context, currentTarget,
               propertyList);
           tmpInstance.setPath(currentTarget);
           handler.deliver(tmpInstance);
       }
       handler.complete();
   
       PEG_METHOD_EXIT();
 } }
  
   //**************************************************************
   //**************************************************************
   // AssociatorNames Operation Function
   //**************************************************************
   //**************************************************************
 void InteropProvider::associatorNames( void InteropProvider::associatorNames(
         const OperationContext & context,         const OperationContext & context,
         const CIMObjectPath & objectName,         const CIMObjectPath & objectName,
Line 2228 
Line 2823 
 { {
     PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,     PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,
             "InteropProvider::associatorNames()");             "InteropProvider::associatorNames()");
         //throw CIMNotSupportedException("AssociationProvider::associatorNames");  
       Tracer::trace(TRC_CONTROLPROVIDER, Tracer::LEVEL4,
           "%s associatorNames. objectName= %s , assocClass= %s resultClass= %s role= %s resultRole",
           thisProvider,
           (const char *)objectName.toString().getCString(),
           (const char *)associationClass.getString().getCString(),
           (const char *)resultClass.getString().getCString(),
           (const char *)role.getCString(),
           (const char *)resultRole.getCString());
   
       handler.processing();
           String originRole = role;
       String targetRole = resultRole;
       Array<CIMInstance> refs = localReferences(context, objectName,
           associationClass, originRole, targetRole, CIMPropertyList(),
           resultClass);
       for(Uint32 i = 0, n = refs.size(); i < n; ++i)
       {
           CIMInstance & currentRef = refs[i];
           CIMObjectPath currentTarget = getRequiredValue<CIMObjectPath>(
               currentRef, targetRole);
           handler.deliver(currentTarget);
 } }
       handler.complete();
       PEG_METHOD_EXIT();
   }
   
  
 void InteropProvider::references( void InteropProvider::references(
         const OperationContext & context,         const OperationContext & context,
Line 2243 
Line 2863 
 { {
     PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,     PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,
             "InteropProvider::references()");             "InteropProvider::references()");
         //throw CIMNotSupportedException("AssociationProvider::references");  
 }  
  
 void _filterAssocInstances(Array<CIMInstance>& instances,      Tracer::trace(TRC_CONTROLPROVIDER, Tracer::LEVEL4,
                       CIMName assocClassName,          "%s references. objectName= %s , resultClass= %s role= %s includeQualifiers= %s, includeClassOrigin= %s, PropertyList= %s",
                       String assocRole,          thisProvider,
                       CIMName resultClassName = CIMName(),          (const char *)objectName.toString().getCString(),
                       String resultRole = String::EMPTY)          (const char *)resultClass.getString().getCString(),
 {          (const char *)role.getCString(),
     return;          (const char *)boolToString(includeQualifiers).getCString(),
 }          (const char*) boolToString(includeClassOrigin).getCString(),
           (const char *)propertyListToString(propertyList).getCString());
  
       handler.processing();
       String tmpRole = role;
       String tmpTarget;
       Array<CIMInstance> refs =
           localReferences(context, objectName, resultClass, tmpRole, tmpTarget);
       for(Uint32 i = 0, n = refs.size(); i < n; ++i)
         handler.deliver((CIMObject)refs[i]);
       handler.complete();
       PEG_METHOD_EXIT();
   }
 void InteropProvider::referenceNames( void InteropProvider::referenceNames(
         const OperationContext & context,         const OperationContext & context,
         const CIMObjectPath & objectName,         const CIMObjectPath & objectName,
Line 2264 
Line 2893 
 { {
     PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,     PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,
             "InteropProvider::referenceNames()");             "InteropProvider::referenceNames()");
     CDEBUG("::referenceNames(): object= " << objectName.toString() << " result Class= " << resultClass.getString());  
  
     // operation namespace needed internally to get class.  
     _operationNamespace = objectName.getNameSpace();  
     String userName = _validateUserID(context);  
     // begin processing the request  
     handler.processing();     handler.processing();
  
     // determine if valid class result class      String tmpRole = role;
       String tmpTarget;
     CIMName targetAssocClassName = resultClass;      Array<CIMInstance> refs =
           localReferences(context, objectName, resultClass, tmpRole, tmpTarget);
       for(Uint32 i = 0, n = refs.size(); i < n; ++i)
       {
           handler.deliver(refs[i].getPath());
       }
  
     CIMName targetClassName = objectName.getClassName();      handler.complete();
  
     targetAssocClass classEnum  = _verifyValidAssocClassInput(targetAssocClassName);      PEG_METHOD_EXIT();
   }
  
     Array<CIMInstance> assocInstances;  bool InteropProvider::validAssocClassForObject(
       const CIMName & assocClass, const CIMName & originClass,
       const CIMNamespaceName & opNamespace,
       String & originProperty, String & targetProperty)
   {
       TARGET_CLASS assocClassEnum = translateClassInput(assocClass);
       TARGET_CLASS originClassEnum;
       if(assocClassEnum != PG_ELEMENTCONFORMSTOPROFILE)
       {
           originClassEnum = translateClassInput(originClass);
       }
       else
       {
           // First check the classes served by the Interop provider...
           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;
  
     if (classEnum == CIM_COMMMECHANISMFORMANAGERASSOC)              PEGASUS_ASSERT(conformingElements.size() ==
         assocInstances = _buildInstancesCommMechanismForManager();                  elementNamespaces.size());
               for(Uint32 i = 0, n = conformingElements.size(); i < n; ++i)
               {
                   CIMNameArray & elementList = conformingElements[i];
                   CIMNamespaceArray & namespaceList = elementNamespaces[i];
                   PEGASUS_ASSERT(elementList.size() == namespaceList.size());
                   for(Uint32 j = 0, m = elementList.size(); j < m; ++j)
                   {
                       CIMName & curElement = elementList[j];
                       if((curElement == originClass ||
                         curElement.getString().find(PEGASUS_DYNAMIC) == 0) &&
                         opNamespace == namespaceList[j])
                       {
                           found = true;
                           break;
                       }
                   }
                   if(found)
                       break;
               }
  
     if (classEnum == CIM_NAMESPACEINMANAGERASSOC)              if(!found)
         assocInstances = _buildInstancesNamespaceInManager();                  return false;
           }
       }
  
     _filterAssocInstances(assocInstances, resultClass, role);      CIMName expectedTargetRole;
       CIMName expectedOriginRole;
  
     for (Uint32 i = 0 ; i < assocInstances.size() ; i++ )      switch(assocClassEnum)
       {
         case PG_NAMESPACEINMANAGER:
             if(originClassEnum == PG_OBJECTMANAGER)
             {
                 expectedTargetRole = PROPERTY_DEPENDENT;
                 expectedOriginRole = PROPERTY_ANTECEDENT;
             }
             else if(originClassEnum == PG_NAMESPACE)
             {
                 expectedTargetRole = PROPERTY_ANTECEDENT;
                 expectedOriginRole = PROPERTY_DEPENDENT;
             }
             break;
         case PG_COMMMECHANISMFORMANAGER:
             if(originClassEnum == PG_OBJECTMANAGER)
     {     {
         CIMObjectPath ref = _buildObjectPath(_operationNamespace,                expectedTargetRole = PROPERTY_DEPENDENT;
                 targetAssocClassName, assocInstances[i]);                expectedOriginRole = PROPERTY_ANTECEDENT;
         CDEBUG("referenceNames returns: " << ref.toString());            }
         handler.deliver(ref);            else if(originClassEnum == PG_CIMXMLCOMMUNICATIONMECHANISM)
             {
                 expectedTargetRole = PROPERTY_ANTECEDENT;
                 expectedOriginRole = PROPERTY_DEPENDENT;
             }
             break;
         case PG_ELEMENTCONFORMSTOPROFILE:
             if(originClass.equal(PEGASUS_CLASSNAME_PG_REGISTEREDPROFILE))
             {
                 expectedTargetRole =
                     ELEMENTCONFORMSTOPROFILE_PROPERTY_MANAGEDELEMENT;
                 expectedOriginRole =
                     ELEMENTCONFORMSTOPROFILE_PROPERTY_CONFORMANTSTANDARD;
             }
             else
             {
                 expectedTargetRole =
                     ELEMENTCONFORMSTOPROFILE_PROPERTY_CONFORMANTSTANDARD;
                 expectedOriginRole =
                     ELEMENTCONFORMSTOPROFILE_PROPERTY_MANAGEDELEMENT;
             }
             break;
         case PG_SUBPROFILEREQUIRESPROFILE:
             if(originClassEnum == PG_REGISTEREDPROFILE)
             {
                 expectedTargetRole = PROPERTY_DEPENDENT;
                 expectedOriginRole = PROPERTY_ANTECEDENT;
             }
             else if(originClassEnum == PG_REGISTEREDSUBPROFILE)
             {
                 expectedTargetRole = PROPERTY_ANTECEDENT;
                 expectedOriginRole = PROPERTY_DEPENDENT;
             }
             break;
         case PG_ELEMENTSOFTWAREIDENTITY:
             if(originClassEnum == PG_SOFTWAREIDENTITY)
             {
                 expectedTargetRole = PROPERTY_DEPENDENT;
                 expectedOriginRole = PROPERTY_ANTECEDENT;
             }
             else if(originClassEnum == PG_REGISTEREDPROFILE ||
                 originClassEnum == PG_REGISTEREDSUBPROFILE)
             {
                 expectedTargetRole = PROPERTY_ANTECEDENT;
                 expectedOriginRole = PROPERTY_DEPENDENT;
             }
             break;
         case PG_INSTALLEDSOFTWAREIDENTITY:
             if(originClassEnum == PG_SOFTWAREIDENTITY)
             {
                 expectedTargetRole = INSTALLEDSOFTWAREIDENTITY_PROPERTY_SYSTEM;
                 expectedOriginRole =
                     INSTALLEDSOFTWAREIDENTITY_PROPERTY_INSTALLEDSOFTWARE;
             }
             else if(originClassEnum == PG_COMPUTERSYSTEM)
             {
                 expectedTargetRole =
                     INSTALLEDSOFTWAREIDENTITY_PROPERTY_INSTALLEDSOFTWARE;
                 expectedOriginRole = INSTALLEDSOFTWAREIDENTITY_PROPERTY_SYSTEM;
             }
             break;
         case PG_HOSTEDACCESSPOINT:
             if(originClassEnum == PG_COMPUTERSYSTEM)
             {
                 expectedTargetRole = PROPERTY_DEPENDENT;
                 expectedOriginRole = PROPERTY_ANTECEDENT;
             }
             else if(originClassEnum == PG_CIMXMLCOMMUNICATIONMECHANISM)
             {
                 expectedTargetRole = PROPERTY_ANTECEDENT;
                 expectedOriginRole = PROPERTY_DEPENDENT;
             }
         case PG_HOSTEDOBJECTMANAGER:
             if(originClassEnum == PG_COMPUTERSYSTEM)
             {
                 expectedTargetRole = PROPERTY_DEPENDENT;
                 expectedOriginRole = PROPERTY_ANTECEDENT;
             }
             else if(originClassEnum == PG_OBJECTMANAGER)
             {
                 expectedTargetRole = PROPERTY_ANTECEDENT;
                 expectedOriginRole = PROPERTY_DEPENDENT;
             }
             break;
         default:
             break;
     }     }
  
     handler.complete();      if(expectedTargetRole.isNull() ||
           expectedOriginRole.isNull())
       {
           return false;
       }
  
     PEG_METHOD_EXIT();      if(targetProperty.size() == 0)
     // Convert the instances to referenceNames response      {
           targetProperty = expectedTargetRole.getString();
       }
       else if(!expectedTargetRole.equal(targetProperty))
       {
          return false;
       }
   
       if(originProperty.size() == 0)
       {
           originProperty = expectedOriginRole.getString();
       }
       else if(!expectedOriginRole.equal(originProperty))
       {
          return false;
       }
       return true;
   }
   
   Array<CIMInstance> InteropProvider::localReferences(
       const OperationContext & context,
       const CIMObjectPath & objectName,
       const CIMName & assocClass,
       String & originProperty,
       String & targetProperty,
       const CIMPropertyList & propertyList,
       const CIMName & targetClass)
   {
       PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,
           "InteropProvider::localReferences()");
   
       Array<CIMInstance> instances;
       CIMName originClass = objectName.getClassName();
   
       Array<CIMName> targetSubclasses;
       CIMNamespaceName lastTargetNamespace;
       CIMNamespaceName originNamespace(objectName.getNameSpace());
   
       if(validAssocClassForObject(assocClass, objectName.getClassName(),
           originNamespace, originProperty, targetProperty))
       {
           Array<CIMInstance> localInstances = localEnumerateInstances(context,
               CIMObjectPath(hostName, originNamespace,
                   assocClass));
           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());
               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())
                       {
                           targetNamespace = originNamespace;
                           targetPath.setNameSpace(targetNamespace);
                       }
                       if(targetNamespace != lastTargetNamespace)
                       {
                           try
                           {
                               targetSubclasses = repository->enumerateClassNames(
                                   targetNamespace, targetClass, true);
                           }
                           catch(...)
                           {
                               // If an exception was thrown during enumeration,
                               // then the base class didn't exist in the
                               // namespace, so the target instance retrieved
                               // must not match the targetClass parameter.
                               continue;
                           }
                           targetSubclasses.append(targetClass);
                           lastTargetNamespace = targetNamespace;
                       }
   
                       // Try to find the targetPath's class in the search space
                       CIMName targetPathClass = targetPath.getClassName();
                       for(Uint32 j = 0, m = targetSubclasses.size(); j < m; ++j)
                       {
                           if(targetPathClass == targetSubclasses[j])
                           {
                               instances.append(currentInstance);
                               break;
                           }
                       }
                   }
                   else
                   {
                       instances.append(currentInstance);
                   }
               }
           }
       }
   
       PEG_METHOD_EXIT();
       return instances;
   }
   
   
   CIMInstance InteropProvider::buildRegisteredProfile(
       const String & instanceId,
       const String & profileName,
       const String & profileVersion,
       Uint16         profileOrganization,
       const String & otherProfileOrganization,
       const CIMClass & profileClass)
   {
       CIMInstance instance = profileClass.buildInstance(
           false, false, CIMPropertyList());
       setPropertyValue(instance, REGISTEREDPROFILE_PROPERTY_INSTANCEID,
           instanceId);
       setPropertyValue(instance, REGISTEREDPROFILE_PROPERTY_REGISTEREDNAME,
           profileName);
       setPropertyValue(instance, REGISTEREDPROFILE_PROPERTY_REGISTEREDVERSION,
           profileVersion);
       setPropertyValue(instance,
           REGISTEREDPROFILE_PROPERTY_REGISTEREDORGANIZATION,
           profileOrganization);
       if(profileOrganization == 1) // Other
       {
           setPropertyValue(instance,
               REGISTEREDPROFILE_PROPERTY_OTHERREGISTEREDORGANIZATION,
               otherProfileOrganization);
       }
   
       // Determine if this instance is a PG_RegisteredProfile and if SLP is
       // enabled in the configuration. If so, specify SLP as the advertise type.
       Array<Uint16> advertiseTypes;
       if(profileClass.getClassName() == PEGASUS_CLASSNAME_PG_REGISTEREDPROFILE)
       {
           ConfigManager* configManager = ConfigManager::getInstance();
           if (String::equal(configManager->getCurrentValue("slp"), "true"))
           {
               advertiseTypes.append(3); // Advertised via SLP
           }
           else
           {
               advertiseTypes.append(2); // Not advertised
           }
       }
       else
       {
           advertiseTypes.append(2); // Not advertised
       }
       setPropertyValue(instance,
           REGISTEREDPROFILE_PROPERTY_ADVERTISETYPES,
           advertiseTypes);
   
       CIMObjectPath objPath = instance.buildPath(profileClass);
       objPath.setHost(hostName);
       objPath.setNameSpace(PEGASUS_NAMESPACENAME_INTEROP);
       instance.setPath(objPath);
   
       return instance;
   }
   
   String translateValue(
       const String & value,
       const CIMName & propName,
       const CIMName & sourceQualifier,
       const CIMName & targetQualifier,
       const CIMClass & classDef)
   {
       String mappedValue(String::EMPTY);
       Uint32 index = classDef.findProperty(propName);
       if(index != PEG_NOT_FOUND)
       {
           CIMConstProperty prop = classDef.getProperty(index);
           index = prop.findQualifier(sourceQualifier);
           if(index != PEG_NOT_FOUND)
           {
               Array<String> valueMapQual;
               prop.getQualifier(index).getValue().get(valueMapQual);
               for(Uint32 i = 0, n = valueMapQual.size(); i < n; ++i)
               {
                   // If we have a match in the ValueMap qualifier, then get the
                   // related string from the Values qualifier
                   if(valueMapQual[i] == value)
                   {
                       index = prop.findQualifier(targetQualifier);
                       if(index != PEG_NOT_FOUND)
                       {
                           Array<String> valuesQual;
                           prop.getQualifier(index).getValue().get(
                               valuesQual);
                           mappedValue = valuesQual[i];
                       }
                       break;
                   }
               }
           }
       }
   
       return mappedValue;
   }
   
   inline String translateValue(Uint16 value, const CIMName & propName,
       const CIMName & sourceQualifier, const CIMName & targetQualifier,
       const CIMClass & classDef)
   {
       return translateValue(CIMValue(value).toString(), propName,
         sourceQualifier, targetQualifier, classDef);
   }
   
   inline String buildProfileInstanceId(const String & organization,
                                        const String & name,
                                        const String & version)
   {
       return organization + "+" + name + "+" + version;
   }
   
   String extractProfileInfo(const CIMInstance & profileCapabilities,
                             const CIMClass & capabilitiesClass,
                             const CIMClass & profileClass,
                             String & name,
                             String & version,
                             Uint16 & organization,
                             String & otherOrganization,
                             String & organizationName,
                             Array<String> & subprofileNames,
                             bool noSubProfileInfo = true)
   {
       Uint16 registeredProfile = getRequiredValue<Uint16>(profileCapabilities,
           PROFILECAPABILITIES_PROPERTY_REGISTEREDPROFILE);
   
       if(registeredProfile == 0) // Other
       {
           name = getRequiredValue<String>(profileCapabilities,
               PROFILECAPABILITIES_PROPERTY_OTHERREGISTEREDPROFILE);
           organizationName = getRequiredValue<String>(profileCapabilities,
               PROFILECAPABILITIES_PROPERTY_OTHERREGISTEREDORGANIZATION);
       }
       else
       {
           String mappedProfileName = translateValue(registeredProfile,
               PROFILECAPABILITIES_PROPERTY_REGISTEREDPROFILE,
               VALUEMAP_QUALIFIERNAME, VALUES_QUALIFIERNAME, capabilitiesClass);
           if(mappedProfileName.size() == 0)
           {
               throw CIMOperationFailedException(
                   profileCapabilities.getPath().toString() +
                   " has invalid property " +
                   PROFILECAPABILITIES_PROPERTY_REGISTEREDPROFILE.getString());
           }
   
           Uint32 index = mappedProfileName.find(Char16(':'));
           PEGASUS_ASSERT(index != PEG_NOT_FOUND);
           organizationName = mappedProfileName.subString(0, index);
           name = mappedProfileName.subString(index+1);
       }
   
       version = getRequiredValue<String>(profileCapabilities,
           PROFILECAPABILITIES_PROPERTY_PROFILEVERSION);
   
       if(!noSubProfileInfo)
       {
           Array<Uint16> registeredSubprofiles =
               getRequiredValue<Array<Uint16> >(profileCapabilities,
                   PROFILECAPABILITIES_PROPERTY_REGISTEREDSUBPROFILES);
           Array<String> otherRegisteredSubprofiles;
           Uint32 otherSubprofileIndex = profileCapabilities.findProperty(
               PROFILECAPABILITIES_PROPERTY_OTHERREGISTEREDSUBPROFILES);
           Uint32 numOtherSubprofiles = 0;
           if(otherSubprofileIndex != PEG_NOT_FOUND)
           {
               profileCapabilities.getProperty(otherSubprofileIndex).getValue().
                   get(otherRegisteredSubprofiles);
               numOtherSubprofiles = otherRegisteredSubprofiles.size();
           }
           otherSubprofileIndex = 0;
   
           for(Uint32 k = 0, x = registeredSubprofiles.size(); k < x; ++k)
           {
               Uint16 subprofileMapping = registeredSubprofiles[k];
               String subprofileName;
               if(subprofileMapping == 0) // "Other"
               {
                   if(otherSubprofileIndex == numOtherSubprofiles)
                   {
                       throw CIMOperationFailedException(
                           profileCapabilities.getPath().toString() +
                           " does not contain enough entries in property " +
                           PROFILECAPABILITIES_PROPERTY_OTHERREGISTEREDSUBPROFILES
                               .getString());
                   }
                   subprofileName =
                       otherRegisteredSubprofiles[otherSubprofileIndex++];
               }
               else
               {
                   subprofileName = translateValue(
                       subprofileMapping,
                       PROFILECAPABILITIES_PROPERTY_REGISTEREDSUBPROFILES,
                       VALUEMAP_QUALIFIERNAME, VALUES_QUALIFIERNAME,
                       capabilitiesClass);
                   if(subprofileName.size() == 0)
                   {
                       throw CIMOperationFailedException(
                           profileCapabilities.getPath().toString() +
                           " has invalid property " +
                           PROFILECAPABILITIES_PROPERTY_REGISTEREDSUBPROFILES.
                               getString());
                   }
   
                   Uint32 orgIndex = subprofileName.find(Char16(':'));
                   if(orgIndex != PEG_NOT_FOUND)
                       subprofileName = subprofileName.subString(orgIndex+1);
               }
   
               subprofileNames.append(subprofileName);
           }
       }
   
       String organizationMapping = translateValue(organizationName,
           REGISTEREDPROFILE_PROPERTY_REGISTEREDORGANIZATION,
           VALUES_QUALIFIERNAME, VALUEMAP_QUALIFIERNAME, profileClass);
       if(organizationMapping.size() == 0)
       {
           organization = 1;
           otherOrganization = organizationName;
       }
       else
       {
           organization = atoi((const char *)organizationMapping.getCString());
           if(organization == 1)
             otherOrganization = organizationName;
       }
   
       return buildProfileInstanceId(organizationName, name, version);
   }
   
   inline CIMObjectPath buildAntecedentPath(
       const String & hostName,
       const String & antecedentId,
       const CIMName & antecedentClass)
   {
       Array<CIMKeyBinding> antecedentKeys;
       antecedentKeys.append(CIMKeyBinding(
           COMMON_PROPERTY_INSTANCEID,
           antecedentId,CIMKeyBinding::STRING));
   
       return CIMObjectPath(hostName,
           PEGASUS_NAMESPACENAME_INTEROP,
           antecedentClass,
           antecedentKeys);
   }
   
   inline CIMInstance buildDependencyInstanceFromPaths(
       const CIMObjectPath & antecedent,
       const CIMObjectPath & dependent,
       const CIMClass & dependencyClass)
   {
       CIMInstance dependencyInst = dependencyClass.buildInstance(false, false,
               CIMPropertyList());
       setPropertyValue(dependencyInst, PROPERTY_ANTECEDENT,
           CIMValue(antecedent));
       setPropertyValue(dependencyInst, PROPERTY_DEPENDENT,
           CIMValue(dependent));
       dependencyInst.setPath(dependencyInst.buildPath(dependencyClass));
       return dependencyInst;
   }
   
   CIMInstance InteropProvider::buildDependencyInstance(
       const String & antecedentId,
       const CIMName & antecedentClass,
       const String & dependentId,
       const CIMName & dependentClass,
       const CIMClass & depClass)
   {
       Array<CIMKeyBinding> dependentKeys;
   
       dependentKeys.append(CIMKeyBinding(
           COMMON_PROPERTY_INSTANCEID,
           dependentId,CIMKeyBinding::STRING));
   
       return buildDependencyInstanceFromPaths(
           buildAntecedentPath(hostName, antecedentId, antecedentClass),
           CIMObjectPath(hostName,
               PEGASUS_NAMESPACENAME_INTEROP,
               dependentClass,
               dependentKeys),
           depClass);
   }
   
   Array<CIMInstance> InteropProvider::getProfileInstances(
       const CIMName & profileType, const Array<String> & defaultSniaProfiles)
   {
       Array<CIMInstance> instances;
       bool isRequiresProfileOperation = profileType.equal(
           PEGASUS_CLASSNAME_PG_SUBPROFILEREQUIRESPROFILE);
       Array<CIMInstance> profileCapabilities = repository->enumerateInstances(
           PEGASUS_NAMESPACENAME_INTEROP,
           PEGASUS_CLASSNAME_PG_PROVIDERPROFILECAPABILITIES);
       Array<String> instanceIDs;
   
       CIMClass registeredProfileClass;
       CIMClass subprofileReqProfileClass;
       if(isRequiresProfileOperation)
       {
           registeredProfileClass = repository->getClass(
               PEGASUS_NAMESPACENAME_INTEROP,
               PEGASUS_CLASSNAME_PG_REGISTEREDPROFILE, false, true, false);
           subprofileReqProfileClass = repository->getClass(
               PEGASUS_NAMESPACENAME_INTEROP,
               PEGASUS_CLASSNAME_PG_SUBPROFILEREQUIRESPROFILE, false, true,
               false);
       }
       else
       {
           registeredProfileClass = repository->getClass(
               PEGASUS_NAMESPACENAME_INTEROP, profileType, false, true, false);
       }
   
       Uint32 i = 0;
       Uint32 n = profileCapabilities.size();
       for(; i < n; ++i)
       {
           // Extract the useful properties
           String profileName;
           Uint16 profileOrganization = 0;
           String otherOrganization;
           String profileVersion;
           String organizationName;
           bool justRegisteredProfileInfo = profileType.equal(
               PEGASUS_CLASSNAME_PG_REGISTEREDPROFILE);
           CIMInstance & currentCapabilities = profileCapabilities[i];
           Array<String> profileNames;
           String profileId = extractProfileInfo(currentCapabilities,
               profileCapabilitiesClass, registeredProfileClass, profileName,
               profileVersion, profileOrganization, otherOrganization,
               organizationName, profileNames, justRegisteredProfileInfo);
           Array<String> tmpInstanceIds;
   
           if(justRegisteredProfileInfo)
           {
               tmpInstanceIds.append(profileId);
               profileNames.append(profileName);
           }
           else
           {
               for(Uint32 j = 0, m = profileNames.size(); j < m; ++j)
               {
                   tmpInstanceIds.append(buildProfileInstanceId(organizationName,
                       profileNames[j], profileVersion));
               }
           }
   
           for(Uint32 j = 0, m = tmpInstanceIds.size(); j < m; ++j)
           {
               // See if we've already retrieved an equivalent RegisteredSubProfile
               bool unique = true;
               String tmpId;
               if(isRequiresProfileOperation)
                 tmpId = profileId + ":" + tmpInstanceIds[j];
               else
                 tmpId = tmpInstanceIds[j];
               for(Uint32 k = 0, x = instanceIDs.size(); k < x; ++k)
               {
                   if(instanceIDs[k] == tmpId)
                   {
                       unique = false;
                       break;
                   }
               }
   
               if(unique)
               {
                   if(isRequiresProfileOperation)
                   {
                       instances.append(buildDependencyInstance(
                           profileId,
                           PEGASUS_CLASSNAME_PG_REGISTEREDPROFILE,
                           tmpInstanceIds[j],
                           PEGASUS_CLASSNAME_PG_REGISTEREDSUBPROFILE,
                           subprofileReqProfileClass));
                   }
                   else
                   {
                       instances.append(buildRegisteredProfile(tmpId,
                           profileNames[j], profileVersion, profileOrganization,
                           otherOrganization, registeredProfileClass));
                   }
                   instanceIDs.append(tmpId);
               }
           }
       }
   
       for(i = 0, n = defaultSniaProfiles.size(); i < n; ++i)
       {
           if(isRequiresProfileOperation)
           {
               static String serverProfileId(buildProfileInstanceId(
                   SNIA_NAME, "Server", SNIA_VER_110));
               String subprofileId = buildProfileInstanceId(
                   SNIA_NAME, defaultSniaProfiles[i], SNIA_VER_110);
               String compoundId = serverProfileId + ":" + subprofileId;
               bool unique = true;
               for(Uint32 k = 0, x = instanceIDs.size(); k < x; ++k)
               {
                   if(instanceIDs[k] == compoundId)
                   {
                       unique = false;
                       break;
                   }
               }
   
               if(unique)
               {
                   instances.append(buildDependencyInstance(
                       serverProfileId, PEGASUS_CLASSNAME_PG_REGISTEREDPROFILE,
                       subprofileId,
                       PEGASUS_CLASSNAME_PG_REGISTEREDSUBPROFILE,
                       subprofileReqProfileClass));
               }
           }
           else
           {
                   // We always have the Indication Subprofile
                   const String & currentProfile = defaultSniaProfiles[i];
                   String instanceId = buildProfileInstanceId(SNIA_NAME,
                       defaultSniaProfiles[i], SNIA_VER_110);
                   bool defaultProfileUnique = true;
                   for(Uint32 j = 0, m = instanceIDs.size(); j < m; ++j)
                   {
                       if(instanceIDs[j] == instanceId)
                       {
                           defaultProfileUnique = false;
                           break;
                       }
                   }
   
                   if(defaultProfileUnique)
                   {
                       instances.append(buildRegisteredProfile(instanceId,
                           currentProfile, SNIA_VER_110, 11 /*"SNIA"*/, String::EMPTY,
                           registeredProfileClass));
                       instanceIDs.append(instanceId);
                   }
           }
       }
   
       return instances;
   }
   
   Array<CIMInstance> InteropProvider::enumRegisteredProfileInstances()
   {
       static String serverProfileName("Server");
       Array<String> defaultSubprofiles;
       defaultSubprofiles.append(serverProfileName);
   
       return getProfileInstances(PEGASUS_CLASSNAME_PG_REGISTEREDPROFILE,
           defaultSubprofiles);
   }
   
   String indicationProfileName("Indication");
   String softwareProfileName("Software");
   
   Array<CIMInstance> InteropProvider::enumRegisteredSubProfileInstances()
   {
       Array<String> defaultSubprofiles;
       defaultSubprofiles.append(indicationProfileName);
       defaultSubprofiles.append(softwareProfileName);
       return getProfileInstances(PEGASUS_CLASSNAME_PG_REGISTEREDSUBPROFILE,
           defaultSubprofiles);
   }
   
   Array<CIMInstance> InteropProvider::enumSubProfileRequiresProfileInstances()
   {
       Array<String> defaultSubprofiles;
       defaultSubprofiles.append(indicationProfileName);
       defaultSubprofiles.append(softwareProfileName);
       return getProfileInstances(PEGASUS_CLASSNAME_PG_SUBPROFILEREQUIRESPROFILE,
           defaultSubprofiles);
   }
   
   Array<CIMInstance> InteropProvider::enumReferencedProfileInstances()
   {
       Array<CIMInstance> instances;
   
       // We have to collect all the Registered Profiles and Subprofiles in
       // separate lists since the ProviderReferencedProfile instance does not
       // have information telling us whether its entries are subprofiles or
       // profiles.
       Array<String> allRegisteredProfileIds;
       Array<String> allSubprofileIds;
       Array<CIMInstance> allRegisteredProfiles = enumRegisteredProfileInstances();
       Array<CIMInstance> allSubprofiles = enumRegisteredSubProfileInstances();
       Uint32 i = 0;
       Uint32 n = allRegisteredProfiles.size();
       for(; i < n; ++i)
       {
           allRegisteredProfileIds.append(getRequiredValue<String>(
               allRegisteredProfiles[i], REGISTEREDPROFILE_PROPERTY_INSTANCEID));
       }
   
       for(i = 0, n = allSubprofiles.size(); i < n; ++i)
       {
           allSubprofileIds.append(getRequiredValue<String>(
               allSubprofiles[i], REGISTEREDPROFILE_PROPERTY_INSTANCEID));
       }
   
   
       Array<CIMInstance> referencedProfiles = repository->enumerateInstances(
           PEGASUS_NAMESPACENAME_INTEROP,
           PEGASUS_CLASSNAME_PG_PROVIDERREFERENCEDPROFILES);
   
       CIMClass providerRefProfileClass = repository->getClass(
               PEGASUS_NAMESPACENAME_INTEROP,
               PEGASUS_CLASSNAME_PG_PROVIDERREFERENCEDPROFILES,
               false, true, false);
       CIMClass referencedProfileClass = repository->getClass(
               PEGASUS_NAMESPACENAME_INTEROP,
               PEGASUS_CLASSNAME_PG_REFERENCEDPROFILE,
               false, true, false);
   
       Array<String> instanceIds;
       for(i = 0, n = referencedProfiles.size(); i < n; ++i)
       {
           CIMInstance & currentReferencedProfile = referencedProfiles[i];
           Array<Uint16> registeredProfiles = getRequiredValue<Array<Uint16> >(
               currentReferencedProfile,
               REFERENCEDPROFILES_PROPERTY_REGISTEREDPROFILES);
           Array<Uint16> dependentProfiles = getRequiredValue<Array<Uint16> >(
               currentReferencedProfile,
               REFERENCEDPROFILES_PROPERTY_DEPENDENTPROFILES);
           Array<String> profileVersions = getRequiredValue<Array<String> >(
               currentReferencedProfile,
               REFERENCEDPROFILES_PROPERTY_REGISTEREDPROFILEVERSIONS);
           Array<String> dependentVersions = getRequiredValue<Array<String> >(
               currentReferencedProfile,
               REFERENCEDPROFILES_PROPERTY_DEPENDENTPROFILEVERSIONS);
   
           Uint32 m = registeredProfiles.size();
           if(m != dependentProfiles.size() || m != profileVersions.size() ||
               m != dependentVersions.size())
           {
               throw CIMOperationFailedException(
                   currentReferencedProfile.getPath().toString() +
                   " mismatch in num values between corresponding properties");
           }
   
           Uint32 otherProfilesIndex = 0;
           Uint32 otherDependentsIndex = 0;
           Uint32 numOtherProfiles = 0;
           Uint32 numOtherDependents = 0;
           Array<String> otherProfiles;
           Array<String> otherDependentProfiles;
           Array<String> otherProfileOrganizations;
           Array<String> otherDependentOrganizations;
           Uint32 index = currentReferencedProfile.findProperty(
               REFERENCEDPROFILES_PROPERTY_OTHERREGISTEREDPROFILES);
           if(index != PEG_NOT_FOUND)
           {
               currentReferencedProfile.getProperty(index).getValue().get(
                   otherProfiles);
               numOtherProfiles = otherProfiles.size();
           }
   
           index = currentReferencedProfile.findProperty(
               REFERENCEDPROFILES_PROPERTY_OTHERDEPENDENTPROFILES);
           if(index != PEG_NOT_FOUND)
           {
               currentReferencedProfile.getProperty(index).getValue().get(
                   otherDependentProfiles);
               numOtherDependents = otherDependentProfiles.size();
           }
   
           index = currentReferencedProfile.findProperty(
               REFERENCEDPROFILES_PROPERTY_OTHERREGISTEREDPROFILEORGANIZATIONS);
           if(index != PEG_NOT_FOUND)
           {
               currentReferencedProfile.getProperty(index).getValue().get(
                   otherProfileOrganizations);
           }
   
           index = currentReferencedProfile.findProperty(
               REFERENCEDPROFILES_PROPERTY_OTHERDEPENDENTPROFILEORGANIZATIONS);
           if(index != PEG_NOT_FOUND)
           {
               currentReferencedProfile.getProperty(index).getValue().get(
                   otherDependentOrganizations);
           }
   
           if(otherDependentOrganizations.size() != numOtherDependents ||
               otherProfileOrganizations.size() != numOtherProfiles)
           {
               throw CIMOperationFailedException(
                   currentReferencedProfile.getPath().toString() +
                   " mismatch in num values between corresponding properties");
           }
   
           for(Uint32 j = 0; j < m; ++j)
           {
               Uint16 currentProfile = registeredProfiles[j];
               Uint16 currentDependent = dependentProfiles[j];
               String profileName;
               String dependentName;
               String profileOrgName;
               String dependentOrgName;
               if(currentProfile == 0) // Other
               {
                   if(otherProfilesIndex == numOtherProfiles)
                   {
                       throw CIMOperationFailedException(
                           currentReferencedProfile.getPath().toString() +
                           " not enough entries in property " +
                           REFERENCEDPROFILES_PROPERTY_OTHERREGISTEREDPROFILES.
                               getString());
                   }
   
                   profileName = otherProfiles[otherProfilesIndex];
                   profileOrgName =
                       otherProfileOrganizations[otherProfilesIndex++];
               }
               else
               {
                 /*
                 translateValue(const String & value, const CIMName & propName,
                         const CIMName & sourceQualifier,
                         const CIMName & targetQualifier,
                         const CIMClass & classDef)
                 */
                   profileName = translateValue(currentProfile,
                       REFERENCEDPROFILES_PROPERTY_REGISTEREDPROFILES,
                       VALUEMAP_QUALIFIERNAME, VALUES_QUALIFIERNAME,
                       providerRefProfileClass);
                   Uint32 index = profileName.find(Char16(':'));
                   PEGASUS_ASSERT(index != PEG_NOT_FOUND);
                   profileOrgName = profileName.subString(0, index);
                   profileName = profileName.subString(index+1);
               }
   
               if(currentDependent == 0) // Other
               {
                   if(otherDependentsIndex == numOtherDependents)
                   {
                       throw CIMOperationFailedException(
                           currentReferencedProfile.getPath().toString() +
                           " not enough entries in property " +
                           REFERENCEDPROFILES_PROPERTY_OTHERDEPENDENTPROFILES.
                               getString());
                   }
   
                   dependentName = otherDependentProfiles[otherDependentsIndex];
                   dependentOrgName =
                       otherDependentOrganizations[otherDependentsIndex++];
               }
               else
               {
                   dependentName = translateValue(currentProfile,
                       REFERENCEDPROFILES_PROPERTY_DEPENDENTPROFILES,
                       VALUEMAP_QUALIFIERNAME, VALUES_QUALIFIERNAME,
                       providerRefProfileClass);
                   Uint32 index = dependentName.find(Char16(':'));
                   PEGASUS_ASSERT(index != PEG_NOT_FOUND);
                   dependentOrgName = dependentName.subString(0, index);
                   dependentName = dependentName.subString(index+1);
               }
   
               String profileId = buildProfileInstanceId(profileOrgName,
                   profileName, profileVersions[j]);
               String dependentId = buildProfileInstanceId(dependentOrgName,
                   dependentName, dependentVersions[j]);
               String instanceId = profileId + ":" + dependentId;
               bool unique = true;
               for(Uint32 k = 0, x = instanceIds.size(); k < x; ++k)
               {
                   if(instanceIds[k] == instanceId)
                   {
                       unique = false;
                       break;
                   }
               }
   
               if(unique)
               {
                   // Now find out whether it is a Profile or Subprofile
                   const CIMName * profileType = 0;
                   const CIMName * dependentType = 0;
                   for(Uint32 k = 0, x = allRegisteredProfileIds.size();
                       k < x; ++k)
                   {
                       if(allRegisteredProfileIds[k] == profileId)
                       {
                           profileType =
                               &PEGASUS_CLASSNAME_PG_REGISTEREDPROFILE;
                           if(dependentType != 0)
                               break;
                       }
                       else if(allRegisteredProfileIds[k] == dependentId)
                       {
                           dependentType =
                               &PEGASUS_CLASSNAME_PG_REGISTEREDPROFILE;
                           if(profileType != 0)
                               break;
                       }
                   }
   
                   instanceIds.append(instanceId);
                   if(profileType == 0)
                       profileType = &PEGASUS_CLASSNAME_PG_REGISTEREDSUBPROFILE;
                   if(dependentType == 0)
                       dependentType = &PEGASUS_CLASSNAME_PG_REGISTEREDSUBPROFILE;
                   instances.append(buildDependencyInstance(profileId,
                       *profileType, dependentId, *dependentType,
                       referencedProfileClass));
               }
           }
       }
       return instances;
   }
   
   Array<String> findProviderNamespacesForElement(
       const String & moduleName, const String & providerName,
       const CIMName & elementClass, CIMRepository * repository,
       Array<CIMInstance> & providerCapabilitiesInstances)
   {
       Array<CIMInstance> capabilities;
       if(providerCapabilitiesInstances.size() == 0)
       {
           Array<CIMName> propList;
           propList.append(PROVIDERCAPABILITIES_PROPERTY_PROVIDERMODULENAME);
           propList.append(PROVIDERCAPABILITIES_PROPERTY_PROVIDERNAME);
           propList.append(PROVIDERCAPABILITIES_PROPERTY_NAMESPACES);
           propList.append(PROVIDERCAPABILITIES_PROPERTY_CLASSNAME);
           capabilities = repository->enumerateInstances(
               PEGASUS_NAMESPACENAME_INTEROP,
               PEGASUS_CLASSNAME_PROVIDERCAPABILITIES, true, true, false, false);
       }
       else
       {
           capabilities = providerCapabilitiesInstances;
       }
   
       for(Uint32 i = 0, n = capabilities.size(); i < n; ++i)
       {
           CIMInstance & currentCapabilities = capabilities[i];
           Uint32 propIndex = currentCapabilities.findProperty(
               PROVIDERCAPABILITIES_PROPERTY_PROVIDERMODULENAME);
           PEGASUS_ASSERT(propIndex != PEG_NOT_FOUND);
           String currentName;
           currentCapabilities.getProperty(propIndex).getValue().get(
               currentName);
           if(currentName == moduleName)
           {
               propIndex = currentCapabilities.findProperty(
                   PROVIDERCAPABILITIES_PROPERTY_PROVIDERNAME);
               PEGASUS_ASSERT(propIndex != PEG_NOT_FOUND);
               currentCapabilities.getProperty(propIndex).getValue().get(
                   currentName);
               if(currentName == providerName)
               {
                   propIndex = currentCapabilities.findProperty(
                       PROVIDERCAPABILITIES_PROPERTY_CLASSNAME);
                   PEGASUS_ASSERT(propIndex != PEG_NOT_FOUND);
                   currentCapabilities.getProperty(propIndex).getValue().get(
                       currentName);
                   if(elementClass.equal(CIMName(currentName)))
                   {
                       propIndex = currentCapabilities.findProperty(
                         PROVIDERCAPABILITIES_PROPERTY_NAMESPACES);
                       PEGASUS_ASSERT(propIndex != PEG_NOT_FOUND);
                       Array<String> namespaces;
                       currentCapabilities.getProperty(propIndex).getValue().get(
                           namespaces);
                       return namespaces;
                   }
               }
           }
       }
   
       throw PEGASUS_CIM_EXCEPTION(CIM_ERR_NOT_FOUND,
           "Could not find provider capabilities registered for module " +
           moduleName + ", provider " + providerName + ", and class " +
           elementClass.getString());
   }
   
   CIMInstance buildElementConformsToProfile(
       const CIMObjectPath & currentProfile,
       const CIMObjectPath & currentElement,
       const CIMClass & elementConformsClass)
   {
       Array<CIMName> elementPropArray;
       elementPropArray.append(
           ELEMENTCONFORMSTOPROFILE_PROPERTY_CONFORMANTSTANDARD);
       elementPropArray.append(
           ELEMENTCONFORMSTOPROFILE_PROPERTY_MANAGEDELEMENT);
       CIMPropertyList elementPropList(elementPropArray);
   
       CIMInstance tmpInstance =
           elementConformsClass.buildInstance(false, false,
               elementPropList);
       setPropertyValue(tmpInstance,
           ELEMENTCONFORMSTOPROFILE_PROPERTY_CONFORMANTSTANDARD,
           currentProfile);
       setPropertyValue(tmpInstance,
           ELEMENTCONFORMSTOPROFILE_PROPERTY_MANAGEDELEMENT,
           currentElement);
       tmpInstance.setPath(tmpInstance.buildPath(
           elementConformsClass));
       return tmpInstance;
   }
   
   Array<CIMInstance> InteropProvider::enumElementConformsToProfileInstances(
       const OperationContext & opContext, const CIMNamespaceName & opNamespace)
   {
       CIMClass elementConformsClass = repository->getClass(
           PEGASUS_NAMESPACENAME_INTEROP,
           PEGASUS_CLASSNAME_PG_ELEMENTCONFORMSTOPROFILE,
           false, true, false);
   
       AutoMutex holder(interopMut);
       Array<CIMInstance> instances;
       verifyCachedInfo();
       for(Uint32 i = 0, n = profileIds.size(); i < n; ++i)
       {
           String & profileId = profileIds[i];
           Array<CIMName> & elementList = conformingElements[i];
           Array<CIMNamespaceName> & namespaceList = elementNamespaces[i];
           Array<CIMObjectPath> conformingElementPaths;
           for(Uint32 j = 0, m = elementList.size(); j < m; ++j)
           {
               CIMName & currentElement = elementList[j];
               CIMNamespaceName & currentNamespace = namespaceList[j];
   
               if(opNamespace == PEGASUS_NAMESPACENAME_INTEROP ||
                   opNamespace == currentNamespace)
               {
                   String currentElementStr(currentElement.getString());
                   if(currentElementStr.find(PEGASUS_DYNAMIC) == 0)
                   {
                       // If the provider profile registration did not provide a
                       // list of conforming elements (presumably because there is
                       // no such definite list), then the provider is required
                       // to provide instances of ElementConformsToProfile in the
                       // vendor namespace, so we do not generate instances.
                       if(opNamespace != PEGASUS_NAMESPACENAME_INTEROP)
                       {
                           continue;
                       }
                       CIMName subclassName(
                           currentElementStr.subString(PEGASUS_DYNAMIC_LEN));
                       Array<CIMInstance> elementConformsInstances =
                           cimomHandle.enumerateInstances(opContext,
                           currentNamespace, subclassName, true, false, false,
                           true, CIMPropertyList());
   
                       // Retrieve the Conforming Element
                       for(Uint32 k = 0, x = elementConformsInstances.size();
                           k < x; ++k)
                       {
                           CIMInstance & currentInstance =
                               elementConformsInstances[k];
   
                           // Make sure that the current instance points to the
                           // current profile ID.
                           CIMObjectPath profilePath =
                               getRequiredValue<CIMObjectPath>(
                                   elementConformsInstances[k],
                                   ELEMENTCONFORMSTOPROFILE_PROPERTY_CONFORMANTSTANDARD);
                           const Array<CIMKeyBinding> & keys =
                               profilePath.getKeyBindings();
                           if(keys.size() != 1)
                               continue;
                           if(keys.size() == 1 && keys[0].getValue() == profileId)
                           {
                               conformingElementPaths.append(
                                   getRequiredValue<CIMObjectPath>(
                                   currentInstance,
                                   ELEMENTCONFORMSTOPROFILE_PROPERTY_MANAGEDELEMENT));
                           }
                       }
                   }
                   else
                   {
                       Array<CIMObjectPath> paths =
                           cimomHandle.enumerateInstanceNames(opContext,
                               currentNamespace, currentElement);
                       // Set the namespace in the paths just in case
                       for(Uint32 k = 0, x = paths.size();
                           k < x; ++k)
                       {
                           CIMObjectPath & curPath = paths[k];
                           curPath.setNameSpace(currentNamespace);
                           curPath.setHost(hostName);
                       }
                       conformingElementPaths.appendArray(paths);
                   }
               }
           }
   
           Array<CIMKeyBinding> profileKeys;
           profileKeys.append(CIMKeyBinding(
               REGISTEREDPROFILE_PROPERTY_INSTANCEID,
               profileIds[i],
               CIMKeyBinding::STRING));
           CIMObjectPath profilePath(hostName, PEGASUS_NAMESPACENAME_INTEROP,
               PEGASUS_CLASSNAME_PG_REGISTEREDPROFILE,
               profileKeys);
   
           for(Uint32 k = 0, x = conformingElementPaths.size(); k < x; ++k)
           {
               instances.append(buildElementConformsToProfile(profilePath,
                   conformingElementPaths[k], elementConformsClass));
           }
       }
   
   
   
       // Now add the default instance: the association between the Server Profile
       // and the ObjectManager (if we're in the Interop namespace)
       if(opNamespace == PEGASUS_NAMESPACENAME_INTEROP)
       {
           // Build up the Object Path for the server profile
           Array<CIMKeyBinding> profileKeys;
           profileKeys.append(CIMKeyBinding(
               REGISTEREDPROFILE_PROPERTY_INSTANCEID,
               buildProfileInstanceId(SNIA_NAME, "Server", SNIA_VER_110),
               CIMKeyBinding::STRING));
           CIMObjectPath serverProfile(hostName,
                 PEGASUS_NAMESPACENAME_INTEROP,
                 PEGASUS_CLASSNAME_PG_REGISTEREDPROFILE,
                 profileKeys);
           // Retrieve the Object Manager instance
           CIMInstance objManager = getObjectManagerInstance();
   
           instances.append(buildElementConformsToProfile(serverProfile,
               objManager.getPath(), elementConformsClass));
       }
   
       return instances;
   }
   
   CIMInstance InteropProvider::buildSoftwareIdentity(
           const String & module,
           const String & provider,
           const String & vendor,
           const String & version,
           Uint16 majorVersion,
           Uint16 minorVersion,
           Uint16 revisionNumber,
           Uint16 buildNumber,
           bool extendedVersionSupplied,
           const String & interfaceType)
   {
       String instanceId(module + "+" + provider);
       String name(provider + " (" + interfaceType + ")");
   
       // Use double-ifs to prevent locking for every request
       if(softwareIdentityClass.isUninitialized())
       {
           AutoMutex autoMut(interopMut);
           if(softwareIdentityClass.isUninitialized())
           {
               softwareIdentityClass = repository->getClass(
                   PEGASUS_NAMESPACENAME_INTEROP,
                   PEGASUS_CLASSNAME_PG_SOFTWAREIDENTITY, false, true, false);
           }
       }
   
       CIMInstance softwareIdentity = softwareIdentityClass.buildInstance(false,
           false, CIMPropertyList());
   
       setPropertyValue(softwareIdentity, SOFTWAREIDENTITY_PROPERTY_INSTANCEID,
           instanceId);
       setPropertyValue(softwareIdentity, SOFTWAREIDENTITY_PROPERTY_NAME, name);
       setPropertyValue(softwareIdentity, SOFTWAREIDENTITY_PROPERTY_VERSION,
           version);
       setPropertyValue(softwareIdentity, SOFTWAREIDENTITY_PROPERTY_MANUFACTURER,
           vendor);
       setPropertyValue(softwareIdentity,
           SOFTWAREIDENTITY_PROPERTY_CLASSIFICATIONS, providerClassifications);
       if(extendedVersionSupplied)
       {
           setPropertyValue(softwareIdentity,
               SOFTWAREIDENTITY_PROPERTY_MAJORVERSION, majorVersion);
           setPropertyValue(softwareIdentity,
               SOFTWAREIDENTITY_PROPERTY_MINORVERSION, minorVersion);
           setPropertyValue(softwareIdentity,
               SOFTWAREIDENTITY_PROPERTY_REVISIONNUMBER, revisionNumber);
           setPropertyValue(softwareIdentity,
               SOFTWAREIDENTITY_PROPERTY_BUILDNUMBER, buildNumber);
       }
   
       softwareIdentity.setPath(softwareIdentity.buildPath(softwareIdentityClass));
   
       return softwareIdentity;
   }
   
   void InteropProvider::extractSoftwareIdentityInfo(
       const CIMInstance & providerInstance,
       String & moduleName,
       String & providerName,
       String & vendor,
       String & version,
       Uint16 & majorVersion,
       Uint16 & minorVersion,
       Uint16 & revisionNumber,
       Uint16 & buildNumber,
       bool & extendedVersionSupplied,
       String & interfaceType)
   {
       // Get the module and provider name from the PG_ProviderInstance supplied
       moduleName = getRequiredValue<String>(providerInstance,
           PROVIDER_PROPERTY_PROVIDERMODULENAME);
       providerName = getRequiredValue<String>(providerInstance,
           PROVIDER_PROPERTY_NAME);
   
       // Now retrieve the software info from the desired PG_ProviderModule
       Array<CIMName> propertyList;
       propertyList.append(PROVIDERMODULE_PROPERTY_NAME);
       propertyList.append(PROVIDERMODULE_PROPERTY_VENDOR);
       propertyList.append(PROVIDERMODULE_PROPERTY_VERSION);
       propertyList.append(PROVIDERMODULE_PROPERTY_INTERFACETYPE);
       Array<CIMInstance> providerModules = repository->enumerateInstances(
           PEGASUS_NAMESPACENAME_INTEROP, PEGASUS_CLASSNAME_PROVIDERMODULE,
           true, true, false, false, CIMPropertyList(propertyList));
   
       Uint32 moduleIndex = PEG_NOT_FOUND;
       for(Uint32 i = 0, n = providerModules.size(); i < n; ++i)
       {
           CIMInstance & currentModule = providerModules[i];
           Uint32 index = currentModule.findProperty(
               PROVIDERMODULE_PROPERTY_NAME);
           if(index != PEG_NOT_FOUND)
           {
               String currentModuleName;
               currentModule.getProperty(index).getValue().get(currentModuleName);
               if(moduleName == currentModuleName)
               {
                   moduleIndex = i;
                   break;
               }
           }
       }
       if(moduleIndex == PEG_NOT_FOUND)
       {
           throw CIMOperationFailedException(
               "Could not retrieve provider module for provider " +
               providerInstance.getPath().toString());
       }
   
       CIMInstance & providerModule = (CIMInstance &)providerModules[moduleIndex];
   
       version = getRequiredValue<String>(providerModule,
           PROVIDERMODULE_PROPERTY_VERSION);
       vendor = getRequiredValue<String>(providerModule,
           PROVIDERMODULE_PROPERTY_VENDOR);
       interfaceType = getRequiredValue<String>(providerModule,
           PROVIDERMODULE_PROPERTY_INTERFACETYPE);
   
       // Now see if optional extended version information is available
       extendedVersionSupplied = false;
       Uint32 majorIndex = providerInstance.findProperty(
           PROVIDERMODULE_PROPERTY_MAJORVERSION);
       if(majorIndex != PEG_NOT_FOUND)
       {
           CIMValue majorValue = providerInstance.getProperty(majorIndex).getValue();
           if(!majorValue.isNull())
           {
               extendedVersionSupplied = true;
               majorValue.get(majorVersion);
               minorVersion = 0;
               revisionNumber = 0;
               buildNumber = 0;
   
               // Get the Version if present
               Uint32 index = providerInstance.findProperty(
                   PROVIDERMODULE_PROPERTY_VERSION);
               if(index != PEG_NOT_FOUND)
               {
                   CIMValue propValue =
                     providerInstance.getProperty(index).getValue();
                   if(!propValue.isNull())
                   {
                       propValue.get(version);
                   }
               }
   
               // Get the Minor version if present
               index = providerInstance.findProperty(
                   PROVIDERMODULE_PROPERTY_MINORVERSION);
               if(index != PEG_NOT_FOUND)
               {
                   CIMValue propValue =
                     providerInstance.getProperty(index).getValue();
                   if(!propValue.isNull())
                   {
                       propValue.get(minorVersion);
                   }
               }
   
               // Get the revision number if present
               index = providerInstance.findProperty(
                   PROVIDERMODULE_PROPERTY_REVISIONNUMBER);
               if(index != PEG_NOT_FOUND)
               {
                   CIMValue propValue =
                     providerInstance.getProperty(index).getValue();
                   if(!propValue.isNull())
                   {
                       propValue.get(revisionNumber);
                   }
               }
   
               // Get the build number if present
               index = providerInstance.findProperty(
                       PROVIDERMODULE_PROPERTY_BUILDNUMBER);
               if(index != PEG_NOT_FOUND)
               {
                   CIMValue propValue =
                     providerInstance.getProperty(index).getValue();
                   if(!propValue.isNull())
                   {
                       propValue.get(buildNumber);
                   }
               }
           }
       }
   }
   
   Array<CIMInstance> InteropProvider::enumSoftwareIdentityInstances()
   {
       Array<CIMInstance> instances;
   
       Array<CIMInstance> registeredProviders = repository->enumerateInstances(
           PEGASUS_NAMESPACENAME_INTEROP, PEGASUS_CLASSNAME_PROVIDER);
       for(Uint32 i = 0, n = registeredProviders.size(); i < n; ++i)
       {
           String moduleName;
           String providerName;
           String version;
           String vendor;
           String interfaceType;
           Uint16 majorVersion;
           Uint16 minorVersion;
           Uint16 revisionNumber;
           Uint16 buildNumber;
           bool extendedVersionInfo;
           extractSoftwareIdentityInfo(registeredProviders[i], moduleName,
               providerName, vendor, version, majorVersion, minorVersion,
               revisionNumber, buildNumber, extendedVersionInfo, interfaceType);
   
           instances.append(buildSoftwareIdentity(moduleName, providerName,
               vendor, version, majorVersion, minorVersion, revisionNumber,
               buildNumber, extendedVersionInfo, interfaceType));
       }
   
       // Always have the Interop provider
       instances.append(buildSoftwareIdentity(PEGASUS_MODULE_NAME,
           INTEROP_PROVIDER_NAME, PEGASUS_CIMOM_GENERIC_NAME,
           PEGASUS_PRODUCT_VERSION,
           0, 0, 0, 0, false, // no extended revision info
           PEGASUS_INTERNAL_PROVIDER_TYPE));
       return instances;
   }
   
   Array<CIMInstance> InteropProvider::enumElementSoftwareIdentityInstances()
   {
       Array<CIMInstance> instances;
   
       Array<CIMInstance> profileCapabilities = repository->enumerateInstances(
           PEGASUS_NAMESPACENAME_INTEROP,
           PEGASUS_CLASSNAME_PG_PROVIDERPROFILECAPABILITIES);
   
       CIMClass elementSoftwareIdentityClass = repository->getClass(
           PEGASUS_NAMESPACENAME_INTEROP,
           PEGASUS_CLASSNAME_PG_ELEMENTSOFTWAREIDENTITY, false, true, false);
   
       CIMObjectPath csPath = getComputerSystemInstance().getPath();
   
       for(Uint32 i = 0, n = profileCapabilities.size(); i < n; ++i)
       {
           CIMInstance & currentCapabilities = profileCapabilities[i];
           String version;
           String organizationName;
           Array<String> subprofiles;
           String dummyStr;
           Uint16 dummyInt = 0;
           String profileId = extractProfileInfo(currentCapabilities,
               profileCapabilitiesClass,
               repository->getClass(PEGASUS_NAMESPACENAME_INTEROP,
                   PEGASUS_CLASSNAME_PG_REGISTEREDPROFILE, false, true, false),
               dummyStr, // Throw away profile name
               version,
               dummyInt, // Throw away organization enum
               dummyStr, // Throw away otherOrganization, we get it below
               organizationName,
               subprofiles,
               false); // Get subprofile information
           String moduleName = getRequiredValue<String>(currentCapabilities,
               CAPABILITIES_PROPERTY_PROVIDERMODULENAME);
           String providerName = getRequiredValue<String>(currentCapabilities,
               CAPABILITIES_PROPERTY_PROVIDERNAME);
   
           String softwareInstanceId = moduleName + "+" + providerName;
           instances.append(buildDependencyInstance(
               softwareInstanceId,
               PEGASUS_CLASSNAME_PG_SOFTWAREIDENTITY,
               profileId,
               PEGASUS_CLASSNAME_PG_REGISTEREDPROFILE,
               elementSoftwareIdentityClass));
   
           for(Uint32 j = 0, m = subprofiles.size(); j < m; ++j)
           {
               instances.append(buildDependencyInstance(
                   softwareInstanceId,
                   PEGASUS_CLASSNAME_PG_SOFTWAREIDENTITY,
                   buildProfileInstanceId(organizationName, subprofiles[j],
                       version),
                   PEGASUS_CLASSNAME_PG_REGISTEREDSUBPROFILE,
                   elementSoftwareIdentityClass));
           }
       }
   
       // Create default association between Server profile, Indications
       // subprofile, and the Pegasus Interoperability provider software identity
       String interopSoftwareIdentity = PEGASUS_MODULE_NAME + "+" +
           INTEROP_PROVIDER_NAME;
       String serverProfileId = buildProfileInstanceId(SNIA_NAME, "Server",
           SNIA_VER_110);
       String indicationProfileId = buildProfileInstanceId(SNIA_NAME,
           "Indication", SNIA_VER_110);
       String softwareProfileId = buildProfileInstanceId(SNIA_NAME,
           "Software", SNIA_VER_110);
   
       instances.append(buildDependencyInstance(interopSoftwareIdentity,
           PEGASUS_CLASSNAME_PG_SOFTWAREIDENTITY, serverProfileId,
           PEGASUS_CLASSNAME_PG_REGISTEREDPROFILE,
           elementSoftwareIdentityClass));
   
       instances.append(buildDependencyInstance(interopSoftwareIdentity,
           PEGASUS_CLASSNAME_PG_SOFTWAREIDENTITY, indicationProfileId,
           PEGASUS_CLASSNAME_PG_REGISTEREDSUBPROFILE,
           elementSoftwareIdentityClass));
   
       instances.append(buildDependencyInstance(interopSoftwareIdentity,
           PEGASUS_CLASSNAME_PG_SOFTWAREIDENTITY, softwareProfileId,
           PEGASUS_CLASSNAME_PG_REGISTEREDSUBPROFILE,
           elementSoftwareIdentityClass));
   
       return instances;
   }
   
   Array<CIMInstance> InteropProvider::enumInstalledSoftwareIdentityInstances()
   {
       // All of the software identity instances are associated to the
       // ComputerSystem on which the object manager resides. Simply loop through
       // all the instances and build the association.
       Array<CIMInstance> instances;
       CIMObjectPath csPath = getComputerSystemInstance().getPath();
       Array<CIMInstance> softwareInstances = enumSoftwareIdentityInstances();
       CIMClass installedSoftwareClass;
       CIMInstance skeletonInst =  buildInstanceSkeleton(
           PEGASUS_NAMESPACENAME_INTEROP,
           PEGASUS_CLASSNAME_PG_INSTALLEDSOFTWAREIDENTITY, installedSoftwareClass);
       for(Uint32 i = 0, n = softwareInstances.size(); i < n; ++i)
       {
           CIMInstance installedSoftwareInstance = skeletonInst.clone();
           setPropertyValue(installedSoftwareInstance,
               INSTALLEDSOFTWAREIDENTITY_PROPERTY_INSTALLEDSOFTWARE,
               CIMValue(softwareInstances[i].getPath()));
           setPropertyValue(installedSoftwareInstance,
               INSTALLEDSOFTWAREIDENTITY_PROPERTY_SYSTEM,
               CIMValue(csPath));
           installedSoftwareInstance.setPath(installedSoftwareInstance.buildPath(
               installedSoftwareClass));
           instances.append(installedSoftwareInstance);
       }
   
       return instances;
   }
   
   typedef Array<String> StringArray;
   
   void InteropProvider::verifyCachedInfo()
   {
       // TBD: May need an algorithm to determine whether or not the information
       // cached by the Interop Provider is out of date in some way
   }
   
   void InteropProvider::cacheProfileRegistrationInfo()
   {
       Array<CIMInstance> instances;
       Array<CIMInstance> providerCapabilitiesInstances;
       // Retrieve all of the provider profile registration info
       Array<CIMName> propList;
       propList.append(CAPABILITIES_PROPERTY_PROVIDERMODULENAME);
       propList.append(CAPABILITIES_PROPERTY_PROVIDERNAME);
       propList.append(PROFILECAPABILITIES_PROPERTY_PROFILEVERSION);
       propList.append(PROFILECAPABILITIES_PROPERTY_REGISTEREDPROFILE);
       propList.append(PROFILECAPABILITIES_PROPERTY_OTHERREGISTEREDPROFILE);
       propList.append(PROFILECAPABILITIES_PROPERTY_CONFORMINGELEMENTS);
       Array<CIMInstance> providerProfileInstances =
           repository->enumerateInstances(PEGASUS_NAMESPACENAME_INTEROP,
               PEGASUS_CLASSNAME_PG_PROVIDERPROFILECAPABILITIES, true, true,
               false, false, CIMPropertyList(propList));
       CIMClass elementConformsClass = repository->getClass(
           PEGASUS_NAMESPACENAME_INTEROP,
           PEGASUS_CLASSNAME_PG_ELEMENTCONFORMSTOPROFILE,
           false, true, false);
       CIMClass registeredProfileClass = repository->getClass(
           PEGASUS_NAMESPACENAME_INTEROP,
           PEGASUS_CLASSNAME_PG_REGISTEREDPROFILE,
           false, true, false);
       Array<CIMInstance> capabilities;
   
       // Loop through the provider profile info to determine what profiles are
       // supported by what providers, and to build the ElementConformsToProfile
       // associations.
       for(Uint32 i = 0, n = providerProfileInstances.size(); i < n; ++i)
       {
           CIMInstance & currentProfileInstance = providerProfileInstances[i];
           String moduleName = getRequiredValue<String>(currentProfileInstance,
               CAPABILITIES_PROPERTY_PROVIDERMODULENAME);
           String providerName = getRequiredValue<String>(currentProfileInstance,
               CAPABILITIES_PROPERTY_PROVIDERNAME);
           String profileName;
           Uint16 profileOrganization = 0;
           String otherOrganization;
           String profileVersion;
           String organizationName;
           Array<String> profileNames;
           String profileId = extractProfileInfo(currentProfileInstance,
               profileCapabilitiesClass, registeredProfileClass, profileName,
               profileVersion, profileOrganization, otherOrganization,
               organizationName, profileNames, true);
           Uint32 propIndex = currentProfileInstance.findProperty(
                 PROFILECAPABILITIES_PROPERTY_CONFORMINGELEMENTS);
   
           Array<CIMName> elementPropArray;
           elementPropArray.append(
               ELEMENTCONFORMSTOPROFILE_PROPERTY_CONFORMANTSTANDARD);
           elementPropArray.append(
               ELEMENTCONFORMSTOPROFILE_PROPERTY_MANAGEDELEMENT);
           CIMPropertyList elementPropList(elementPropArray);
   
           Array<CIMName> conformingElementsForProfile;
           Array<CIMNamespaceName> elementNamespacesForProfile;
   
           Array<String> elementClasses;
           currentProfileInstance.getProperty(propIndex).getValue().get(
               elementClasses);
           //if(propIndex == PEG_NOT_FOUND)
           if(elementClasses.size() == 0)
           {
               // Get the namespaces in which this provider operates and trim down
               // the list of capabilities instaces to just those that are related
               // to this one.
               String moduleName = getRequiredValue<String>(
                   currentProfileInstance,
                   CAPABILITIES_PROPERTY_PROVIDERMODULENAME);
               String providerName = getRequiredValue<String>(
                   currentProfileInstance,
                   CAPABILITIES_PROPERTY_PROVIDERNAME);
               if(capabilities.size() == 0)
               {
                   Array<CIMName> propList;
                   propList.append(
                       PROVIDERCAPABILITIES_PROPERTY_PROVIDERMODULENAME);
                   propList.append(PROVIDERCAPABILITIES_PROPERTY_PROVIDERNAME);
                   propList.append(PROVIDERCAPABILITIES_PROPERTY_NAMESPACES);
                   propList.append(PROVIDERCAPABILITIES_PROPERTY_CLASSNAME);
                   capabilities = repository->enumerateInstances(
                       PEGASUS_NAMESPACENAME_INTEROP,
                       PEGASUS_CLASSNAME_PROVIDERCAPABILITIES, true, true, false,
                       false);
               }
               Array<CIMInstance> capabilitiesForProvider;
               Array<CIMNamespaceName> namespacesForProvider;
               Array<CIMNameArray> subclassesForNamespace;
               for(Uint32 j = 0, m = capabilities.size(); j < m; ++j)
               {
                   CIMInstance & currentInstance = capabilities[j];
                   String curModuleName = getRequiredValue<String>(
                       currentInstance, CAPABILITIES_PROPERTY_PROVIDERMODULENAME);
                   String curProviderName = getRequiredValue<String>(
                       currentInstance, CAPABILITIES_PROPERTY_PROVIDERNAME);
                   if(curModuleName == moduleName &&
                       curProviderName == providerName)
                   {
                       CIMName currentClass(getRequiredValue<String>(
                           currentInstance,
                           PROVIDERCAPABILITIES_PROPERTY_CLASSNAME));
                       capabilitiesForProvider.append(currentInstance);
                       StringArray curNamespaces =
                           getRequiredValue<StringArray>(currentInstance,
                               PROVIDERCAPABILITIES_PROPERTY_NAMESPACES);
                       Sint32 z = 0;
                       Sint32 y = curNamespaces.size();
   
                       // If one of the namespaces is Interop, then continue
                       bool interopNamespaceFound = false;
                       for(; z < y; ++z)
                       {
                           if(CIMNamespaceName(curNamespaces[z]) ==
                               PEGASUS_NAMESPACENAME_INTEROP)
                           {
                               interopNamespaceFound = true;
                               break;
                           }
                       }
                       if(interopNamespaceFound)
                           continue;
   
                       // See if the current namespaces are already listed
                       for(Sint32 z = 0, y = curNamespaces.size(); z < y; ++z)
                       {
                           Sint32 foundIndex = -1;
                           CIMNamespaceName curNamespace = curNamespaces[z];
                           Uint32 k = 0;
                           Uint32 x = namespacesForProvider.size();
                           for(; k < x; ++k)
                           {
                               if(curNamespace == namespacesForProvider[k])
                               {
                                   foundIndex = (Sint32)k;
                                   break;
                               }
                           }
                           if(foundIndex == -1)
                           {
                               // Get all the subclasses of
                               // ElementConformsToProfile in the namespace and
                               // cache them.
                               foundIndex = namespacesForProvider.size();
                               Array<CIMName> subClasses =
                                   repository->enumerateClassNames(curNamespace,
                                   PEGASUS_CLASSNAME_CIM_ELEMENTCONFORMSTOPROFILE,
                                   true);
                               subClasses.append(
                                   PEGASUS_CLASSNAME_CIM_ELEMENTCONFORMSTOPROFILE
                                   );
                               namespacesForProvider.append(curNamespace);
                               subclassesForNamespace.append(subClasses);
                           }
   
                           // Now search to see if the current class is one of the
                           // subclasses in this namespace, and finally, if it is
                           // add it to the list
                           Array<CIMName> & subClasses =
                               subclassesForNamespace[foundIndex];
                           for(k = 0, x = subClasses.size(); k < x; ++k)
                           {
                               if(subClasses[k] == currentClass)
                               {
                                   String dynamicElement = PEGASUS_DYNAMIC +
                                       currentClass.getString();
                                   conformingElementsForProfile.append(
                                       dynamicElement);
                                   elementNamespacesForProfile.append(
                                       curNamespace);
                               }
                           }
                       }
                   }
               }
           }
           else
           {
               //Array<String> elementClasses;
               //currentProfileInstance.getProperty(propIndex).getValue().get(
               //    elementClasses);
               for(Uint32 j = 0, m = elementClasses.size(); j < m; ++j)
               {
                   CIMName elementClass(elementClasses[j]);
                   Array<String> searchNamespaces =
                       findProviderNamespacesForElement(
                           moduleName, providerName,
                           elementClass,
                           repository,
                           providerCapabilitiesInstances);
                   Uint32 k = 0;
                   Uint32 x = searchNamespaces.size();
                   for(; k < x; ++k)
                   {
                       conformingElementsForProfile.append(elementClass);
                       elementNamespacesForProfile.append(searchNamespaces[k]);
                   }
               }
           }
   
           Sint32 foundIndex = -1;
           for(Sint32 j = 0, m = profileIds.size(); j < m; ++j)
           {
               if(profileIds[j] == profileId)
               {
                   foundIndex = j;
                   break;
               }
           }
   
           if(foundIndex >= 0)
           {
               // Append the results to already existing entries
               conformingElements[foundIndex].appendArray(
                   conformingElementsForProfile);
               elementNamespaces[foundIndex].appendArray(
                   elementNamespacesForProfile);
           }
           else
           {
               profileIds.append(profileId);
               conformingElements.append(conformingElementsForProfile);
               elementNamespaces.append(elementNamespacesForProfile);
           }
       }
   
       // Now cache the defaults: PG_RegisteredProfile and PG_ObjectManager
       /*
       String serverProfileId(buildProfileInstanceId(
         SNIA_NAME, "Server", SNIA_VER_110));
       profileIds.append(serverProfileId);
       Array<CIMName> tmpNames;
       Array<CIMNamespaceName> tmpNamespaces;
       tmpNames.append(PEGASUS_CLASSNAME_PG_REGISTEREDPROFILE);
       tmpNames.append(PEGASUS_CLASSNAME_PG_OBJECTMANAGER);
       tmpNamespaces.append(PEGASUS_NAMESPACENAME_INTEROP);
       tmpNamespaces.append(PEGASUS_NAMESPACENAME_INTEROP);
   
       conformingElements.append(tmpNames);
       elementNamespaces.append(tmpNamespaces);*/
 } }
  
 PEGASUS_NAMESPACE_END  
 // END_OF_FILE // END_OF_FILE


Legend:
Removed from v.1.36  
changed lines
  Added in v.1.57.4.5

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2