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

version 1.2, 2003/08/18 14:14:40 version 1.88.2.1, 2011/10/11 18:18:16
Line 1 
Line 1 
 //%/////////////////////////////////////////////////////////////////////////////  //%LICENSE////////////////////////////////////////////////////////////////
 // //
 // Copyright (c) 2000, 2001, 2002 BMC Software, Hewlett-Packard Company, IBM,  // Licensed to The Open Group (TOG) under one or more contributor license
 // The Open Group, Tivoli Systems  // agreements.  Refer to the OpenPegasusNOTICE.txt file distributed with
   // this work for additional information regarding copyright ownership.
   // Each contributor licenses this file to you under the OpenPegasus Open
   // Source License; you may not use this file except in compliance with the
   // License.
 // //
 // 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
 // of this software and associated documentation files (the "Software"), to  // copy of this software and associated documentation files (the "Software"),
 // deal in the Software without restriction, including without limitation the  // to deal in the Software without restriction, including without limitation
 // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or  // the rights to use, copy, modify, merge, publish, distribute, sublicense,
 // sell copies of the Software, and to permit persons to whom the Software is  // and/or sell copies of the Software, and to permit persons to whom the
 // furnished to do so, subject to the following conditions:  // Software is furnished to do so, subject to the following conditions:
 //  //
 // THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN  // The above copyright notice and this permission notice shall be included
 // ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED  // in all copies or substantial portions of the Software.
 // "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT  //
 // LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR  // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
 // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT  // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
 // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN  // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
 // ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION  // IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.  // CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
 //  // TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
 //==============================================================================  // SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //  //
 // Author: Karl Schopmeyer (k.schopmeyer@opengroup.org)  //////////////////////////////////////////////////////////////////////////
 //  
 // Modified By: Carol Ann Krug Graves, Hewlett-Packard Company  
 //                (carolann_graves@hp.com)  
 //              Karl Schopmeyer - Add Cim_Namespace capabilities.  
 //              Karl Schopmeyer - Temp added objectmanager and communication classes  
 // //
 //%//////////////////////////////////////////////////////////////////////////// //%////////////////////////////////////////////////////////////////////////////
  
   
 /////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
 //  Namespace Provider  //  Interop Provider - This provider services those classes from the
   //  DMTF Interop schema in an implementation compliant with the SMI-S v1.1
   //  Server Profile
 // //
 //      This provider answers to the "false" class __namespace.  This is the  //  Please see PG_ServerProfile20.mof in the directory
 //      deprecated version of manipulation in the DMTF WBEM model.  This function  //  $(PEGASUS_ROOT)/Schemas/Pegasus/InterOp/VER20 for retails regarding the
 //      is defined in the CIM Operations over HTTP docuement.  However, while  //  classes supported by this control provider.
 //      the function exists, no class was ever defined in the CIM model for  //
 //      __nemaspace.  Therefore each implementation is free to provide its own  //  Interop forces all creates to the PEGASUS_NAMESPACENAME_INTEROP
 //      class definition.  //  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
   //  for data and function traces.  Since we do not expect high volume
   //  use we added a number of traces to help diagnostics.
 /////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
  
 /* STATUS: In process but running 12 August 2003 KS */  
   
 #include <Pegasus/Common/Config.h> #include <Pegasus/Common/Config.h>
 #include <Pegasus/Common/PegasusVersion.h> #include <Pegasus/Common/PegasusVersion.h>
  
Line 51 
Line 53 
 #include <iostream> #include <iostream>
  
 #include "InteropProvider.h" #include "InteropProvider.h"
 #include <Pegasus/Common/String.h>  #include "InteropProviderUtils.h"
 #include <Pegasus/Common/System.h>  #include "InteropConstants.h"
 #include <Pegasus/Common/ArrayInternal.h>  
 #include <Pegasus/Common/CIMName.h>  
 #include <Pegasus/Common/CIMType.h>  
 #include <Pegasus/Common/CIMInstance.h>  
 #include <Pegasus/Common/CIMObjectPath.h>  
 #include <Pegasus/Common/InternalException.h>  
 #include <Pegasus/Common/CIMStatusCode.h>  
 #include <Pegasus/Common/Tracer.h>  
 #include <Pegasus/Common/OperationContext.h>  
 #include <Pegasus/Config/ConfigManager.h>  
   
 // ATTN: KS these are in header  
 #include <Pegasus/Repository/CIMRepository.h>  
 #include <Pegasus/Provider/CIMInstanceProvider.h>  
 //#include <Pegasus/Provider/CIMAssociationProvider.h>  
 #include <Pegasus/Common/ResponseHandler.h>  
   
  
 #include <Pegasus/Common/XmlWriter.h>  #include <Pegasus/Common/StatisticalData.h>
   #include <Pegasus/Common/StringConversion.h>
   #include <Pegasus/Common/ArrayIterator.h>
  
 PEGASUS_USING_STD; PEGASUS_USING_STD;
   
 PEGASUS_NAMESPACE_BEGIN PEGASUS_NAMESPACE_BEGIN
 #define CDEBUG(X) PEGASUS_STD(cout) << "InteropProvider " << X << PEGASUS_STD(endl)  
 //#define CDEBUG(X)  
 //#define DEBUG(X) Logger::put (Logger::DEBUG_LOG, "Linux_ProcessorProvider", Logger::INFORMATION, "$0", X)  
  
 /**  /*****************************************************************************
  * Specification for CIM Operations over HTTP  
  *  
  * Version 1.0  
  *  
  * 2.5. Namespace Manipulation  
  * There are no intrinsic methods defined specifically for the  
  * purpose of manipulating CIM Namespaces. However, the modelling  
  * of a CIM Namespace using the class __Namespace, together with  
  * the requirement that the root Namespace MUST be supported by  
  * all CIM Servers, implies that all Namespace operations can be  
  * supported.  
  *  *
  * For example:   * The following are constants representing property names for the classes
    * managed by the Interop Provider. Where multiple classes have properties of
    * the same name, there will be a common CIMName object defined, and a macro
    * defined that points to the common CIMName object, but whose macro name
    * reflects the class in which the property is used.
  *  *
  * Enumeration of all child Namespaces of a particular Namespace   *****************************************************************************/
  * is realized by calling the intrinsic method  
  * EnumerateInstanceNames against the parent Namespace,  
  * specifying a value for the ClassName parameter of __Namespace.  
  *  
  * Creation of a child Namespace is realized by calling the  
  * intrinsic method CreateInstance against the parent Namespace,  
  * specifying a value for the NewInstance parameter which defines  
  * a valid instance of the class __Namespace and whose Name  
  * property is the desired name of the new Namespace.  
  *  
 */  
  
 /**  //
     The constants representing the class names we process  // Constructor for the InteropProvider control provider
 */  //
 static const CIMName __NAMESPACE_CLASSNAME  = CIMName ("__Namespace");  InteropProvider::InteropProvider(
 static const CIMName CIM_NAMESPACE_CLASSNAME  = CIMName ("CIM_Namespace");      CIMRepository * rep,
 static const CIMName CIM_OBJECTMANAGER_CLASSNAME  = CIMName ("CIM_ObjectManager");      ProviderRegistrationManager *provRegManager):
 static const CIMName CIM_OBJECTMANAGERCOMMUNICATIONMECHANISM_CLASSNAME  =          repository(rep),
         CIMName ("CIM_ObjectManagerCommunicationMechanism");          providerRegistrationManager(provRegManager),
 static const CIMName CIM_CIMXMLCOMMUNICATIONMECHANISM_CLASSNAME  =          hostName(System::getHostName()),
         CIMName ("CIM_CIMXMLCommunicationMechanism");          providerInitialized(false),
           updateProfileCache(0),
           profileIds(Array<String>()),
 // Property Names for __Namespace Class          conformingElements(Array<CIMNameArray>()),
 static const CIMName NAMESPACE_PROPERTYNAME  = CIMName ("Name");          elementNamespaces(Array<CIMNamespaceArray>())
 static const CIMNamespaceName ROOTNS  = CIMNamespaceName ("root");  {
       PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,"InteropProvider::InteropProvider");
   
 // Property names for CIM_ObjectManager Class      ConfigManager *configManager = ConfigManager::getInstance();
 static const CIMName OM_GATHERSTATISTICALDATA  =  #ifdef PEGASUS_ENABLE_SLP
  CIMName ("GatherStatisticalData");      enableSLP = ConfigManager::parseBooleanValue(
           configManager->getCurrentValue("slp"));
   #else
 // Property Names for ObjectManagerCommunicationMechanism Class      enableSLP = false;
 static const CIMName OM_COMMUNICATIONMECHANISM  =  #endif
         CIMName ("CommunicationMechanism");  
 static const CIMName OM_FUNCTIONALPROFILESSUPPORTED  =      httpPort = configManager->getCurrentValue("httpPort");
  CIMName ("FunctionalProfilesSupported");      if (httpPort.size() == 0)
 static const CIMName OM_FUNCTIONALPROFILEDESCRIPTIONS  =  
  CIMName ("FunctionalProfileDescriptions");  
 static const CIMName OM_AUTHENTICATIONMECHANISMSSUPPORTED  =  
  CIMName ("AuthenticationMechanismsSupported");  
 static const CIMName OM_AUTHENTICATIONMECHANISMDESCRIPTIONS  =  
  CIMName ("AuthenticationMechanismDescriptions");  
 static const CIMName OM_MULTIPLEOPERATIONSSUPPORTED  =  
  CIMName ("MultipleOperationsSupported");  
 static const CIMName OM_VERSION  =  
  CIMName ("Version");  
   
 // Property Names for CIMXML CommunicationMechanism  
   
 static const CIMName CIMVALIDATED  =  
  CIMName ("CIMValidated");  
   
 static const String CIMXMLProtocolVersion = "1.0";  
   
   
 // Defines to serve as the ENUM for class selection  
 #define __NAMESPACE 1  
 #define CIM_NAMESPACE 2  
 #define CIM_OBJECTMANAGER 3  
 #define CIM_OBJECTMANAGERCOMMUNICATIONMECHANISM 4  
 #define CIM_CIMXMLCOMMUNICATIONMECHANISM 5  
   
 // Property names for CIM_Namespace Class  
 static const CIMName CIM_NAMESPACE_PROPERTY_SYSTEMCREATIONCLASSNAME =  
         CIMName ("SystemCreationClassName");  
 static const CIMName CIM_NAMESPACE_PROPERTY_SYSTEMNAME =  
         CIMName ("SystemName");  
 static const CIMName CIM_NAMESPACE_PROPERTY_OBJECTMANAGERCREATIONCLASSNAME =  
         CIMName ("ObjectManagerCreationClassName");  
 static const CIMName CIM_NAMESPACE_PROPERTY_OBJECTMANAGERNAME =  
         CIMName ("ObjectManagerName");  
 static const CIMName CIM_NAMESPACE_PROPERTY_CREATIONCLASSNAME =  
         CIMName ("CreationClassName");  
 static const CIMName CIM_NAMESPACE_PROPERTY_NAME  = CIMName ("Name");  
 static const CIMName CIM_NAMESPACE_PROPERTY_CLASSINFO =  
         CIMName ("ClassInfo");  
 static const CIMName CIM_NAMESPACE_PROPERTY_DESCRIPTIONOFCLASSINFO =  
         CIMName ("DescriptionOfClassInfo");  
   
   
 //***************************************************************  
 // Utility Functions  
 //***************************************************************  
   
 /* Test the keys in the CIM_Namespace for valid values  
    This includes all of the keys above the name key.  
    THis is a dummy for now.  
    ATTN: KS Extend and finish this function.  
 */  
 Boolean _testKeys(const CIMObjectPath& path)  
 { {
     return true;          Uint32 portNumberHttp = System::lookupPort(
               WBEM_HTTP_SERVICE_NAME, WBEM_DEFAULT_HTTP_PORT);
           char buffer[32];
           Uint32 n;
           const char *output = Uint32ToString(buffer, portNumberHttp, n);
           httpPort.assign(output, n);
 } }
 Boolean _testKeys(const CIMInstance& instance)  
       httpsPort = configManager->getCurrentValue("httpsPort");
       if (httpsPort.size() == 0)
 { {
     return true;          Uint32 portNumberHttps = System::lookupPort(
               WBEM_HTTPS_SERVICE_NAME, WBEM_DEFAULT_HTTPS_PORT);
           char buffer[32];
           Uint32 n;
           const char *output = Uint32ToString(buffer, portNumberHttps, n);
           httpsPort.assign(output, n);
 } }
  
  
 /* Query the repository for array of all namespacenames  #ifndef PEGASUS_DISABLE_PERFINST
 */  
 Array<CIMNamespaceName> InteropProvider::_enumerateNameSpaces()  
 {  
     PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,  
             "InteropProvider::_enumerateNameSpaces()");  
     Array<CIMNamespaceName> namespaceNames;  
     _repository->read_lock();  
   
     try     try
     {     {
         namespaceNames = _repository->enumerateNameSpaces();          initProvider();
     }     }
     catch(CIMException& e)      catch(const Exception &)
     {     {
         _repository->read_unlock();          // Provider initialization may fail if the repository is not
         PEG_METHOD_EXIT();          // populated
         throw e;  
     }     }
     catch(Exception& e)  #endif
     {  
         _repository->read_unlock();  
         PEG_METHOD_EXIT();         PEG_METHOD_EXIT();
         throw e;  
     }     }
  
     _repository->read_unlock();  //
   // Local version of getInstance to be used by other functions in the the
   // provider. Returns a single instance. Note that it always returns an
   // instance. If none was found, it is uninialitized.
   //
   CIMInstance InteropProvider::localGetInstance(
       const OperationContext & context,
       const CIMObjectPath & instanceName,
       const CIMPropertyList & propertyList)
   {
       PEG_METHOD_ENTER(TRC_CONTROLPROVIDER, "InteropProvider::localGetInstance");
   
       PEG_TRACE((TRC_CONTROLPROVIDER, Tracer::LEVEL4,
           "%s getInstance. instanceName= %s , PropertyList= %s",
           thisProvider,
           (const char *)instanceName.toString().getCString(),
           (const char *)propertyListToString(propertyList).getCString()));
   
       // Test if we're looking for something outside of our namespace. This will
       // happen during associators calls from PG_RegisteredProfile instances
       // through the PG_ElementConformsToProfile association
       CIMNamespaceName opNamespace = instanceName.getNameSpace();
       CIMName opClass = instanceName.getClassName();
       if((opNamespace != PEGASUS_NAMESPACENAME_INTEROP &&
           opClass != PEGASUS_CLASSNAME_PG_ELEMENTCONFORMSTOPROFILE)
           // Get CIM_IndicationService instance from IndicationService.
   #ifdef PEGASUS_ENABLE_DMTF_INDICATION_PROFILE_SUPPORT
           || opClass == PEGASUS_CLASSNAME_CIM_INDICATIONSERVICE
   #endif
           )
       {
           AutoMutex mut(interopMut);
           CIMInstance gotInstance = cimomHandle.getInstance(
                                            context,
                                            opNamespace,
                                            instanceName,
                                            false,
                                            false,
                                            false,
                                            propertyList);
     PEG_METHOD_EXIT();     PEG_METHOD_EXIT();
     return(namespaceNames);          return gotInstance;
 } }
  
 /* get the CIM_Namespace Class defintion from the repository or      TARGET_CLASS classEnum  = translateClassInput(opClass);
    from local static storage.      CIMInstance retInstance;
    @param namespace in which to look for the class.      switch(classEnum)
    @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,          case PG_SOFTWAREIDENTITY:
             "InteropProvider::_getCIM_NamespaceClass()");  
     CIMClass myClass;  
     CDEBUG("Get Class from repository " <<  className.getString());  
     if (myClass.isUninitialized())  
     {     {
         _repository->read_lock();              retInstance = getSoftwareIdentityInstance(instanceName);
         try              normalizeInstance(
         {                  retInstance, instanceName, false, false, propertyList);
             myClass = _repository->getClass(_operationNamespace, className );  
         }         }
         catch(CIMException& e)          break;
           case PG_NAMESPACE:
         {         {
             _repository->read_unlock();              retInstance = getNameSpaceInstance(instanceName);
             PEG_METHOD_EXIT();              normalizeInstance(
             throw e;                  retInstance, instanceName, false, false, propertyList);
         }         }
         catch(Exception& e)          break;
           // ATTN: Implement getIntstance for all other classes. Currently
           // this method calls localEnumerateInstances() to select instance
           // which is too expensive.
           default:
         {         {
             _repository->read_unlock();              // Create reference from host, namespace, class components of
             PEG_METHOD_EXIT();              // instance name
             throw e;              CIMObjectPath ref;
               ref.setHost(instanceName.getHost());
               ref.setClassName(opClass);
               ref.setNameSpace(opNamespace);
   
               // Enumerate instances for this class. Returns all instances
               // Note that this returns paths setup and instances already
               // filtered per the input criteria.
               Array<CIMInstance> instances =  localEnumerateInstances(
                   context,
                   ref,
                   propertyList);
               ConstArrayIterator<CIMInstance> instancesIter(instances);
   
               // deliver a single instance if found.
               bool found = false;
               for(Uint32 i = 0; i < instancesIter.size(); i++)
               {
                   CIMObjectPath currentInstRef = instancesIter[i].getPath();
                   currentInstRef.setHost(instanceName.getHost());
                   currentInstRef.setNameSpace(instanceName.getNameSpace());
                   if(instanceName == currentInstRef)
                   {
                       retInstance = instancesIter[i];
                       found = true;
                       break;
         }         }
         _repository->read_unlock();  
     }     }
   
     PEG_METHOD_EXIT();     PEG_METHOD_EXIT();
     return myClass;              if (!found)
               {
                   throw CIMObjectNotFoundException(instanceName.toString());
               }
           }
 } }
  
       return retInstance;
   }
  
 /* Verify that this is one of the legal classnames and  Array<CIMInstance> InteropProvider::getReferencedInstances(
    return indicator which.      const Array<CIMInstance> &refs,
    @param - Classname      const String targetRole,
    @return - Uint32 indicating type      const OperationContext & context,
    @Exceptions - throws CIMNotSupportedException if invalid class.      const CIMPropertyList & propertyList)
 */  
 Uint32 _verifyValidClassInput(const CIMName& className)  
 { {
     PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,     PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,
             "InteropProvider::_verifyValidClassInput()");          "InteropProvider::getReferencedObjects");
     // Verify that ClassName == __Namespace or CIM_Namespace  
     // ATTN: KS Check to determine if equal is case independent  
     CDEBUG("Class Name Input = " << className.getString());  
  
     if (className.equal(__NAMESPACE_CLASSNAME))      Array<CIMInstance> referencedInstances;
       Array<CIMInstance> classInstances;
       CIMName prevClassName;
   
       ConstArrayIterator<CIMInstance> refsIter(refs);
       for(Uint32 i = 0; i < refsIter.size(); i++)
       {
           CIMInstance thisRef = refsIter[i];
           CIMObjectPath thisTarget = getRequiredValue<CIMObjectPath>(
               thisRef,
               targetRole);
   
           // Test if we're looking for something outside of our namespace. This
           // will happen during associators calls from PG_RegisteredProfile
           // instances through the PG_ElementConformsToProfile association
           CIMNamespaceName opNamespace = thisTarget.getNameSpace();
           CIMName opClass = thisTarget.getClassName();
   
           if((opNamespace != PEGASUS_NAMESPACENAME_INTEROP &&
               opClass != PEGASUS_CLASSNAME_PG_ELEMENTCONFORMSTOPROFILE)
               // Get CIM_IndicationService instance from IndicationService.
   #ifdef PEGASUS_ENABLE_DMTF_INDICATION_PROFILE_SUPPORT
               || opClass == PEGASUS_CLASSNAME_CIM_INDICATIONSERVICE
   #endif
               )
     {     {
         PEG_METHOD_EXIT();              AutoMutex mut(interopMut);
         return __NAMESPACE;              CIMInstance gotInstance = cimomHandle.getInstance(
                   context,
                   opNamespace,
                   thisTarget,
                   false,
                   false,
                   false,
                   propertyList);
               referencedInstances.append(gotInstance);
               continue;
     }     }
  
     if (className.equal(CIM_OBJECTMANAGER_CLASSNAME))          TARGET_CLASS classEnum  = translateClassInput(opClass);
           CIMInstance retInstance;
           switch(classEnum)
     {     {
         PEG_METHOD_EXIT();              case PG_SOFTWAREIDENTITY:
         return CIM_OBJECTMANAGER;  
     }  
   
     if (className.equal(CIM_OBJECTMANAGERCOMMUNICATIONMECHANISM_CLASSNAME))  
     {     {
         PEG_METHOD_EXIT();                  CIMInstance retInstance =
         return CIM_OBJECTMANAGERCOMMUNICATIONMECHANISM;                      getSoftwareIdentityInstance(thisTarget);
                   normalizeInstance(
                       retInstance, thisTarget, false, false, propertyList);
                   retInstance.setPath(thisTarget);
                   referencedInstances.append(retInstance);
     }     }
               break;
     if (className.equal(CIM_CIMXMLCOMMUNICATIONMECHANISM_CLASSNAME))              case PG_NAMESPACE:
     {     {
         PEG_METHOD_EXIT();                  CIMInstance retInstance = getNameSpaceInstance(thisTarget);
         return CIM_OBJECTMANAGERCOMMUNICATIONMECHANISM;                  normalizeInstance(
                       retInstance, thisTarget, false, false, propertyList);
                   retInstance.setPath(thisTarget);
                   referencedInstances.append(retInstance);
     }     }
               break;
     // Last entry, reverse test and returnOK if CIM_Namespace              default:
     if (!className.equal(CIM_NAMESPACE_CLASSNAME))  
     {     {
         PEG_METHOD_EXIT();                  if( opClass != prevClassName )
         throw CIMNotSupportedException                  {
             (className.getString() + " not supported by Interop Provider");                      CIMObjectPath ref;
                       ref.setHost(thisTarget.getHost());
                       ref.setClassName(thisTarget.getClassName());
                       ref.setNameSpace(thisTarget.getNameSpace());
                       classInstances = localEnumerateInstances(
                           context,
                           ref,
                           propertyList);
                       ArrayIterator<CIMInstance> instsIter(classInstances);
                       for(Uint32 n = 0; n < instsIter.size(); n++)
                       {
                           CIMObjectPath tmpInst = instsIter[n].getPath();
                           tmpInst.setHost(thisTarget.getHost());
                           tmpInst.setNameSpace(thisTarget.getNameSpace());
                           instsIter[n].setPath(tmpInst);
     }     }
                       prevClassName = opClass;
   
     PEG_METHOD_EXIT();  
     return CIM_NAMESPACE;  
 } }
                   ConstArrayIterator<CIMInstance> instsConstIter(classInstances);
 /* validate the authorization of the user name against the namespace.                  for(Uint32 j = 0; j < instsConstIter.size(); j++)
 */  
 String _validateUserID(const OperationContext & context)  
 { {
     //ATTN-DME-P3-20020522: ADD AUTHORIZATION CHECK TO __NAMESPACE PROVIDER                      if(thisTarget == instsConstIter[j].getPath())
     String userName;  
     try  
     {     {
         IdentityContainer container = context.get(IdentityContainer::NAME);                          referencedInstances.append(instsConstIter[j]);
         userName = container.getUserName();                          break;
     }     }
     catch (...)  
     {  
        userName = String::EMPTY;  
     }     }
     return userName;  
 } }
               break;
 /* Create an instance of the CIM_Namespace class which is based          }
    on the following CIM MOF Specification  
 [Version ("2.6.0"), Description (  
     "Namespace provides a domain (in other words, a container), "  
     "in which the instances [of a class] are guaranteed to be "  
     "unique per the KEY qualifier definitions.  It is named "  
     "relative to the CIM_ObjectManager implementation that "  
     "provides such a domain.") ]  
 class CIM_Namespace : CIM_ManagedElement {  
   
     [Propagated("CIM_ObjectManager.SystemCreationClassName"), Key,  
         MaxLen (256), Description (  
            "The scoping System's CreationClassName.") ]  
     string SystemCreationClassName;  
   
     [Propagated("CIM_ObjectManager.SystemName"), Key, MaxLen (256),  
         Description ("The scoping System's Name.") ]  
     string SystemName;  
   
     [Propagated ("CIM_ObjectManager.CreationClassName"), Key,  
         MaxLen (256), Description (  
            "The scoping ObjectManager's CreationClassName.") ]  
     string ObjectManagerCreationClassName;  
   
     [Propagated ("CIM_ObjectManager.Name"), Key, MaxLen (256),  
         Description ("The scoping ObjectManager's Name.") ]  
     string ObjectManagerName;  
   
     [Key, MaxLen (256), Description (  
         "CreationClassName indicates the name of the class or the "  
         "subclass used in the creation of an instance. When used "  
         "with the other key properties of this class, this property "  
         "allows all instances of this class and its subclasses to "  
         "be uniquely identified.") ]  
     string CreationClassName;  
   
     [Key, MaxLen (256), Description (  
         "A string to uniquely identify the Namespace within "  
         "the ObjectManager.") ]  
     string Name;  
   
     [Required, Write, Description (  
         "Enumeration indicating the organization/schema of the "  
         "Namespace's objects. For example, they may be instances "  
         "of classes of a specific CIM version."),  
         ValueMap {"0", "1", "2", "3", "4", "5", "6", "7", "8", "9",  
                   "10", "200", "201", "202"},  
         Values {"Unknown", "Other", "CIM 1.0", "CIM 2.0",  
               "CIM 2.1", "CIM 2.2", "CIM 2.3", "CIM 2.4", "CIM 2.5",  
               "CIM 2.6", "CIM 2.7", "DMI Recast", "SNMP Recast",  
                   "CMIP Recast"},  
         ModelCorrespondence {"CIM_Namespace.DescriptionOfClassInfo"} ]  
     uint16 ClassInfo;  
   
     [Write, Description (  
         "A string providing more detail (beyond the general "  
         "classification in ClassInfo) for the object hierarchy of "  
         "the Namespace."),  
         ModelCorrespondence {"CIM_Namespace.ClassInfo"} ]  
     string DescriptionOfClassInfo;  
 };  
   
 */  
 void _buildInstanceCommonKeys(CIMInstance& instance)  
 {  
   
     PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,  
             "InteropProvider::_buildInstanceCommonKeys()");  
     String SystemCreationClassName = System::getSystemCreationClassName ();  
     if (SystemCreationClassName == String::EMPTY)  
     {  
         SystemCreationClassName = "CIM_ComputerSystem";  
     }  
   
     String SystemName = System::getHostName();  
   
     instance.addProperty(  
         (CIMProperty(CIM_NAMESPACE_PROPERTY_SYSTEMCREATIONCLASSNAME,  
                      SystemCreationClassName)));  
     // SystemName  
     instance.addProperty(  
         (CIMProperty(CIM_NAMESPACE_PROPERTY_SYSTEMNAME,  
                      SystemName)));  
     PEG_METHOD_EXIT();  
 } }
   
 CIMInstance _buildInstancCIMXMLCommunicationMechanism()  
 {  
     PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,  
             "InteropProvider::_buildInstanceCIMXMLCommunicationMechanism()");  
   
     CIMInstance instance(CIM_OBJECTMANAGERCOMMUNICATIONMECHANISM_CLASSNAME);  
   
     _buildInstanceCommonKeys(instance);  
   
     //CreationClassName  
     instance.addProperty(  
         (CIMProperty(CIM_NAMESPACE_PROPERTY_CREATIONCLASSNAME,  
             CIM_OBJECTMANAGERCOMMUNICATIONMECHANISM_CLASSNAME.getString() )));  
   
     String name = "PegasusCommunicationMechanism";  
   
     //Name, this CommunicationMechanism.  
     instance.addProperty(  
         (CIMProperty(CIM_NAMESPACE_PROPERTY_NAME,  
                      name )));  
   
     // CommunicationMechanism Property  
     instance.addProperty(  
         (CIMProperty(OM_COMMUNICATIONMECHANISM,  
                      Uint16(2) )));  
   
     // CommunicationMechanism Property  
     instance.addProperty(  
         (CIMProperty(OM_COMMUNICATIONMECHANISM,  
                      Uint16(2) )));  
   
     PEG_METHOD_EXIT();     PEG_METHOD_EXIT();
     return(instance);      return referencedInstances;
 } }
  
   //
 CIMInstance _buildInstancCIMObjectCommunicationMechanism()  // Local version of enumerateInstances to be used by other functions in the
   // provider. Note that this delivers instances as a group rather than one
   // at a time. This design point may need to be revisited if this provider
   // is used in environments such that returning segmented responses would have
   // significant performance advantages. For now, that doesn't seem to be the
   // case.
   //
   Array<CIMInstance> InteropProvider::localEnumerateInstances(
       const OperationContext & context,
       const CIMObjectPath & ref,
       const CIMPropertyList& propertyList)
 { {
     PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,     PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,
             "InteropProvider::_buildInstanceCIMObjectCommunicationMechanism()");          "InteropProvider::localEnumerateInstances()");
       const CIMName & className = ref.getClassName();
     CIMInstance instance(CIM_CIMXMLCOMMUNICATIONMECHANISM_CLASSNAME);      PEG_TRACE((TRC_CONTROLPROVIDER, Tracer::LEVEL4,
           "%s enumerateInstances. referenc= %s , PropertyList= %s",
     _buildInstanceCommonKeys(instance);          thisProvider,
           (const char *)className.getString().getCString(),
           (const char *)propertyListToString(propertyList).getCString()));
  
       // Verify that ClassName is correct and get its enum value
       TARGET_CLASS classEnum  = translateClassInput(className);
  
     //CreationClassName      Array<CIMInstance> instances;
     instance.addProperty(      switch(classEnum)
         (CIMProperty(CIM_NAMESPACE_PROPERTY_CREATIONCLASSNAME,      {
             CIM_OBJECTMANAGERCOMMUNICATIONMECHANISM_CLASSNAME.getString() )));          case PG_OBJECTMANAGER:
           {
     String name = "PegasusCommunicationMechanism";              instances.append(getObjectManagerInstance());
     //Name, this CommunicationMechanism.              break;
     instance.addProperty(  
         (CIMProperty(CIM_NAMESPACE_PROPERTY_NAME,  
                      name )));  
   
     // CommunicationMechanism Property  
     instance.addProperty(  
         (CIMProperty(OM_COMMUNICATIONMECHANISM,  
                      Uint16(2) )));  
   
     //Functional Profiles Supported Property.  
     Array<Uint16> profiles;  
     Array<String> profileDescriptions;  
     CIMValue profileValue(profiles);  
     CIMValue profileDescriptionsValue(profileDescriptions);  
   
     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");  
   
     instance.addProperty(  
         (CIMProperty(OM_FUNCTIONALPROFILESSUPPORTED,  
                      profileValue )));  
     instance.addProperty(  
         (CIMProperty(OM_FUNCTIONALPROFILEDESCRIPTIONS,  
                      profileDescriptionsValue )));  
   
     // Multiple OperationsSupported Property  
     instance.addProperty(  
         (CIMProperty(OM_MULTIPLEOPERATIONSSUPPORTED,  
                      Boolean(false) )));  
     // AuthenticationMechanismsSupported  
   
     Array<Uint16> authentications;  
     Array<String> authenticationDescriptions;  
     CIMValue authenticationValue(authentications);  
     CIMValue authenticationDescriptionsValue(authenticationDescriptions);  
     profiles.append(3); profileDescriptions.append("Basic");  
   
     instance.addProperty(  
         (CIMProperty(OM_AUTHENTICATIONMECHANISMSSUPPORTED,  
                      authenticationValue )));  
     instance.addProperty(  
         (CIMProperty(OM_AUTHENTICATIONMECHANISMDESCRIPTIONS,  
                      authenticationDescriptionsValue )));  
   
     //Version property  
     instance.addProperty(  
         (CIMProperty(OM_VERSION,  
                      CIMXMLProtocolVersion )));  
   
     PEG_METHOD_EXIT();  
     return(instance);  
 } }
           case PG_CIMXMLCOMMUNICATIONMECHANISM:
 String _getObjectManagerName()  
 { {
     return ("PEG_123456789");              instances = enumCIMXMLCommunicationMechanismInstances();
               break;
 } }
           case PG_NAMESPACEINMANAGER:
 CIMInstance _buildInstanceCIMObjectManager()  
 { {
     PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,              instances = enumNamespaceInManagerInstances();
             "InteropProvider::_buildInstanceCIMObjectManager()");              break;
   
     CIMInstance instance(CIM_OBJECTMANAGER_CLASSNAME);  
   
     _buildInstanceCommonKeys(instance);  
   
     //CreationClassName  
     instance.addProperty(  
         (CIMProperty(CIM_NAMESPACE_PROPERTY_CREATIONCLASSNAME,  
                      CIM_OBJECTMANAGER_CLASSNAME.getString() )));  
     //Name, this CIMObject Manager.  
     instance.addProperty(  
         (CIMProperty(CIM_NAMESPACE_PROPERTY_NAME,  
                      _getObjectManagerName() )));  
   
     //Property GatherStatisticalData. Note that today we do not  
     // have a dynamic activation for this value.  
   
 #ifdef PEGASUS_HAS_PERFINST  
     Boolean gatherStatData = true;  
 #else  
     Boolean gatherStatData = false;  
 #endif  
     instance.addProperty(  
         (CIMProperty(OM_GATHERSTATISTICALDATA,  
                      Boolean(gatherStatData) )));  
     PEG_METHOD_EXIT();  
     return(instance);  
 } }
           case PG_COMMMECHANISMFORMANAGER:
 /* generate one instance of the CIM_Namespace class with the  
    properties  
    @param namespace name to put into the class  
    @exceptions - exceptions carried forward from create instance  
    and addProperty.  
 */  
 CIMInstance _buildInstanceCIMNamespace(const CIMNamespaceName & nameSpace)  
 { {
     PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,              instances = enumCommMechanismForManagerInstances();
             "InteropProvider::_buildInstanceCIMNamespace()");              break;
   // Values for test  
     //String SystemCreationClassName = "creationclassname";  
     //String SystemName = "SystemNameValue";  
     String ObjectManagerName = "ObjectManagerNameValue";  
     String ClassInfo = "ClassInfo";  
     String DescriptionOfClassInfo = "DescriptionOfClassInfo";  
   
     CIMInstance instance(CIM_NAMESPACE_CLASSNAME);  
   
     /*  The following moved to common create  
     // Add the properties  
     // SystemCreationClassName  
     instance.addProperty(  
         (CIMProperty(CIM_NAMESPACE_PROPERTY_SYSTEMCREATIONCLASSNAME,  
                      SystemCreationClassName)));  
     // SystemName  
     instance.addProperty(  
         (CIMProperty(CIM_NAMESPACE_PROPERTY_SYSTEMNAME,  
                      SystemName)));  
     */  
     _buildInstanceCommonKeys(instance);  
   
     //ObjectManagerCreationClassName  
     instance.addProperty(  
         (CIMProperty(CIM_NAMESPACE_PROPERTY_OBJECTMANAGERCREATIONCLASSNAME,  
                      CIM_OBJECTMANAGER_CLASSNAME.getString())));  
     //ObjectManagerName  
     // This is the one we have to sort out ATTN: TBD KS P0  
     instance.addProperty(  
         (CIMProperty(CIM_NAMESPACE_PROPERTY_OBJECTMANAGERNAME,  
                      ObjectManagerName)));  
     //CreationClassName  
     instance.addProperty(  
         (CIMProperty(CIM_NAMESPACE_PROPERTY_CREATIONCLASSNAME,  
                      CIM_NAMESPACE_CLASSNAME.getString() )));  
     //Name  
     instance.addProperty(  
         (CIMProperty(CIM_NAMESPACE_PROPERTY_NAME,  
                      nameSpace.getString() )));  
   
     //ClassInfo  
     instance.addProperty(  
         (CIMProperty(CIM_NAMESPACE_PROPERTY_CLASSINFO,  
                      ClassInfo)));  
   
     //DescriptionofClassInfo  
     instance.addProperty(  
         (CIMProperty(CIM_NAMESPACE_PROPERTY_DESCRIPTIONOFCLASSINFO,  
                      DescriptionOfClassInfo)));  
     PEG_METHOD_EXIT();  
     return(instance);  
 } }
 /* given a namespace name, class and instance build the instance path for a          case PG_NAMESPACE:
    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 - TBD  
 */  
 // ATTN: KS Build path from instance and instance from class.  Not sure  
 //   we want to always do this.  Consider change to build keys directly  
   
 CIMObjectPath InteropProvider::_buildInstancePath(const CIMNamespaceName& name,  
                                            const CIMName className,  
                                            const CIMInstance& instance)  
 { {
     PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,              instances = enumNamespaceInstances();
             "InteropProvider::_buildInstancePath()");              break;
   
     // get the class CIM_Namespace class to use in building path  
     //CIMNamespaceName thisNamespace = classReference.getNameSpace();  
     CIMClass thisClass = _getClass(_operationNamespace, className);  
   
     // XmlWriter::printInstanceElement(instance);  
   
     CIMObjectPath ref = instance.buildPath(thisClass);  
   
     CDEBUG("Built path. path = " << ref.toString() );  
     PEG_METHOD_EXIT();  
     return(ref);  
 } }
           case PG_REGISTEREDPROFILE:
   
 /* _isNamespace determines if the namespace in the second  
    parameter is in the array in the first parameter.  
     @param array of possible namespaces  
     @param canidate namespace  
     @return - true if found  
 */  
 Boolean _isNamespace(  
         Array<CIMNamespaceName>& namespaceNames,  
         CIMNamespaceName& namespaceName)  
   
 { {
      Boolean found = false;              instances = enumRegisteredProfileInstances();
      for(Uint32 i = 0; i < namespaceNames.size(); i++)              break;
           }
           case PG_REGISTEREDSUBPROFILE:
      {      {
         if(namespaceNames[i].equal ( namespaceName))              instances = enumRegisteredSubProfileInstances();
               break;
           }
           case PG_REFERENCEDPROFILE:
         {         {
             return true;              instances = enumReferencedProfileInstances();
               break;
         }         }
           case PG_ELEMENTCONFORMSTOPROFILE:
           {
               instances = enumElementConformsToProfileInstances(context,
                   ref.getNameSpace());
               break;
      }      }
      return false;          case PG_ELEMENTCONFORMSTOPROFILE_RP_RP:
           {
               instances = enumElementConformsToProfileRPRPInstances(
                   context,
                   ref.getNameSpace());
               break;
 } }
           case PG_SUBPROFILEREQUIRESPROFILE:
 Boolean _isChild(  
         CIMNamespaceName& parentNamespaceName,  
         CIMNamespaceName& namespaceName)  
   
 { {
     String parent = parentNamespaceName.getString();              instances = enumSubProfileRequiresProfileInstances();
     String child = namespaceName.getString();              break;
    //          }
    //  If length of namespace name is shorter than or equal to the          case PG_SOFTWAREIDENTITY:
    //  length of parent namespace name, cannot be a child  
    //  
    if (child.size () <= parent.size ())  
    {    {
       return false;              instances = enumSoftwareIdentityInstances();
               break;
    }    }
           case PG_ELEMENTSOFTWAREIDENTITY:
    //  
    //  Compare prefix substring of namespace name with parent namespace name  
    //  
    else if (String::equalNoCase (child.subString (0, parent.size ()), parent))  
    {    {
       return true;              instances = enumElementSoftwareIdentityInstances();
               break;
    }    }
    return false;          case PG_INSTALLEDSOFTWAREIDENTITY:
           {
               instances = enumInstalledSoftwareIdentityInstances(context);
               break;
 } }
 //**************************************************************          case PG_COMPUTERSYSTEM:
 // Overloaded functions to get key value with different params  
 //**************************************************************  
   
 /* find the name key in the keybindings and return the value.  
     Executes exception if the key not found  
     @param object path we will search  
     @param keyName - Name of the key to find.  
     @return value of name property  
     @exceptions CIMInvalidParameterException  
 */  
 String _getKeyValue(const CIMObjectPath& instanceName, const CIMName& keyName)  
 { {
     Array<CIMKeyBinding> kbArray = instanceName.getKeyBindings();              instances.append(getComputerSystemInstance(context));
               break;
     // find the correct key binding          }
     for (Uint32 i = 0; i < kbArray.size(); i++)          case PG_HOSTEDOBJECTMANAGER:
     {     {
         if (kbArray[i].getName() == keyName)              instances.append(getHostedObjectManagerInstance(context));
               break;
           }
           case PG_HOSTEDACCESSPOINT:
         {         {
             return (kbArray[i].getValue());              instances = enumHostedAccessPointInstances(context);
               break;
         }         }
           //We don't support enumerate CIM_Namespace instances. PG_Namespace is
           //supported.
           case CIM_NAMESPACE:
           {
               break;
     }     }
     throw CIMInvalidParameterException("Invalid key property: " + keyName.getString());          case PG_PROVIDERPROFILECAPABILITIES:
           {
               instances = enumProviderProfileCapabilityInstances(false);
               break;
 } }
  
 String _getKeyValue(const CIMInstance& instance, const CIMName& keyName)  #ifdef PEGASUS_ENABLE_DMTF_INDICATION_PROFILE_SUPPORT
           case PG_ELEMENTCAPABILITIES:
 { {
     Uint32 pos;              instances = enumElementCapabilityInstances(context);
     CIMValue propertyValue;              break;
           }
     pos = instance.findProperty(keyName);          case PG_HOSTEDINDICATIONSERVICE:
     if (pos == PEG_NOT_FOUND)  
     {     {
        throw CIMPropertyNotFoundException              instances = enumHostedIndicationServiceInstances(context);
            (NAMESPACE_PROPERTYNAME.getString());              break;
     }     }
           case PG_SERVICEAFFECTSELEMENT:
     propertyValue = instance.getProperty(pos).getValue();  
     if (propertyValue.getType() != CIMTYPE_STRING)  
     {     {
        throw CIMInvalidParameterException("Invalid type for property: "              instances = enumServiceAffectsElementInstances(context);
                              + NAMESPACE_PROPERTYNAME.getString());              break;
     }     }
     String name;  #endif
     propertyValue.get(name);          default:
     return(name);              PEG_METHOD_EXIT();
     //ATTN: KS Returns String whereas below returns CIMNamespaceName.              throw CIMNotSupportedException(className.getString() +
                 " not supported by Interop Provider enumerate");
 } }
  
 /* gets the key value for the __Namespace property "name"      // Filter and deliver the resulting instances
    from the instance provided. Sets childNamespaceName and      for (Uint32 i = 0 ; i < instances.size() ; i++)
    isRelativeName fields  
    This overload called if instance provided.  
 */  
 void _getKeyValue (  
     const CIMInstance& namespaceInstance,  
         CIMNamespaceName& childNamespaceName,  
         Boolean& isRelativeName)  
   
 { {
     //Validate key property          normalizeInstance(instances[i], ref, false,
               false, propertyList);
       }
  
     Uint32 pos;      PEG_METHOD_EXIT();
     CIMValue propertyValue;      return instances;
   }
  
     // [Key, MaxLen (256), Description (  //
     //       "A string that uniquely identifies the Namespace "  // Class that determines whether or not the origin class in an association
     //       "within the ObjectManager.") ]  // operation is valid for the given association class, and also determines
     // string Name;  // the origin and target "roles". These values generally correspond to the
   // role and resultRole parameter of an associators/associatorNames operation.
   //
   bool InteropProvider::validAssocClassForObject(
       const OperationContext & context,
       const CIMName & assocClass,
       const CIMObjectPath & objectName,
       const CIMNamespaceName & opNamespace,
       String & originProperty,
       String & targetProperty)
   {
       PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,
           "InteropProvider::validAssocClassForObject()");
       TARGET_CLASS assocClassEnum = translateClassInput(assocClass);
       TARGET_CLASS originClassEnum = NOCLASS;
       CIMName originClass = objectName.getClassName();
       // If the association class is PG_ElementConformsToProfile, we'll have to
       // do some special processing in case the origin instance for the operation
       // is managed by another provider.
       if(assocClassEnum == PG_ELEMENTCONFORMSTOPROFILE)
       {
           // Test if the origin is an element managed by another provider
           // that has implemented a registered profile.
           if(opNamespace != PEGASUS_NAMESPACENAME_INTEROP ||
               (originClass != PEGASUS_CLASSNAME_PG_REGISTEREDPROFILE &&
                originClass != PEGASUS_CLASSNAME_PG_OBJECTMANAGER ))
           {
               //
               // Search the cached conformingElements list for the originClass,
               // returning false if it is not found
               //
               bool found = false;
  
     pos = namespaceInstance.findProperty(NAMESPACE_PROPERTYNAME);              PEGASUS_ASSERT(conformingElements.size() ==
     if (pos == PEG_NOT_FOUND)                  elementNamespaces.size());
               for(Uint32 i = 0, n = conformingElements.size(); i < n; ++i)
     {     {
        throw CIMPropertyNotFoundException                  CIMNameArray & elementList = conformingElements[i];
            (NAMESPACE_PROPERTYNAME.getString());                  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;
     }     }
  
     propertyValue = namespaceInstance.getProperty(pos).getValue();              if(!found)
     if (propertyValue.getType() != CIMTYPE_STRING)  
     {     {
        throw CIMInvalidParameterException("Invalid type for property: "                  PEG_METHOD_EXIT();
                              + NAMESPACE_PROPERTYNAME.getString());                  return false;
               }
           }
       }
       else
       {
           // Otherwise, just get the enum value representing the origin class
           // for this operation
           originClassEnum = translateClassInput(originClass);
     }     }
  
     String cnsName;      CIMName expectedTargetRole;
     propertyValue.get(cnsName);      CIMName expectedOriginRole;
     childNamespaceName = CIMNamespaceName (cnsName);  
       Array<CIMName> propNames;
     isRelativeName = !(childNamespaceName.isNull());      String profileName;
       CIMPropertyList propertyList;
       CIMInstance tmpInstance;
       Uint32 index;
       propNames.clear();
  
       //
       // Set the target and origin role values. Note that if these values are
       // not set following the switch block, that implies that the origin class
       // is not valid for the supplied association class.
       //
       switch(assocClassEnum)
       {
         case PG_NAMESPACEINMANAGER:
             if(originClassEnum == PG_OBJECTMANAGER)
             {
                 expectedTargetRole = PROPERTY_DEPENDENT;
                 expectedOriginRole = PROPERTY_ANTECEDENT;
 } }
 /* gets the key value for the __Namespace property "name"            else if(originClassEnum == PG_NAMESPACE)
    from the instance provided. Sets childNamespaceName and  
    isRelativeName fields  
    This overload called if object path provided.  
 */  
   
 void _getKeyValue (  
         const CIMObjectPath&  instanceName,  
         CIMNamespaceName& childNamespaceName,  
         Boolean& isRelativeName)  
 { {
                 expectedTargetRole = PROPERTY_ANTECEDENT;
     Array<CIMKeyBinding> kbArray = instanceName.getKeyBindings();                expectedOriginRole = PROPERTY_DEPENDENT;
     if ((kbArray.size() == 1) &&            }
             (kbArray[0].getName() == NAMESPACE_PROPERTYNAME))            break;
         case PG_COMMMECHANISMFORMANAGER:
             if(originClassEnum == PG_OBJECTMANAGER)
             {
                 expectedTargetRole = PROPERTY_DEPENDENT;
                 expectedOriginRole = PROPERTY_ANTECEDENT;
             }
             else if(originClassEnum == PG_CIMXMLCOMMUNICATIONMECHANISM)
             {
                 expectedTargetRole = PROPERTY_ANTECEDENT;
                 expectedOriginRole = PROPERTY_DEPENDENT;
             }
             break;
         case PG_ELEMENTCONFORMSTOPROFILE:
             if(originClass.equal(PEGASUS_CLASSNAME_PG_REGISTEREDPROFILE))
     {     {
        childNamespaceName = CIMNamespaceName (kbArray[0].getValue());                expectedTargetRole =
        isRelativeName = !(childNamespaceName.isNull());                    ELEMENTCONFORMSTOPROFILE_PROPERTY_MANAGEDELEMENT;
                 expectedOriginRole =
                     ELEMENTCONFORMSTOPROFILE_PROPERTY_CONFORMANTSTANDARD;
     }     }
     else     else
     {     {
        throw CIMInvalidParameterException("Invalid key property:  ");                expectedTargetRole =
                     ELEMENTCONFORMSTOPROFILE_PROPERTY_CONFORMANTSTANDARD;
                 expectedOriginRole =
                     ELEMENTCONFORMSTOPROFILE_PROPERTY_MANAGEDELEMENT;
             }
             break;
         case PG_ELEMENTCONFORMSTOPROFILE_RP_RP:
             propNames.append(CIMName("RegisteredName"));
             propertyList = CIMPropertyList(propNames);
             try
             {
                 tmpInstance = localGetInstance(
                     context,
                     objectName,
                     propertyList);
     }     }
             catch (CIMException &e)
             {
                 PEG_TRACE((TRC_CONTROLPROVIDER, Tracer::LEVEL2,
                     "CIMException while getting instance of Registered Profile "
                         ": %s",
                     (const char*)e.getMessage().getCString()));
 } }
             if (!tmpInstance.isUninitialized())
 /* generate the full namespace name from the parent and child  
    components  
    @param namespaceNames - List of all namespaces  
    @param parentNamespaceName  
    @param childNamespaceName  
    @param Boolean isrelative  
    @return full namespacename created from parent + child  
    Note that if isrelative is true, parent is tested for validty  
 */  
 CIMNamespaceName _generateFullNamespaceName(  
         Array<CIMNamespaceName>& namespaceNames,  
         CIMNamespaceName& parentNamespaceName,  
         CIMNamespaceName& childNamespaceName,  
         Boolean isRelativeName)  
   
 { {
     // If isRelativeName is true, then the parentNamespace                index = tmpInstance.findProperty("RegisteredName");
     // MUST exist                if (index != PEG_NOT_FOUND)
     //  
     CIMNamespaceName fullNamespaceName;  
   
     if (isRelativeName)  
     {     {
       if (!_isNamespace(namespaceNames, parentNamespaceName))                    const CIMValue &tmpVal =
                         tmpInstance.getProperty(index).getValue();
                     if (!tmpVal.isNull())
       {       {
          throw CIMObjectNotFoundException("Parent namespace does not exist: "                        tmpVal.get(profileName);
                                   + parentNamespaceName.getString());                    }
       }       }
       // Create full namespace name by prepending parentNamespaceName            }
       fullNamespaceName = CIMNamespaceName (parentNamespaceName.getString()            if (String::compareNoCase(profileName, String("SMI-S")) == 0)
           + "/" + childNamespaceName.getString());            {
                 expectedTargetRole =
                     ELEMENTCONFORMSTOPROFILE_PROPERTY_MANAGEDELEMENT;
                 expectedOriginRole =
                     ELEMENTCONFORMSTOPROFILE_PROPERTY_CONFORMANTSTANDARD;
     }     }
     else     else
     {     {
       fullNamespaceName = parentNamespaceName;                expectedTargetRole =
                     ELEMENTCONFORMSTOPROFILE_PROPERTY_CONFORMANTSTANDARD;
                 expectedOriginRole =
                     ELEMENTCONFORMSTOPROFILE_PROPERTY_MANAGEDELEMENT;
     }     }
     return(fullNamespaceName);            break;
         case PG_SUBPROFILEREQUIRESPROFILE:
             if(originClassEnum == PG_REGISTEREDPROFILE)
             {
                 expectedTargetRole = PROPERTY_DEPENDENT;
                 expectedOriginRole = PROPERTY_ANTECEDENT;
 } }
             else if(originClassEnum == PG_REGISTEREDSUBPROFILE)
 //***************************************************************************            {
 //  The following section is the Instance Operation processors                expectedTargetRole = PROPERTY_ANTECEDENT;
 //***************************************************************************                expectedOriginRole = PROPERTY_DEPENDENT;
 //                createInstance  
 //***************************************************************************  
 void InteropProvider::createInstance(  
         const OperationContext & context,  
         const CIMObjectPath & instanceReference,  
     const CIMInstance& myInstance,  
         ObjectPathResponseHandler & handler)  
     {  
         PEG_METHOD_ENTER(TRC_CONTROLPROVIDER, "InteropProvider::createInstance()");  
   
         CIMNamespaceName childNamespaceName;  
         CIMNamespaceName newNamespaceName;  
         Boolean isRelativeName;  
         CDEBUG("CreateInstance " << instanceReference.toString());  
         // operation namespace needed internally to get class.  
         _operationNamespace = instanceReference.getNameSpace();  
   
         // Verify that ClassName is correct and get value  
         Uint32 classEnum  = _verifyValidClassInput(instanceReference.getClassName());  
   
         String userName = _validateUserID(context);  
         CIMObjectPath newInstanceReference;  
   
         if (classEnum == CIM_OBJECTMANAGERCOMMUNICATIONMECHANISM)  
             throw CIMNotSupportedException("InteropProvider::createInstance");  
   
         if (classEnum == CIM_CIMXMLCOMMUNICATIONMECHANISM)  
             throw CIMNotSupportedException("InteropProvider::createInstance");  
   
         if (classEnum == CIM_NAMESPACE)  
         {  
             CDEBUG("Create Class from CIM_Namespace");  
             Boolean isGood = _testKeys(instanceReference);  
             String namespaceName;  
             newNamespaceName = _getKeyValue(myInstance, CIM_NAMESPACE_PROPERTY_NAME);  
             // ATTN: KS TBD  
             //Array<CIMKeyBinding> keyBindings;  
             //keyBindings = _buildKeyBindings();  
             //newInstanceReference.set(String::EMPTY, namespaceName,  
             //                   CIM_NAMESPACE_CLASSNAME, keyBindings);  
             //CDEBUG("Create namespace = " << newNamespaceName);  
             CIMInstance instance = _buildInstanceCIMNamespace(namespaceName);  
             newInstanceReference = _buildInstancePath(CIMNamespaceName(namespaceName),  
                                         CIM_NAMESPACE_CLASSNAME, instance);  
         }  
         else   // Process the __Namespace request to get namespace name value  
         {  
             _getKeyValue(myInstance, childNamespaceName, isRelativeName);  
             CIMNamespaceName parentNamespaceName = instanceReference.getNameSpace();  
   
             PEG_TRACE_STRING(TRC_CONTROLPROVIDER, Tracer::LEVEL4,  
                "childNamespaceName = " + childNamespaceName.getString() +  
                ", isRelativeName = " +  
                (isRelativeName?String("true"):String("false")) +  
                ", parentNamespaceName = " + parentNamespaceName.getString());  
   
             Array<CIMNamespaceName> namespaceNames;  
             namespaceNames = _enumerateNameSpaces();  
   
             newNamespaceName = _generateFullNamespaceName(  
                 namespaceNames, parentNamespaceName,  
                          childNamespaceName, isRelativeName);  
   
             // return key (i.e., CIMObjectPath) for newly created namespace  
   
             Array<CIMKeyBinding> keyBindings;  
             keyBindings.append(CIMKeyBinding(NAMESPACE_PROPERTYNAME,  
                  isRelativeName?childNamespaceName.getString():  
                                     parentNamespaceName.getString(),  
                                          CIMKeyBinding::STRING));  
             //Add namespace class and keybindings  
             newInstanceReference.set(String::EMPTY, parentNamespaceName,  
                                          __NAMESPACE_CLASSNAME, keyBindings);  
         }         }
         // Create the new namespace            break;
         try        case PG_REFERENCEDPROFILE:
             if (originClassEnum == PG_REGISTEREDSUBPROFILE)
         {         {
             _repository->createNameSpace(newNamespaceName);                expectedTargetRole = PROPERTY_ANTECEDENT;
                 expectedOriginRole = PROPERTY_DEPENDENT;
             PEG_TRACE_STRING(TRC_CONTROLPROVIDER, Tracer::LEVEL4,  
                 "Namespace = " + newNamespaceName.getString() +  
                     " successfully created.");  
             // ATTN: Add standardlog entry here.  
         }         }
         catch(CIMException& e)            else if (originClassEnum == PG_REGISTEREDPROFILE)
         {         {
            _repository->write_unlock();                if ((targetProperty.size() != 0) &&
            PEG_METHOD_EXIT();                    (originProperty.size() != 0) &&
            throw e;                    String::equalNoCase(targetProperty, originProperty))
                 {
                     return false;
         }         }
         catch(Exception& e)                if (targetProperty.size() != 0)
         {         {
            _repository->write_unlock();                    if (!(String::equalNoCase(targetProperty, "Antecedent") ||
            PEG_METHOD_EXIT();                        String::equalNoCase(targetProperty, "Dependent") ))
            throw e;                    {
                         return false;
         }         }
   
         _repository->write_unlock();  
   
         // begin processing the request  
         handler.processing();  
   
   
        handler.deliver(newInstanceReference);  
   
        // complete processing the request  
        handler.complete();  
   
        PEG_METHOD_EXIT();  
        return;  
    }    }
                 if (originProperty.size() != 0)
 //***************************************************************************  
 //                deleteInstance  
 //***************************************************************************  
 void InteropProvider::deleteInstance(  
         const OperationContext & context,  
         const CIMObjectPath & instanceName,  
         ResponseHandler & handler)  
     {     {
         PEG_METHOD_ENTER(TRC_CONTROLPROVIDER, "InteropProvider::deleteInstance");                    if (!(String::equalNoCase(originProperty, "Antecedent") ||
         CDEBUG("deleteInstance" << instanceName.toString());                        String::equalNoCase(originProperty, "Dependent") ))
         CIMNamespaceName childNamespaceName;  
         CIMNamespaceName deleteNamespaceName;  
         Boolean isRelativeName;  
   
         // Verify that ClassName is correct and get value  
         Uint32 classEnum  = _verifyValidClassInput(instanceName.getClassName());  
   
         String userName = _validateUserID(context);  
   
         Array<CIMNamespaceName> namespaceNames;  
         namespaceNames = _enumerateNameSpaces();  
   
         if (classEnum == CIM_OBJECTMANAGERCOMMUNICATIONMECHANISM)  
             throw CIMNotSupportedException("InteropProvider::createInstance");  
   
         if (classEnum == CIM_CIMXMLCOMMUNICATIONMECHANISM)  
             throw CIMNotSupportedException("InteropProvider::createInstance");  
   
         if (classEnum == CIM_NAMESPACE)  
         {         {
             _testKeys(instanceName);                        return false;
             deleteNamespaceName = _getKeyValue(instanceName, CIM_NAMESPACE_PROPERTY_NAME);                    }
             CDEBUG("Delete namespace = " << deleteNamespaceName );  
         }         }
         else  // Procesing for __namespace                if (String::equalNoCase(originProperty, "Antecedent") &&
                     targetProperty.size() == 0)
         {         {
                     targetProperty = String("Dependent");
            _getKeyValue(instanceName, childNamespaceName, isRelativeName);  
            CIMNamespaceName parentNamespaceName = instanceName.getNameSpace();  
   
            PEG_TRACE_STRING(TRC_CONTROLPROVIDER, Tracer::LEVEL4,  
                "childNamespaceName = " + childNamespaceName.getString() +  
                (isRelativeName?String("true"):String("false")) +  
                ", parentNamespaceName = " + parentNamespaceName.getString());  
   
            // begin processing the request  
   
            deleteNamespaceName = _generateFullNamespaceName(  
                namespaceNames, parentNamespaceName,  
                          childNamespaceName, isRelativeName);  
         }         }
                 if (String::equalNoCase(originProperty, "Dependent") &&
             // ATTN: KS Why THis???                    targetProperty.size() == 0)
         if (deleteNamespaceName.equal (ROOTNS))  
        {        {
            throw CIMNotSupportedException("root namespace cannot be deleted.");                    targetProperty = String("Antecedent");
        }        }
                 if (String::equalNoCase(targetProperty, "Antecedent") &&
            _repository->deleteNameSpace(deleteNamespaceName);                    originProperty.size() == 0)
                 {
            PEG_TRACE_STRING(TRC_CONTROLPROVIDER, Tracer::LEVEL4,                    originProperty = String("Dependent");
                "Namespace = " + deleteNamespaceName.getString() +  
                " successfully deleted.");  
        // ATTN: Log entry for deletion.  
        handler.processing();  
   
        // complete processing the request  
        handler.complete();  
   
        PEG_METHOD_EXIT();  
        return ;  
     }     }
                 if (String::equalNoCase(targetProperty, "Dependent") &&
 //***************************************************************************                    originProperty.size() == 0)
 //                getInstance  
 //***************************************************************************  
 void InteropProvider::getInstance(  
     const OperationContext & context,  
     const CIMObjectPath & instanceName,  
     const Boolean includeQualifiers,  
     const Boolean includeClassOrigin,  
     const CIMPropertyList & properatyList,  
     InstanceResponseHandler & handler)  
     {     {
         PEG_METHOD_ENTER(TRC_CONTROLPROVIDER, "InteropProvider::getInstance");                    originProperty = String("Antecedent");
                 }
         // Verify that ClassName is correct and get value                return true;
         Uint32 classEnum  = _verifyValidClassInput(instanceName.getClassName());            }
             break;
         String userName = _validateUserID(context);        case PG_ELEMENTSOFTWAREIDENTITY:
             if(originClassEnum == PG_SOFTWAREIDENTITY)
         // begin processing the request  
         handler.processing();  
         if (classEnum == CIM_OBJECTMANAGER)  
         {         {
             CIMInstance instance = _buildInstanceCIMObjectManager();                expectedTargetRole = PROPERTY_DEPENDENT;
             handler.deliver(instance);                expectedOriginRole = PROPERTY_ANTECEDENT;
             handler.complete();  
             PEG_METHOD_EXIT();  
             return;  
         }         }
             else if(originClassEnum == PG_REGISTEREDPROFILE ||
         if (classEnum == CIM_OBJECTMANAGERCOMMUNICATIONMECHANISM)                originClassEnum == PG_REGISTEREDSUBPROFILE)
         {         {
             CIMInstance instance = _buildInstancCIMObjectCommunicationMechanism();                expectedTargetRole = PROPERTY_ANTECEDENT;
             handler.deliver(instance);                expectedOriginRole = PROPERTY_DEPENDENT;
             handler.complete();  
             PEG_METHOD_EXIT();  
             return;  
         }         }
             break;
         case PG_INSTALLEDSOFTWAREIDENTITY:
         if (classEnum == CIM_CIMXMLCOMMUNICATIONMECHANISM)            if(originClassEnum == PG_SOFTWAREIDENTITY)
         {         {
             CIMInstance instance = _buildInstancCIMXMLCommunicationMechanism();                expectedTargetRole = INSTALLEDSOFTWAREIDENTITY_PROPERTY_SYSTEM;
             handler.deliver(instance);                expectedOriginRole =
             handler.complete();                    INSTALLEDSOFTWAREIDENTITY_PROPERTY_INSTALLEDSOFTWARE;
             PEG_METHOD_EXIT();  
             return;  
   
         }         }
             else if(originClassEnum == PG_COMPUTERSYSTEM)
         // Get List of namespaces  
         Array<CIMNamespaceName> namespaceNames;  
         namespaceNames = _enumerateNameSpaces();  
         CIMInstance instance;  
   
   
         if (classEnum == CIM_NAMESPACE)  
         {         {
             // Not clear what we have to take into account here.                expectedTargetRole =
             // get the namespace from the name value.                    INSTALLEDSOFTWAREIDENTITY_PROPERTY_INSTALLEDSOFTWARE;
             // should check the other keys to see if valid.                expectedOriginRole = INSTALLEDSOFTWAREIDENTITY_PROPERTY_SYSTEM;
             CIMNamespaceName namespaceName;            }
             namespaceName = _getKeyValue(instanceName, CIM_NAMESPACE_PROPERTY_NAME);            break;
             // ATTN: Why this CIMNamespaceName parentNamespaceName = instanceName.getNameSpace();        case PG_HOSTEDACCESSPOINT:
             if(originClassEnum == PG_COMPUTERSYSTEM)
             if (!_isNamespace(namespaceNames, namespaceName))  
             {             {
                 throw CIMObjectNotFoundException("Namespace does not exist: "                expectedTargetRole = PROPERTY_DEPENDENT;
                                      + namespaceName.getString());                expectedOriginRole = PROPERTY_ANTECEDENT;
             }             }
             PEG_TRACE_STRING(TRC_CONTROLPROVIDER, Tracer::LEVEL4,            else if(originClassEnum == PG_CIMXMLCOMMUNICATIONMECHANISM)
                "Namespace = " + namespaceName.getString() + " successfully found.");            {
             instance = _buildInstanceCIMNamespace(namespaceName);                expectedTargetRole = PROPERTY_ANTECEDENT;
                 expectedOriginRole = PROPERTY_DEPENDENT;
         }         }
         else  // processing for __Namespace        case PG_HOSTEDOBJECTMANAGER:
             if(originClassEnum == PG_COMPUTERSYSTEM)
         {         {
             CIMNamespaceName childNamespaceName;                expectedTargetRole = PROPERTY_DEPENDENT;
             CIMNamespaceName getNamespaceName;                expectedOriginRole = PROPERTY_ANTECEDENT;
             Boolean isRelativeName;            }
             else if(originClassEnum == PG_OBJECTMANAGER)
             _getKeyValue(instanceName, childNamespaceName, isRelativeName);  
             CIMNamespaceName parentNamespaceName = instanceName.getNameSpace();  
   
             PEG_TRACE_STRING(TRC_CONTROLPROVIDER, Tracer::LEVEL4,  
                "childNamespaceName = " + childNamespaceName.getString() +  
                (isRelativeName?String("true"):String("false")) +  
                ", parentNamespaceName = " + parentNamespaceName.getString());  
   
   
             getNamespaceName = _generateFullNamespaceName(  
                 namespaceNames, parentNamespaceName,  
                          childNamespaceName, isRelativeName);  
   
             // exception if not valid namespace  
             if (!_isNamespace(namespaceNames, getNamespaceName))  
             {             {
               throw CIMObjectNotFoundException("Namespace deos not exist: "                expectedTargetRole = PROPERTY_ANTECEDENT;
                                      + getNamespaceName.getString());                expectedOriginRole = PROPERTY_DEPENDENT;
             }
             break;
   #ifdef PEGASUS_ENABLE_DMTF_INDICATION_PROFILE_SUPPORT
         case PG_HOSTEDINDICATIONSERVICE:
             if(originClassEnum == PG_COMPUTERSYSTEM)
             {
                 expectedTargetRole = PROPERTY_DEPENDENT;
                 expectedOriginRole = PROPERTY_ANTECEDENT;
             }
             break;
   #endif
         default:
             break;
             }             }
             PEG_TRACE_STRING(TRC_CONTROLPROVIDER, Tracer::LEVEL4,  
                "Namespace = " + getNamespaceName.getString() +  
                    " successfully found.");  
   
             //Set name of class  
             CIMInstance instance(__NAMESPACE_CLASSNAME);  
  
             //             //
             // construct the instance      // The rest of this method checks to see if target role and origin roles
       // were found for the association and origin class combination and, if
       // found, checks against the input target and origin roles if provided.
       // Failure for any of these tests points to an invalid association
       // traversal request.
             //             //
             instance.addProperty(CIMProperty(NAMESPACE_PROPERTYNAME,      if(expectedTargetRole.isNull() ||
             isRelativeName?childNamespaceName.getString():          expectedOriginRole.isNull())
                               parentNamespaceName.getString()));      {
             //instance.setPath(instanceName);  
        }  
   
        handler.deliver(instance);  
   
        // complete processing the request  
        handler.complete();  
   
        PEG_METHOD_EXIT();        PEG_METHOD_EXIT();
        return ;          return false;
     }     }
  
 //***************************************************************************      if(targetProperty.size() == 0)
 //                enumerateInstances  
 //***************************************************************************  
 void InteropProvider::enumerateInstances(  
     const OperationContext & context,  
     const CIMObjectPath & ref,  
     const Boolean includeQualifiers,  
     const Boolean includeClassOrigin,  
     const CIMPropertyList& propertyList,  
     InstanceResponseHandler & handler)  
     {     {
         PEG_METHOD_ENTER(TRC_CONTROLPROVIDER, "InteropProvider::enumerateInstances()");          targetProperty = expectedTargetRole.getString();
         CDEBUG("EnumerateInstances");  
         // Verify that ClassName is correct and get value  
         Uint32 classEnum  = _verifyValidClassInput(ref.getClassName());  
   
         String userName = _validateUserID(context);  
   
         // The following 3 classes deliver a single instance because  
         // that is all there is today.  
         if (classEnum == CIM_OBJECTMANAGER)  
         {  
             CIMInstance instance = _buildInstanceCIMObjectManager();  
             handler.deliver(instance);  
             handler.complete();  
             PEG_METHOD_EXIT();  
             return;  
         }         }
       else if(!expectedTargetRole.equal(targetProperty))
         if (classEnum == CIM_OBJECTMANAGERCOMMUNICATIONMECHANISM)  
         {         {
             CIMInstance instance = _buildInstancCIMObjectCommunicationMechanism();  
             handler.deliver(instance);  
             handler.complete();  
             PEG_METHOD_EXIT();             PEG_METHOD_EXIT();
             return;          return false;
         }         }
  
       if(originProperty.size() == 0)
         if (classEnum == CIM_CIMXMLCOMMUNICATIONMECHANISM)      {
           originProperty = expectedOriginRole.getString();
       }
       else if(!expectedOriginRole.equal(originProperty))
         {         {
             CIMInstance instance = _buildInstancCIMXMLCommunicationMechanism();  
             handler.deliver(instance);  
             handler.complete();  
             PEG_METHOD_EXIT();             PEG_METHOD_EXIT();
             return;          return false;
   
         }         }
  
         // ATTN: Fix this up.  should not be here.      PEG_METHOD_EXIT();
         CIMNamespaceName parentNamespaceName = ref.getNameSpace();      return true;
   }
         // ATTN KS Fix this so references both types of namespace  
         PEG_TRACE_STRING(TRC_CONTROLPROVIDER, Tracer::LEVEL4,  
            "parentNamespaceName = " + parentNamespaceName.getString());  
   
         // begin processing the request  
         handler.processing();  
   
         Array<CIMNamespaceName> namespaceNames = _enumerateNameSpaces();  
  
         Array<CIMInstance> instanceArray;  //
         CDEBUG("Found " << namespaceNames.size() << " namespaces.");  // Local version of the references operation. It validates the input
         // Build response objects based on class requested  // parameters, setting the origin and target property values if not set
         for (Uint32 i = 0; i < namespaceNames.size(); i++)  // already, and then performs an enumeration on the association class. It then
         {  // filters the results of that enumeration to see if one of the reference
             CDEBUG("For namespace' " << namespaceNames[i].getString());  // properties matches the objectName parameter passed into the method. If so,
             CDEBUG("Evaluate ClassEnum" << classEnum);  // then it is added to the array of association instances to be returned.
             if (classEnum == CIM_NAMESPACE)  //
   Array<CIMInstance> InteropProvider::localReferences(
       const OperationContext & context,
       const CIMObjectPath & objectName,
       const CIMName & assocClass,
       String & originProperty,
       String & targetProperty,
       const CIMPropertyList & propertyList,
       const CIMName & targetClass)
             {             {
                 CDEBUG("Evaluate CIM_Namespace" << classEnum);      PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,
                 // Create a valid CIM_Namespace Instance          "InteropProvider::localReferences()");
                 CIMInstance instance = _buildInstanceCIMNamespace(namespaceNames[i]);  
                 instanceArray.append(instance);  
  
                 PEG_TRACE_STRING(TRC_CONTROLPROVIDER, Tracer::LEVEL4,      Array<CIMInstance> instances;
                 "Namespace = " + namespaceNames[i].getString());      CIMName originClass = objectName.getClassName();
  
       Array<CIMName> targetSubclasses;
       CIMNamespaceName lastTargetNamespace;
       CIMNamespaceName originNamespace(objectName.getNameSpace());
   
       // Check that the association traversal request is valid
       if (validAssocClassForObject(
           context,
           assocClass,
           objectName,
           originNamespace,
           originProperty,
           targetProperty))
       {
           // retrieve all of the association class instances
           Array<CIMInstance> localInstances = localEnumerateInstances(context,
               CIMObjectPath(hostName, originNamespace,
                   assocClass));
           // Filter the association class instances based on the origin instance
           // and other input parameters.
           for(Uint32 i = 0, n = localInstances.size(); i < n; ++i)
           {
               CIMInstance & currentInstance = localInstances[i];
               CIMObjectPath originPath = getRequiredValue<CIMObjectPath>(
                   currentInstance, originProperty);
               originPath.setNameSpace(objectName.getNameSpace());
               originPath.setHost(objectName.getHost());
               // Only include instances where the origin instance is present in
               // the association.
               if(originPath.identical(objectName))
               {
                   if(!targetClass.isNull())
                   {
                       // Have to check if the target reference is of the
                       // targetClass type. We first must determine all the
                       // possible subclasses of the targetClass in the target
                       // namespace.
                       CIMObjectPath targetPath = getRequiredValue<CIMObjectPath>(
                           currentInstance, targetProperty);
   
                       CIMNamespaceName targetNamespace(
                           targetPath.getNameSpace());
                       if(targetNamespace.isNull())
                       {
                           targetNamespace = originNamespace;
                           targetPath.setNameSpace(targetNamespace);
             }             }
             else // the else covers __NAMESPACE                      if(targetNamespace != lastTargetNamespace)
             {             {
                 // Build the instances. For now simply build the __Namespace instances                          try
                 // the only property is name.  
                 if (_isChild(parentNamespaceName, namespaceNames[i]))  
                 {                 {
                     CIMInstance instance(__NAMESPACE_CLASSNAME);                              targetSubclasses = repository->enumerateClassNames(
                     instance.addProperty(                                  targetNamespace, targetClass, true);
                         (CIMProperty(NAMESPACE_PROPERTYNAME,  
                         namespaceNames[i].getString().subString  
                             (parentNamespaceName.getString().size()+1,  
                             namespaceNames[i].getString().size()-  
                         parentNamespaceName.getString().size()-1))));  
   
                     instanceArray.append(instance);  
   
                     //instance.setPath(instanceName);  
                     PEG_TRACE_STRING(TRC_CONTROLPROVIDER, Tracer::LEVEL4,  
                     "childNamespace = " + namespaceNames[i].getString());  
                 }                 }
                           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;
         }         }
         handler.deliver(instanceArray);  
  
         // complete processing the request                      // Try to find the targetPath's class in the search space
         handler.complete();                      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();         PEG_METHOD_EXIT();
       return instances;
     }     }
  
 //***************************************************************************  
 //                enumerateInstanceNames  
 //***************************************************************************  
  
 void InteropProvider::enumerateInstanceNames(  //
         const OperationContext & context,  // Builds an instance of the class named className. Gets Class defintion and
         const CIMObjectPath & classReference,  // fills in the correct properties from the class.  This requires a repository
         ObjectPathResponseHandler & handler)  // getClass request for each instance built. The skeleton is built by
   // creating the instance and copying qualifiers and properties from
   // the class. Finally the instance is cloned to separate it from the
   // original objects.
   // NOTE: This is very inefficient for anything larger than a few instances.
   // We should separate the get from the createSkeleton.
   // @param className CIMName of the class for which the instance is to be built
   // @return CIMInstance of this class with properties complete.
   // @exception passes on any exceptions received from the repository request.
   //
   CIMInstance InteropProvider::buildInstanceSkeleton(
         const CIMNamespaceName & nameSpace,
         const CIMName& className,
         Boolean includeQualifiers,
         CIMClass& returnedClass)
     {     {
         PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,         PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,
                 "InteropProvider::enumerateInstanceNames()");          "InteropProvider::_buildInstanceSkeleton()");
       // get class with lo = false, qualifier = true classorig = true
         // operation namespace needed internally to get class.      returnedClass = repository->getClass(nameSpace,
         _operationNamespace = classReference.getNameSpace();          className, false, true, true);
       CIMInstance skeleton = returnedClass.buildInstance(
         Uint32 classEnum  = _verifyValidClassInput(classReference.getClassName());          includeQualifiers, true, CIMPropertyList());
   
         // begin processing the request  
         handler.processing();  
   
         // The following 3 classes deliver a single instance because  
         // that is all there is today.  
         if (classEnum == CIM_OBJECTMANAGER)  
         {  
             CIMInstance instance = _buildInstanceCIMObjectManager();  
             CIMObjectPath ref = _buildInstancePath(CIMNamespaceName(),  
                 CIM_OBJECTMANAGER_CLASSNAME, instance);  
             handler.deliver(ref);  
             handler.complete();  
             PEG_METHOD_EXIT();  
             return;  
         }  
  
         if (classEnum == CIM_OBJECTMANAGERCOMMUNICATIONMECHANISM)  
         {  
             CIMInstance instance = _buildInstancCIMObjectCommunicationMechanism();  
             CIMObjectPath ref = _buildInstancePath(CIMNamespaceName(),  
                 CIM_OBJECTMANAGERCOMMUNICATIONMECHANISM_CLASSNAME, instance);  
             handler.deliver(ref);  
             handler.complete();  
             PEG_METHOD_EXIT();             PEG_METHOD_EXIT();
             return;      return skeleton;
         }         }
  
  
         if (classEnum == CIM_CIMXMLCOMMUNICATIONMECHANISM)  CIMInstance InteropProvider::buildDependencyInstance(
       const String & antecedentId,
       const CIMName & antecedentClass,
       const String & dependentId,
       const CIMName & dependentClass,
       const CIMClass & dependencyClass)
         {         {
             CIMInstance instance = _buildInstancCIMXMLCommunicationMechanism();      Array<CIMKeyBinding> dependentKeys;
             CIMObjectPath ref = _buildInstancePath(CIMNamespaceName(),  
                 CIM_CIMXMLCOMMUNICATIONMECHANISM_CLASSNAME, instance);  
             handler.deliver(ref);  
             handler.complete();  
             PEG_METHOD_EXIT();  
             return;  
  
         }      dependentKeys.append(CIMKeyBinding(
           COMMON_PROPERTY_INSTANCEID,
           dependentId,CIMKeyBinding::STRING));
  
         String userName = _validateUserID(context);      return buildDependencyInstanceFromPaths(
           buildDependencyReference(hostName, antecedentId, antecedentClass),
           buildDependencyReference(hostName, dependentId, dependentClass),
           dependencyClass);
   }
  
         // ATTN: Move this trace  void InteropProvider::initProvider()
         CIMNamespaceName parentNamespaceName = classReference.getNameSpace();  {
         PEG_TRACE_STRING(TRC_CONTROLPROVIDER, Tracer::LEVEL4,      if(providerInitialized)
            "parentNamespaceName = " + parentNamespaceName.getString());          return;
         CDEBUG("Enumerate Instance Names. ns = " << parentNamespaceName.getString());      // Placed METHOD_ENTER trace statement after checking whether the
       // provider is initialized because this method will be called for every
       // operation through the InteropProvider, and this method is only
       // interesting the first time it is successfully run.
       PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,
           "InteropProvider::initProvider()");
  
         // Get list of all namespaces      AutoMutex lock(interopMut);
         Array<CIMNamespaceName> namespaceNames = _enumerateNameSpaces();      if(!providerInitialized)
         CDEBUG("Found " << namespaceNames.size() << " namespaces.");      {
           //
           // Initialize the object manager instance for the CIM Server, and
           // retrieve the object manager's name property. This is retrieved once
           // and stored for use in constructing other instances requiring its
           // value.
           //
           CIMInstance objectManager = getObjectManagerInstance();
           objectManager.getProperty(objectManager.findProperty(
               OM_PROPERTY_NAME)).getValue().get(objectManagerName);
  
         // Build the cimObjectPath for each namespace found          //
         for (Uint32 i = 0; i < namespaceNames.size(); i++)          // Determine whether the CIMOM should be gathering statistical data
           // based on the GatherStatisticalData property in the object manager.
           //
           Uint32 gatherDataIndex = objectManager.findProperty(
               OM_PROPERTY_GATHERSTATISTICALDATA);
           if(gatherDataIndex != PEG_NOT_FOUND)
         {         {
             if (classEnum == CIM_NAMESPACE)              CIMConstProperty gatherDataProp =
                   objectManager.getProperty(gatherDataIndex);
               if (gatherDataProp.getType() == CIMTYPE_BOOLEAN)
             {             {
                   CIMValue gatherDataVal  = gatherDataProp.getValue();
                 CDEBUG("Calling BuildInstancePath for "<< namespaceNames[i].getString() );                  if (!gatherDataVal.isNull())
                 CIMInstance instance = _buildInstanceCIMNamespace(namespaceNames[i]);  
                 CIMObjectPath ref = _buildInstancePath(CIMNamespaceName(namespaceNames[i]),  
                                             CIM_NAMESPACE_CLASSNAME, instance);  
   
                 handler.deliver(ref);  
   
                 PEG_TRACE_STRING(TRC_CONTROLPROVIDER, Tracer::LEVEL4,  
                     "namespace = " + namespaceNames[i].getString());  
             }  
             else  
             {             {
                 Array<CIMKeyBinding> keyBindings;                      Boolean gatherData;
                 // Build the __Namespace objectpath                      gatherDataVal.get(gatherData);
                 // Note that for the moment, the only property is name.                      if (gatherData == true)
                 if (_isChild(parentNamespaceName, namespaceNames[i]))  
                 {                 {
                     keyBindings.clear();                          StatisticalData* sd = StatisticalData::current();
                       keyBindings.append(CIMKeyBinding(NAMESPACE_PROPERTYNAME,                          sd->setCopyGSD(true);
                           namespaceNames[i].getString().subString                      }
                           (parentNamespaceName.getString().size()+1,  
                           namespaceNames[i].getString().size()-  
                           parentNamespaceName.getString().size()-1),  
                           CIMKeyBinding::STRING));  
   
                       CIMObjectPath ref(String::EMPTY, parentNamespaceName,  
                       __NAMESPACE_CLASSNAME, keyBindings);  
   
                       handler.deliver(ref);  
                       PEG_TRACE_STRING(TRC_CONTROLPROVIDER, Tracer::LEVEL4,  
                           "childNamespace = " + namespaceNames[i].getString());  
                 }                 }
             }             }
         }         }
  
         handler.complete();          // Cache this class definition for use later.
           profileCapabilitiesClass = repository->getClass(
               PEGASUS_NAMESPACENAME_INTEROP,
               PEGASUS_CLASSNAME_PG_PROVIDERPROFILECAPABILITIES,
               false,
               true,
               false);
  
         PEG_METHOD_EXIT();          providerClassifications.append(Uint16(5)); // "Instrumentation"
     }  
  
           // initialize namespaces.
           initializeNamespaces();
  
 //**************************************************************          // Now cache the Registration info used for ElementConformsToProfile
 //**************************************************************          cacheProfileRegistrationInfo();
 // Association Functions  
 //**************************************************************  
 //**************************************************************  
  
 void InteropProvider::associators(          providerInitialized = true;
         const OperationContext & context,      }
         const CIMObjectPath & objectName,      PEG_METHOD_EXIT();
         const CIMName & associationClass,  
         const CIMName & resultClass,  
         const String & role,  
         const String & resultRole,  
         const Boolean includeQualifiers,  
         const Boolean includeClassOrigin,  
         const CIMPropertyList & propertyList,  
         ObjectResponseHandler & handler)  
 {  
         throw CIMNotSupportedException("AssociationProvider::associators");  
 } }
  
 void InteropProvider::associatorNames(  //
         const OperationContext & context,  // Initialize the namespaces so that all namespaces with the
         const CIMObjectPath & objectName,  // CIM_ElementConformsToProfile class also have the
         const CIMName & associationClass,  // PG_ElementConformsToProfile class. Needed in order to implement
         const CIMName & resultClass,  // the cross-namespace ElementConformsToProfile association in both
         const String & role,  // directions.
         const String & resultRole,  //
         ObjectPathResponseHandler & handler)  void InteropProvider::initializeNamespaces()
 { {
         throw CIMNotSupportedException("AssociationProvider::associatorNames");      Array<CIMNamespaceName> namespaceNames =  repository->enumerateNameSpaces();
       // get the PG_ElementConformstoProfile class without the qualifiers
       // and then add just the required ASSOCIATION qualifier, so that
       // resolveclass doesn't fail for the test/EmbeddedInstance/Dynamic
       // namespace, which uses the CIM25 schema that doesn't include any
       // of the new qualifiers added to this class in later versions of
       // the CIMSchema.
       CIMClass conformsClass = repository->getClass(
           PEGASUS_NAMESPACENAME_INTEROP,
           PEGASUS_CLASSNAME_PG_ELEMENTCONFORMSTOPROFILE,
           true,
           false);
       conformsClass.addQualifier(
           CIMQualifier(CIMName("ASSOCIATION"), CIMValue(true)));
       CIMClass profileClass = repository->getClass(
           PEGASUS_NAMESPACENAME_INTEROP,
           PEGASUS_CLASSNAME_PG_REGISTEREDPROFILE,
           true,
           false);
       for(Uint32 i = 0, n = namespaceNames.size(); i < n; ++i)
       {
           // Check if the PG_ElementConformsToProfile class is present
           CIMNamespaceName & currentNamespace = namespaceNames[i];
           CIMClass tmpCimClass;
           CIMClass tmpPgClass;
           CIMClass tmpPgProfileClass;
           try
           {
               // Look for these classes in the same try-block since the
               // second depends on the first
               tmpCimClass = repository->getClass(
                   currentNamespace,
                   PEGASUS_CLASSNAME_CIM_ELEMENTCONFORMSTOPROFILE);
               tmpPgClass = repository->getClass(
                   currentNamespace,
                   PEGASUS_CLASSNAME_PG_ELEMENTCONFORMSTOPROFILE);
 } }
           catch(const Exception &)
 void InteropProvider::references(  
         const OperationContext & context,  
         const CIMObjectPath & objectName,  
         const CIMName & resultClass,  
         const String & role,  
         const Boolean includeQualifiers,  
         const Boolean includeClassOrigin,  
         const CIMPropertyList & propertyList,  
         ObjectResponseHandler & handler)  
 { {
         throw CIMNotSupportedException("AssociationProvider::references");  
 } }
           try
 void InteropProvider::referenceNames(          {
         const OperationContext & context,              tmpPgProfileClass = repository->getClass(
         const CIMObjectPath & objectName,                  currentNamespace,
         const CIMName & resultClass,                  PEGASUS_CLASSNAME_PG_REGISTEREDPROFILE);
         const String & role,          }
         ObjectPathResponseHandler & handler)          catch(const Exception &)
 { {
         throw CIMNotSupportedException("AssociationProvider::referenceNames");              // Note: if any of the above three classes aren't found,
               // an exception will be thrown, which we can ignore since it's
               // an expected case
               // TBD: Log trace message?
           }
   
           // If the CIM_ElementConformsToProfile class is present, but
           // the PG_ElementConformsToProfile or PG_RegisteredProfile
           // class is not, then add it to that namespace.
           //
           // Note that we don't have to check for the
           // CIM_RegisteredProfile class because if the
           // CIM_ElementConformsToProfile class is present, the
           // CIM_RegisteredProfile class must also be present.
           if(!tmpCimClass.isUninitialized())
           {
               if(tmpPgClass.isUninitialized())
               {
                   CIMClass newclass = conformsClass.clone();
                   CIMObjectPath newPath = conformsClass.getPath();
                   newPath.setNameSpace(currentNamespace);
                   newclass.setPath(newPath);
                   repository->createClass(
                       currentNamespace,
                       newclass);
               }
               if(tmpPgProfileClass.isUninitialized())
               {
                   CIMClass newclass = profileClass.clone();
                   CIMObjectPath newPath = profileClass.getPath();
                   newPath.setNameSpace(currentNamespace);
                   newclass.setPath(newPath);
                   repository->createClass(
                       currentNamespace,
                       newclass);
               }
           }
       }
 } }
  
 PEGASUS_NAMESPACE_END PEGASUS_NAMESPACE_END
 // END_OF_FILE  // END OF FILE


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

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2