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

Diff for /pegasus/src/Pegasus/ControlProviders/InteropProvider/InteropProvider.cpp between version 1.5.2.4 and 1.66.4.1

version 1.5.2.4, 2004/02/05 16:28:45 version 1.66.4.1, 2007/04/04 11:04:46
Line 1 
Line 1 
 //%2003////////////////////////////////////////////////////////////////////////  //%2006////////////////////////////////////////////////////////////////////////
 // //
 // Copyright (c) 2000, 2001, 2002  BMC Software, Hewlett-Packard Development  // Copyright (c) 2000, 2001, 2002 BMC Software; Hewlett-Packard Development
 // Company, L. P., IBM Corp., The Open Group, Tivoli Systems.  // Company, L.P.; IBM Corp.; The Open Group; Tivoli Systems.
 // Copyright (c) 2003 BMC Software; Hewlett-Packard Development Company, L. P.; // Copyright (c) 2003 BMC Software; Hewlett-Packard Development Company, L. P.;
 // IBM Corp.; EMC Corporation, The Open Group. // IBM Corp.; EMC Corporation, The Open Group.
   // Copyright (c) 2004 BMC Software; Hewlett-Packard Development Company, L.P.;
   // IBM Corp.; EMC Corporation; VERITAS Software Corporation; The Open Group.
   // Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.;
   // EMC Corporation; VERITAS Software Corporation; The Open Group.
   // Copyright (c) 2006 Hewlett-Packard Development Company, L.P.; IBM Corp.;
   // EMC Corporation; Symantec Corporation; The Open Group.
 // //
 // Permission is hereby granted, free of charge, to any person obtaining a copy // Permission is hereby granted, free of charge, to any person obtaining a copy
 // of this software and associated documentation files (the "Software"), to // of this software and associated documentation files (the "Software"), to
Line 22 
Line 28 
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // 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  
 //  
 //%////////////////////////////////////////////////////////////////////////////  
   
  
 /////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
 //  Interop Provider - This provider services those classes from the //  Interop Provider - This provider services those classes from the
 //  DMTF Interop schema association with the CIMOM itself  //  DMTF Interop schema in an implementation compliant with the SMI-S v1.1
   //  Server Profile
 // //
 //  This provider services the following classes:  //  Please see PG_ServerProfile20.mof in the directory
 //      CIMObjectManager  //  $(PEGASUS_ROOT)/Schemas/Pegasus/InterOp/VER20 for retails regarding the
 //      CIM_ObjectManagerCommunicationMechanism  //  classes supported by this control provider.
 //      CIM_CIMXMLCommunicationMechanism  //
 //      CIM_ProtocolAdapter  //  Interop forces all creates to the PEGASUS_NAMESPACENAME_INTEROP
 //      CIM_Namespace  //  namespace. There is a test on each operation that returns
 //  //  the Invalid Class CIMDError
 //      It also services the Interop associations tied to these classes  //  This is a control provider and as such uses the Tracer functions
 //      including:  //  for data and function traces.  Since we do not expect high volume
 //      CIM_NamespaceInManager  //  use we added a number of traces to help diagnostics.
 //      ...  
   
 //      CIM Version: Interop Provider was written for CIM 2.7 adn 2.8.  
 //       Note: all 2.8 functions are controlled by a flag and can be  
 //      disabled.  
 /////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
  
 /* STATUS: In process but running 12 August 2003 KS */  
   
 #include <Pegasus/Common/Config.h> #include <Pegasus/Common/Config.h>
 #include <Pegasus/Common/PegasusVersion.h> #include <Pegasus/Common/PegasusVersion.h>
  
Line 63 
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>  
 #include <Pegasus/Common/XmlWriter.h>  
   
 #include <sstream>  
 #include <string>  
   
 #include <stdlib.h>  
   
 //The following include is needed for UUID Generator  
 #if defined(PEGASUS_OS_TYPE_WINDOWS)  
 #include <objbase.h>  
 #endif  
  
 PEGASUS_USING_STD;  #include <Pegasus/Common/StatisticalData.h>
  
   PEGASUS_USING_STD;
 PEGASUS_NAMESPACE_BEGIN PEGASUS_NAMESPACE_BEGIN
  
 //#define CDEBUG(X)  /*****************************************************************************
 #define CDEBUG(X) PEGASUS_STD(cout) << "InteropProvider " << X << PEGASUS_STD(endl)   *
 //#define CDEBUG(X) Logger::put (Logger::DEBUG_LOG, "Linux_ProcessorProvider", Logger::INFORMATION, "$0", X)   * The following are constants representing property names for the classes
 //#define CDEBUG(X) {std::stringstream ss; std::string r;ss << X;ss>>r; PEG_TRACE_STRING(TRC_CONTROLPROVIDER, Tracer::LEVEL4, r)}   * managed by the Interop Provider. Where multiple classes have properties of
    * the same name, there will be a common CIMName object defined, and a macro
 static const String PegasusInstanceIDGlobalPrefix = "PEG";   * defined that points to the common CIMName object, but whose macro name
 //    Constants representing the class names processed   * reflects the class in which the property is used.
    *
 /**   *****************************************************************************/
     The constants representing the class names we process  
 */  //
 static const CIMName __NAMESPACE_CLASSNAME  = CIMName ("__Namespace");  // Constructor for the InteropProvider control provider
 static const CIMName CIM_NAMESPACE_CLASSNAME  = CIMName ("CIM_Namespace");  //
 static const CIMName CIM_OBJECTMANAGER_CLASSNAME  = CIMName ("CIM_ObjectManager");  InteropProvider::InteropProvider(CIMRepository * rep) : repository(rep),
 static const CIMName CIM_OBJECTMANAGERCOMMUNICATIONMECHANISM_CLASSNAME  =      hostName(System::getHostName()), providerInitialized(false),
         CIMName ("CIM_ObjectManagerCommunicationMechanism");      profileIds(Array<String>()), conformingElements(Array<CIMNameArray>()),
 static const CIMName CIM_CIMXMLCOMMUNICATIONMECHANISM_CLASSNAME  =      elementNamespaces(Array<CIMNamespaceArray>())
         CIMName ("CIM_CIMXMLCommunicationMechanism");  
   
   
 // Property Names for __Namespace Class  
 static const CIMName NAMESPACE_PROPERTYNAME  = CIMName ("Name");  
 static const CIMNamespaceName ROOTNS  = CIMNamespaceName ("root");  
   
   
 // Property names for CIM_ObjectManager Class  
 static const CIMName OM_GATHERSTATISTICALDATA  =  
  CIMName ("GatherStatisticalData");  
 // Property for the slp template.  
 static const CIMName OM_DESCRIPTION =  
     CIMName("Description");  
   
   
 // Property Names for ObjectManagerCommunicationMechanism Class  
 static const CIMName OM_COMMUNICATIONMECHANISM  =  
         CIMName ("CommunicationMechanism");  
 static const CIMName OM_FUNCTIONALPROFILESSUPPORTED  =  
  CIMName ("FunctionalProfilesSupported");  
 static const CIMName OM_FUNCTIONALPROFILEDESCRIPTIONS  =  
  CIMName ("FunctionalProfileDescriptions");  
 static const CIMName OM_AUTHENTICATIONMECHANISMSSUPPORTED  =  
  CIMName ("AuthenticationMechanismsSupported");  
 static const CIMName OM_AUTHENTICATIONMECHANISMDESCRIPTIONS  =  
  CIMName ("AuthenticationMechanismDescriptions");  
 static const CIMName OM_MULTIPLEOPERATIONSSUPPORTED  =  
  CIMName ("MultipleOperationsSupported");  
 static const CIMName OM_VERSION  =  
  CIMName ("Version");  
   
 // Property Names for CIMXML CommunicationMechanism  
   
 static const CIMName CIMVALIDATED  =  
  CIMName ("CIMValidated");  
   
 static const String CIMXMLProtocolVersion = "1.0";  
   
 // Property names for CIM_Namespace Class  
   
 static const CIMName CIM_NAMESPACE_PROPERTY_SYSTEMCREATIONCLASSNAME =  
         CIMName ("SystemCreationClassName");  
 static const CIMName CIM_NAMESPACE_PROPERTY_SYSTEMNAME =  
         CIMName ("SystemName");  
 static const CIMName CIM_NAMESPACE_PROPERTY_OBJECTMANAGERCREATIONCLASSNAME =  
         CIMName ("ObjectManagerCreationClassName");  
 static const CIMName CIM_NAMESPACE_PROPERTY_OBJECTMANAGERNAME =  
         CIMName ("ObjectManagerName");  
 static const CIMName CIM_NAMESPACE_PROPERTY_CREATIONCLASSNAME =  
         CIMName ("CreationClassName");  
 static const CIMName CIM_NAMESPACE_PROPERTY_NAME  = CIMName ("Name");  
 static const CIMName CIM_NAMESPACE_PROPERTY_CLASSINFO =  
         CIMName ("ClassInfo");  
 static const CIMName CIM_NAMESPACE_PROPERTY_DESCRIPTIONOFCLASSINFO =  
         CIMName ("DescriptionOfClassInfo");  
   
   
   
 // Defines to serve as the ENUM for class selection for instance  
 // operations.  
   
 enum targetClass{  
      __NAMESPACE = 1,  
      CIM_NAMESPACE = 2,  
      CIM_OBJECTMANAGER = 3,  
      CIM_OBJECTMANAGERCOMMUNICATIONMECHANISM = 4,  
      CIM_CIMXMLCOMMUNICATIONMECHANISM = 5  
      };  
   
 //***************************************************************  
 // Provider Utility Functions  
 //***************************************************************  
   
 /** Builds the UUID string for this CIMOM.  
 **/  
 String getUUIDString()  
 {  
   
    //UUID Generation code starts  
    //Uses "libuuid.a" in /usr/lib directory. Make sure it's there. Also Makefile has "-luuid" added to $EXTRA_LIBRARIES  
    /*  
    uuid_t outUUID;  
    int j;  
    char strUUID[37], tempstrUUID[3];  
   
    uuid_generate_random(outUUID);  
    strcpy(strUUID, "");  
    //uuid(6B29FC40-CA47-1067-B31D-00DD010662DA)  
    for(j=0;j<16;j++)  
    {  
        sprintf(tempstrUUID, "%2.2x", outUUID[j]);  
        tempstrUUID[2]='\0';  
        strcat(strUUID,tempstrUUID);  
        if(j==3 || j==7 || j==11)  
            strcat(strUUID,"-");  
    }  
    strUUID[36]='\0';  
    strUUID = "TESTUUID1234567890"  
    */  
    //UUID Generation code ends  
   
    //uuid_t outUUID;  
    /*  
     int j;  
    char strUUID[37], tempstrUUID[3];  
   
    //uuid_generate_random(outUUID);  
    strcpy(strUUID, "");  
   
    for(j=0; j < 16; j++)  
    {  
        sprintf(tempstrUUID, "%2.2x", outUUID[j]);  
        tempstrUUID[2]='\0';  
        strcat(strUUID,tempstrUUID);  
        if(j==3 || j==7 || j==11)  
            strcat(strUUID,"-");  
    }  
    */  
     //char strUUID[37], tempstrUUID[3];  
   
   String strUUID;  
   
 // ------------------------------------------  
 // GUID string for Windows  
 // ------------------------------------------  
 #if defined(PEGASUS_OS_TYPE_WINDOWS)  
   GUID guid;  
   HRESULT hres = CoCreateGuid(&guid);  
   if (hres == S_OK)  
     {  
       WCHAR guid_strW[38] = { L"" };  
       char guid_str[100];  
       ::memset(&guid_str, 0, sizeof(guid_str));  
       if (StringFromGUID2(guid, guid_strW, sizeof(guid_strW)) > 0)  
         {  
           Uint32 numBytes =  sizeof(guid_strW)/sizeof(guid_strW[0]);  
           WideCharToMultiByte(CP_ACP, 0, guid_strW, numBytes, guid_str, sizeof(guid_str), NULL, NULL);  
           // exclude the first and last chars (i.e., { and })  
           for (Uint32 i=1; i<sizeof(guid_str); i++)  
             {             {
               if (guid_str[i] != '}')      PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,"InteropProvider::InteropProvider");
                 {  
                   strUUID.append(Char16(guid_str[i]));  
                 }  
               else  
                 break;  
             }  
         }  
     }  
  
 // ------------------------------------------  #ifndef PEGASUS_DISABLE_PERFINST
 // GUID string for Unix and other transients      try
 // ------------------------------------------  
 #elif defined(PEGASUS_OS_TYPE_UNIX)  
 #elif defined(PEGASUS_OS_TYPE_NSK)  
 #else  
 # error "Unsupported platform"  
 #endif  
   
     if (strUUID == String::EMPTY)  
       {       {
         strUUID = "6B29FC40-CA47-1067-B31D-00DD010662DA";          initProvider();
       }  
     //strUUID[36]='\0';  
     return (String(strUUID));  
 } }
       catch(const Exception & e)
 /* 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 _validateProperties(const CIMObjectPath& path)  
 { {
     return true;          // Provider initialization may fail if the repository is not
           // populated
 } }
 Boolean _validateProperties(const CIMInstance& instance)  #endif
 {  
     return true;      PEG_METHOD_EXIT();
 } }
  
 /* validate that the property exists, is string type and  
    optionally the value itself. Note processes only String  
    properties  
    @param - Instance to search for property.  
    @param - Property Name  
    @value - String value. If not String::EMPTY, compare to  
    value in the property  
    @return - ture if passes all tests  
 */  
 Boolean _validateRequiredProperty(const CIMInstance& instance,  
                           const CIMName& propertyName,  
                           const String& value)  
 {  
     PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,  
             "InteropProvider::_validateRequiredProperty()");  
     Uint32 pos;  
     if ((pos = instance.findProperty (propertyName)) == PEG_NOT_FOUND)  
         return(false);  
     //  
     //  Get the property  
     //     //
     CIMConstProperty theProperty = instance.getProperty(pos);  // Local version of getInstance to be used by other functions in the the
     const CIMValue theValue = theProperty.getValue ();  // provider. Returns a single instance. Note that it always returns an
     String valueField;  // instance. If none was found, it is uninialitized.
     theValue.get(valueField);  
     //     //
     //  Required property must have a non-null value  CIMInstance InteropProvider::localGetInstance(
     //      const OperationContext & context,
     if ((theValue.getType() != CIMTYPE_STRING) || (theValue.isNull()))      const CIMObjectPath & instanceName,
       const CIMPropertyList & propertyList)
     {     {
         PEG_METHOD_EXIT();      PEG_METHOD_ENTER(TRC_CONTROLPROVIDER, "InteropProvider::localGetInstance");
         return(false);  
     }      PEG_TRACE((TRC_CONTROLPROVIDER, Tracer::LEVEL4,
     if ((value == String::EMPTY) || (valueField == value))          "%s getInstance. instanceName= %s , PropertyList= %s",
           thisProvider,
           (const char *)instanceName.toString().getCString(),
           (const char *)propertyListToString(propertyList).getCString()));
   
       // Test if we're looking for something outside of our namespace. This will
       // happen during associators calls from PG_RegisteredProfile instances
       // through the PG_ElementConformsToProfile association
       CIMNamespaceName opNamespace = instanceName.getNameSpace();
       CIMName opClass = instanceName.getClassName();
       if(opNamespace != PEGASUS_NAMESPACENAME_INTEROP &&
           opClass != PEGASUS_CLASSNAME_PG_ELEMENTCONFORMSTOPROFILE)
       {
           AutoMutex mut(interopMut);
           return cimomHandle.getInstance(context, opNamespace,
               instanceName, false, false, false, propertyList);
       }
   
       // Create reference from host, namespace, class components of
       // instance name
       CIMObjectPath ref;
       ref.setHost(instanceName.getHost());
       ref.setClassName(opClass);
       ref.setNameSpace(opNamespace);
   
       // Enumerate instances for this class. Returns all instances
       // Note that this returns paths setup and instances already
       // filtered per the input criteria.
       Array<CIMInstance> instances =  localEnumerateInstances(
           context,
           ref,
           propertyList);
   
       // deliver a single instance if found.
       CIMInstance retInstance;
   
       bool found = false;
       for(Uint32 i = 0, n = instances.size(); i < n; i++)
       {
           CIMObjectPath currentInstRef = instances[i].getPath();
           currentInstRef.setHost(instanceName.getHost());
           currentInstRef.setNameSpace(instanceName.getNameSpace());
           if(instanceName == currentInstRef)
     {     {
         PEG_METHOD_EXIT();              retInstance = instances[i];
         return(true);              found = true;
               break;
     }     }
     PEG_METHOD_EXIT();  
     return(false);  
 } }
  
 Boolean _validateRequiredProperty(const CIMInstance& instance,      if(!found)
                           const CIMName& propertyName,  
                           const Uint16& value)  
 {  
     PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,  
         "InteropProvider::_validateRequiredProperty()");  
   
     PEG_TRACE_STRING(TRC_CONTROLPROVIDER, Tracer::LEVEL4, "Validate "  
         + propertyName.getString());  
     Uint32 pos;  
     if ((pos = instance.findProperty (propertyName)) == PEG_NOT_FOUND)  
     {     {
         cout << "Coule not find instance: " << instanceName.toString() << endl;
       }
         PEG_METHOD_EXIT();         PEG_METHOD_EXIT();
         return(false);      return retInstance;
     }     }
   
   
     //     //
     //  Get the property  // Local version of enumerateInstances to be used by other functions in the
     //  // provider. Note that this delivers instances as a group rather than one
     CIMConstProperty theProperty = instance.getProperty(pos);  // at a time. This design point may need to be revisited if this provider
     CIMValue theValue = theProperty.getValue ();  // is used in environments such that returning segmented responses would have
     //  // significant performance advantages. For now, that doesn't seem to be the
     //  Required property must have a non-null value  // case.
     //     //
     if ((theValue.getType() != CIMTYPE_UINT16)  Array<CIMInstance> InteropProvider::localEnumerateInstances(
         || (theValue.isNull())  )      const OperationContext & context,
 //        || (theValue.getValue != value()) )      const CIMObjectPath & ref,
     {      const CIMPropertyList& propertyList)
         PEG_METHOD_EXIT();  
         return(false);  
     }  
     PEG_METHOD_EXIT();  
     return(true);  
 }  
 Boolean _validateRequiredProperty(const CIMObjectPath& objectPath,  
                           const CIMName& propertyName,  
                           const String value)  
 { {
     PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,     PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,
             "InteropProvider::_validateRequiedProperty()");          "InteropProvider::localEnumerateInstances()");
     Array<CIMKeyBinding> kbArray = objectPath.getKeyBindings();      const CIMName & className = ref.getClassName();
       PEG_TRACE((TRC_CONTROLPROVIDER, Tracer::LEVEL4,
           "%s enumerateInstances. referenc= %s , PropertyList= %s",
           thisProvider,
           (const char *)className.getString().getCString(),
           (const char *)propertyListToString(propertyList).getCString()));
  
     // find the correct key binding      // Verify that ClassName is correct and get its enum value
     for (Uint32 i = 0; i < kbArray.size(); i++)      TARGET_CLASS classEnum  = translateClassInput(className);
     {  
         if (kbArray[i].getName() == propertyName)  
         {  
             if (value != String::EMPTY)  
             {  
                 if (value !=kbArray[i].getValue())  
                 {  
                     PEG_METHOD_EXIT();  
                     return(true);  
                 }  
             }  
         }  
     }  
     PEG_METHOD_EXIT();  
     return(true);  
 }  
  
 /* Query the repository for array of all namespacenames      Array<CIMInstance> instances;
 */      switch(classEnum)
 Array<CIMNamespaceName> InteropProvider::_enumerateNameSpaces()  
 { {
     PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,          case PG_OBJECTMANAGER:
             "InteropProvider::_enumerateNameSpaces()");  
     Array<CIMNamespaceName> namespaceNames;  
   
     try  
     {     {
         namespaceNames = _repository->enumerateNameSpaces();              instances.append(getObjectManagerInstance());
               break;
     }     }
     catch(CIMException& e)          case PG_CIMXMLCOMMUNICATIONMECHANISM:
     {     {
         PEG_METHOD_EXIT();              instances = enumCIMXMLCommunicationMechanismInstances();
         throw e;              break;
     }     }
     catch(Exception& e)          case PG_NAMESPACEINMANAGER:
     {     {
         PEG_METHOD_EXIT();              instances = enumNamespaceInManagerInstances();
         throw e;              break;
     }  
   
     PEG_METHOD_EXIT();  
     return(namespaceNames);  
 } }
           case PG_COMMMECHANISMFORMANAGER:
 /* get a class defintion. Gets the class defined by  
     the parameters. Generates exception of class not defined.  
    @param namespace in which to look for the class.  
    @param name of class to get.  
    @return the CIMClass object  
    @Exceptions any repository exceptions if class not found.  
 */  
 CIMClass InteropProvider::_getClass(const CIMNamespaceName& nameSpace,  
                                     const CIMName& className)  
 {  
     PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,  
             "InteropProvider::_getClass");  
     CIMClass myClass;  
     CDEBUG("_getClass: Get Class from repository. Namespace= " << nameSpace << " Class= " <<  className.getString());  
     // ATTN: The inUnitialized function is NOT necessary.  
     if (myClass.isUninitialized())  
     {  
         try  
         {         {
             myClass = _repository->getClass(nameSpace, className );              instances = enumCommMechanismForManagerInstances();
               break;
         }         }
         catch(CIMException& e)          case PG_NAMESPACE:
         {         {
             CDEBUG("_getClass CIMException: " << e.getMessage());              instances = enumNamespaceInstances();
             PEG_METHOD_EXIT();              break;
             throw e;  
         }         }
         catch(Exception& e)          case PG_REGISTEREDPROFILE:
         {         {
             CDEBUG("_getClass CIMException: " << e.getMessage());              instances = enumRegisteredProfileInstances();
             PEG_METHOD_EXIT();              break;
             throw e;  
         }  
     }  
     CDEBUG("_getClass: Class Acquired");  
     PEG_METHOD_EXIT();  
     return myClass;  
 } }
           case PG_REGISTEREDSUBPROFILE:
   
 /* Verify that this is one of the legal classnames and  
    return indicator which.  
    @param - Classname  
    @return - Uint32 indicating type  
    @Exceptions - throws CIMNotSupportedException if invalid class.  
 */  
 targetClass _verifyValidClassInput(const CIMName& className)  
 { {
     PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,              instances = enumRegisteredSubProfileInstances();
             "InteropProvider::_verifyValidClassInput()");              break;
     CDEBUG("Class Name Input = " << className.getString());  
   
     if (className.equal(CIM_NAMESPACE_CLASSNAME))  
     {  
         PEG_METHOD_EXIT();  
         return CIM_NAMESPACE;  
     }     }
           case PG_REFERENCEDPROFILE:
     if (className.equal(CIM_OBJECTMANAGER_CLASSNAME))  
     {     {
         PEG_METHOD_EXIT();              instances = enumReferencedProfileInstances();
         return CIM_OBJECTMANAGER;              break;
     }     }
           case PG_ELEMENTCONFORMSTOPROFILE:
     if (className.equal(CIM_OBJECTMANAGERCOMMUNICATIONMECHANISM_CLASSNAME))  
     {     {
         PEG_METHOD_EXIT();              instances = enumElementConformsToProfileInstances(context,
         return CIM_OBJECTMANAGERCOMMUNICATIONMECHANISM;                  ref.getNameSpace());
               break;
     }     }
           case PG_SUBPROFILEREQUIRESPROFILE:
     if (className.equal(CIM_CIMXMLCOMMUNICATIONMECHANISM_CLASSNAME))  
     {     {
         PEG_METHOD_EXIT();              instances = enumSubProfileRequiresProfileInstances();
         return CIM_CIMXMLCOMMUNICATIONMECHANISM;              break;
     }     }
           case PG_SOFTWAREIDENTITY:
     // Last entry, reverse test and returnOK if CIM_Namespace  
     if (!className.equal(CIM_NAMESPACE_CLASSNAME))  
     {     {
         CDEBUG("Invalid Class received " << className.getString());              instances = enumSoftwareIdentityInstances();
         PEG_METHOD_EXIT();              break;
         throw CIMNotSupportedException  
             (className.getString() + " not supported by Interop Provider");  
     }  
   
     PEG_METHOD_EXIT();  
     return CIM_NAMESPACE;  
 } }
           case PG_ELEMENTSOFTWAREIDENTITY:
 /* validate the authorization of the user name against the namespace.  
 */  
 String _validateUserID(const OperationContext & context)  
 { {
     //ATTN-DME-P3-20020522: ADD AUTHORIZATION CHECK TO __NAMESPACE PROVIDER              instances = enumElementSoftwareIdentityInstances();
     String userName;              break;
     try  
     {  
         IdentityContainer container = context.get(IdentityContainer::NAME);  
         userName = container.getUserName();  
     }     }
     catch (...)          case PG_INSTALLEDSOFTWAREIDENTITY:
     {     {
        userName = String::EMPTY;              instances = enumInstalledSoftwareIdentityInstances();
               break;
     }     }
     return userName;          case PG_COMPUTERSYSTEM:
           {
               instances.append(getComputerSystemInstance());
               break;
 } }
           case PG_HOSTEDOBJECTMANAGER:
 /** Add the keys common to a number of the Interop instances to the provided  
     instance. This includes SystemCreationClassName and System Name  
     @param instance of CIMInstance to which these are to be added.  
 */  
 void _buildInstanceCommonKeys(CIMInstance& instance)  
 { {
               instances.append(getHostedObjectManagerInstance());
     PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,              break;
             "InteropProvider::_buildInstanceCommonKeys()");          }
           case PG_HOSTEDACCESSPOINT:
     String SystemCreationClassName = System::getSystemCreationClassName ();  
     if (SystemCreationClassName == String::EMPTY)  
     {     {
         //Attn: Get this globally. For now This in place because global is often Empty              instances = enumHostedAccessPointInstances();
         SystemCreationClassName = "CIM_ComputerSystem";              break;
     }     }
           default:
     // Add property SystemCreationClassName  
     instance.addProperty(  
         (CIMProperty(CIM_NAMESPACE_PROPERTY_SYSTEMCREATIONCLASSNAME,  
                      SystemCreationClassName)));  
   
     // Add property SystemName  
     String SystemName = System::getHostName();  
     instance.addProperty(  
         (CIMProperty(CIM_NAMESPACE_PROPERTY_SYSTEMNAME,  
                      SystemName)));  
   
     PEG_METHOD_EXIT();     PEG_METHOD_EXIT();
               throw CIMNotSupportedException(className.getString() +
                 " not supported by Interop Provider enumerate");
 } }
  
       // Filter and deliver the resulting instances
 /* build instance of the CIMObjectManagerCommunicationClass      for (Uint32 i = 0 ; i < instances.size() ; i++)
 */  
 CIMInstance _buildInstancCIMObjectManagerCommunicationMechanism()  
 { {
     PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,          normalizeInstance(instances[i], ref, false,
             "InteropProvider::_buildInstanceCIMObjectCommunicationMechanism()");              false, propertyList);
   
     CIMInstance instance(CIM_CIMXMLCOMMUNICATIONMECHANISM_CLASSNAME);  
   
     _buildInstanceCommonKeys(instance);  
   
   
     //CreationClassName - Class this instance created from.  
     instance.addProperty(  
         (CIMProperty(CIM_NAMESPACE_PROPERTY_CREATIONCLASSNAME,  
             CIM_OBJECTMANAGERCOMMUNICATIONMECHANISM_CLASSNAME.getString() )));  
   
     //String name = "PegasusCIMXMLCommunicationMechanism";  
     //Name, this CommunicationMechanism. The use of this name is not  
     // clear right now  
     instance.addProperty(  
         (CIMProperty(CIM_NAMESPACE_PROPERTY_NAME,  
                      CIM_CIMXMLCOMMUNICATIONMECHANISM_CLASSNAME.getString() )));  
   
     // CommunicationMechanism Property. Set to 2, CIMXML for now.  
     instance.addProperty(  
         (CIMProperty(OM_COMMUNICATIONMECHANISM,  
                      Uint16(2) )));  
   
     //Functional Profiles Supported Property.  
     Array<Uint16> profiles;  
     Array<String> 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");  
   
     CIMValue profileValue(profiles);  
     CIMValue profileDescriptionsValue(profileDescriptions);  
   
     instance.addProperty(  
         (CIMProperty(OM_FUNCTIONALPROFILESSUPPORTED,  
                      profileValue )));  
     instance.addProperty(  
         (CIMProperty(OM_FUNCTIONALPROFILEDESCRIPTIONS,  
                      profileDescriptionsValue )));  
   
     // Multiple OperationsSupported Property  
     instance.addProperty(  
         (CIMProperty(OM_MULTIPLEOPERATIONSSUPPORTED,  
                      Boolean(false) )));  
   
     // AuthenticationMechanismsSupported Property  
   
     Array<Uint16> authentications;  
     Array<String> authenticationDescriptions;  
   
     // The following is a hack, supplying values from fixed info.  
     authentications.append(3); authenticationDescriptions.append("basic");  
   
     CIMValue authenticationValue(authentications);  
     CIMValue authenticationDescriptionsValue(authenticationDescriptions);  
     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);  
 } }
  
 /* build a single instance of the cimxmlcommunicationmechanism class  
    using the parameter provided as the name property  
    @parm name String representing the name to be used for this object.  
    @return CIMInstance of the class  
 */  
 CIMInstance _buildInstancCIMXMLCommunicationMechanism(const String& name)  
 {  
     PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,  
             "InteropProvider::_buildInstanceCIMXMLCommunicationMechanism()");  
     CDEBUG("_BuildInstanceCIMXMLCommunicationMechanism");  
     CIMInstance instance(CIM_CIMXMLCOMMUNICATIONMECHANISM_CLASSNAME);  
   
     _buildInstanceCommonKeys(instance);  
   
     //CreationClassName  
     instance.addProperty(  
         (CIMProperty(CIM_NAMESPACE_PROPERTY_CREATIONCLASSNAME,  
             CIM_CIMXMLCOMMUNICATIONMECHANISM_CLASSNAME.getString() )));  
   
     //Name, this CommunicationMechanism.  
     instance.addProperty(  
         (CIMProperty(CIM_NAMESPACE_PROPERTY_NAME,  
                      name )));  
   
     // CommunicationMechanism Property  
     instance.addProperty(  
         (CIMProperty(OM_COMMUNICATIONMECHANISM,  
                      Uint16(2) )));  
   
     // CommunicationMechanism Property  
     // KS why duplicate property add.  Should not work.  
     //instance.addProperty(  
     //    (CIMProperty(OM_COMMUNICATIONMECHANISM,  
     //                 Uint16(2) )));  
   
     //Functional Profiles Supported Property.  
     Array<Uint16> profiles;  
     Array<String> 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");  
   
     CIMValue profileValue(profiles);  
     CIMValue profileDescriptionsValue(profileDescriptions);  
   
     instance.addProperty(  
         (CIMProperty(OM_FUNCTIONALPROFILESSUPPORTED,  
                      profileValue )));  
     instance.addProperty(  
         (CIMProperty(OM_FUNCTIONALPROFILEDESCRIPTIONS,  
                      profileDescriptionsValue )));  
   
     // Multiple OperationsSupported Property  
     instance.addProperty(  
         (CIMProperty(OM_MULTIPLEOPERATIONSSUPPORTED,  
                      Boolean(false) )));  
   
     // AuthenticationMechanismsSupported Property  
   
     Array<Uint16> authentications;  
     Array<String> authenticationDescriptions;  
   
     authentications.append(3); authenticationDescriptions.append("basic");  
   
     CIMValue authenticationValue(authentications);  
     CIMValue authenticationDescriptionsValue(authenticationDescriptions);  
   
     instance.addProperty(  
         (CIMProperty(OM_AUTHENTICATIONMECHANISMSSUPPORTED,  
                      authenticationValue )));  
     instance.addProperty(  
         (CIMProperty(OM_AUTHENTICATIONMECHANISMDESCRIPTIONS,  
                      authenticationDescriptionsValue )));  
   
     //Version property  
     instance.addProperty(  
         (CIMProperty(OM_VERSION,  
                      CIMXMLProtocolVersion )));  
     PEG_METHOD_EXIT();     PEG_METHOD_EXIT();
     return(instance);      return instances;
 }  
 /* Gets the value for the CIMObjectManager name.  This is a key  
    property with the following characteristics.  
    1. It is persistent. This must be persistent through CIMOM  
    restarts.  We will save it in the instance database to achieve this.  
    2. It must be unique. We cannot create duplicate CIMOM names  
    3. It is based on the DMTF description of how unique InstanceIds  
    are defined (Trademark/etc followed by unique identification.  
   
 */  
 String buildObjectManagerName()  
 {  
     return(getUUIDString());  
 } }
  
 CIMInstance InteropProvider::_buildInstanceCIMObjectManager()  //
   // Class that determines whether or not the origin class in an association
   // operation is valid for the given association class, and also determines
   // the origin and target "roles". These values generally correspond to the
   // role and resultRole parameter of an associators/associatorNames operation.
   //
   bool InteropProvider::validAssocClassForObject(
       const CIMName & assocClass, const CIMName & originClass,
       const CIMNamespaceName & opNamespace,
       String & originProperty, String & targetProperty)
 { {
     PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,     PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,
             "InteropProvider::_buildInstanceCIMObjectManager()");          "InteropProvider::validAssocClassForObject()");
       TARGET_CLASS assocClassEnum = translateClassInput(assocClass);
       TARGET_CLASS originClassEnum;
     if (!instanceOfCIMObjectManager.isUninitialized())      // 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)
     {     {
         PEG_METHOD_EXIT();          // Test if the origin is an element managed by another provider
         return(instanceOfCIMObjectManager);          // 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;
  
     // Try to get persistent instance from repository              PEGASUS_ASSERT(conformingElements.size() ==
     Array<CIMInstance> instances;                  elementNamespaces.size());
     try              for(Uint32 i = 0, n = conformingElements.size(); i < n; ++i)
     {     {
         instances = _repository->enumerateInstances(_operationNamespace,                  CIMNameArray & elementList = conformingElements[i];
                       CIM_OBJECTMANAGER_CLASSNAME );                  CIMNamespaceArray & namespaceList = elementNamespaces[i];
     }                  PEGASUS_ASSERT(elementList.size() == namespaceList.size());
     catch(CIMException& e)                  for(Uint32 j = 0, m = elementList.size(); j < m; ++j)
     {     {
         PEG_METHOD_EXIT();                      CIMName & curElement = elementList[j];
         throw e;                      if((curElement == originClass ||
     }                        curElement.getString().find(PEGASUS_DYNAMIC) == 0) &&
     catch(Exception& e)                        opNamespace == namespaceList[j])
     {     {
         PEG_METHOD_EXIT();                          found = true;
         throw e;                          break;
     }     }
   
     if (instances.size() >= 1)  
     {  
         instanceOfCIMObjectManager = instances[0];  
         PEG_METHOD_EXIT();  
         return(instanceOfCIMObjectManager);  
     }     }
                   if(found)
     //                      break;
     // Must build new instance and save it.  
     //  
     CIMInstance instance(CIM_OBJECTMANAGER_CLASSNAME);  
     instanceOfCIMObjectManager = instance;  
   
     _buildInstanceCommonKeys(instanceOfCIMObjectManager);  
   
     //CreationClassName -- This class.  
     instanceOfCIMObjectManager.addProperty(  
         (CIMProperty(CIM_NAMESPACE_PROPERTY_CREATIONCLASSNAME,  
                      CIM_OBJECTMANAGER_CLASSNAME.getString() )));  
     //Name, this CIMObject Manager.  
     instanceOfCIMObjectManager.addProperty(  
         (CIMProperty(CIM_NAMESPACE_PROPERTY_NAME,  
                      buildObjectManagerName() )));  
   
     //ElementName this object manager  
     instanceOfCIMObjectManager.addProperty(  
         (CIMProperty(CIMName("ElementName"),  
                      String("Pegasus") )));  
   
     // Gets the object manager class for some info  
     CIMClass objMgrClass = _getClass(_operationNamespace, "CIM_ObjectManager");  
     Uint32 pos;  
   
     String description = "Pegasus CIMOM Version 2.3.2";  
     char * envDescription;  
     envDescription = getenv("PEGASUS_CIMOM_DESCRIPTION");  
     if (envDescription)  
     {  
         description = envDescription;  
     }     }
     instanceOfCIMObjectManager.addQualifier(  
         (CIMQualifier("Description", description)));  
   
   
     //Property GatherStatisticalData. Note that today we do not  
     // have a dynamic activation for this value.  
   
  
 #ifdef PEGASUS_HAS_PERFINST              if(!found)
     Boolean gatherStatData = true;                  return false;
 #else  
     Boolean gatherStatData = false;  
 #endif  
     instanceOfCIMObjectManager.addProperty(  
         (CIMProperty(OM_GATHERSTATISTICALDATA,  
                      Boolean(gatherStatData) )));  
   
     // write the instance to the repository  
     CIMObjectPath instancepath;  
     try  
     {  
         instancepath = _repository->createInstance(_operationNamespace,  
                        instanceOfCIMObjectManager );  
     }     }
     catch(CIMException& e)  
     {  
         PEG_METHOD_EXIT();  
         throw e;  
     }     }
     catch(Exception& e)      else
     {     {
     PEG_METHOD_EXIT();          // Otherwise, just get the enum value representing the origin class
         throw e;          // for this operation
     }          originClassEnum = translateClassInput(originClass);
   
     PEG_METHOD_EXIT();  
     return(instanceOfCIMObjectManager);  
 } }
  
 /* generate one instance of the CIM_Namespace class with the      CIMName expectedTargetRole;
    properties      CIMName expectedOriginRole;
    @param namespace name to put into the class  
    @exceptions - exceptions carried forward from create instance  
    and addProperty.  
 */  
   
   
 /* 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;  
 };  
   
 */  
 CIMInstance _buildInstanceCIMNamespace(const CIMNamespaceName & nameSpace)  
 {  
     CDEBUG("_buildInstnaceCIMNamespace enter");  
     PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,  
             "InteropProvider::_buildInstanceCIMNamespace()");  
  
     String ObjectManagerName = "ObjectManagerNameValue";      //
     String ClassInfo = "ClassInfo";      // Set the target and origin role values. Note that if these values are
     String DescriptionOfClassInfo = "DescriptionOfClassInfo";      // not set following the switch block, that implies that the origin class
       // is not valid for the supplied association class.
     CDEBUG("_buildInstnaceCIMNamespace create instance");      //
     CIMInstance instance(CIM_NAMESPACE_CLASSNAME);      switch(assocClassEnum)
   
     /*  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)));  
     */  
   
     CDEBUG("_buildInstnaceCIMNamespace build common keys");  
     _buildInstanceCommonKeys(instance);  
   
     CDEBUG("_buildInstnaceCIMNamespace add properties");  
     //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() )));  
   
     // ATTN: KS 16 Jan 2004 We are not supplying this property right now because we do  
     // not know what to put into it.  
     //ClassInfo  
     /*  
     instance.addProperty(  
         (CIMProperty(CIM_NAMESPACE_PROPERTY_CLASSINFO,  
                      ClassInfo)));  
   
     //DescriptionofClassInfo  
     instance.addProperty(  
         (CIMProperty(CIM_NAMESPACE_PROPERTY_DESCRIPTIONOFCLASSINFO,  
                      DescriptionOfClassInfo)));  
     */  
     CDEBUG("_buildInstnaceCIMNamespace properties built. returning instance");  
     PEG_METHOD_EXIT();  
     return(instance);  
 }  
 void _validateCIMNamespaceKeys(const CIMObjectPath& objectPath)  
 { {
     PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,        case PG_NAMESPACEINMANAGER:
             "InteropProvider::_validateCIMNamespaceKeys");            if(originClassEnum == PG_OBJECTMANAGER)
   
     Boolean valid = true;  
     CIMName propertyName;  
     if (!_validateRequiredProperty(objectPath,  
                 CIM_NAMESPACE_PROPERTY_SYSTEMCREATIONCLASSNAME,  
                 System::getSystemCreationClassName ()))  
     {     {
         propertyName = CIM_NAMESPACE_PROPERTY_SYSTEMCREATIONCLASSNAME;                expectedTargetRole = PROPERTY_DEPENDENT;
         valid = false;                expectedOriginRole = PROPERTY_ANTECEDENT;
     }     }
     if (!_validateRequiredProperty(objectPath,            else if(originClassEnum == PG_NAMESPACE)
                 CIM_NAMESPACE_PROPERTY_SYSTEMNAME,  
                 System::getHostName()))  
     {     {
         propertyName = CIM_NAMESPACE_PROPERTY_SYSTEMNAME;                expectedTargetRole = PROPERTY_ANTECEDENT;
         valid = false;                expectedOriginRole = PROPERTY_DEPENDENT;
     }     }
     if (!_validateRequiredProperty(objectPath,            break;
                 CIM_NAMESPACE_PROPERTY_OBJECTMANAGERCREATIONCLASSNAME,        case PG_COMMMECHANISMFORMANAGER:
                 CIM_OBJECTMANAGER_CLASSNAME.getString()))            if(originClassEnum == PG_OBJECTMANAGER)
     {     {
         propertyName = CIM_NAMESPACE_PROPERTY_OBJECTMANAGERCREATIONCLASSNAME;                expectedTargetRole = PROPERTY_DEPENDENT;
         valid = false;                expectedOriginRole = PROPERTY_ANTECEDENT;
     }     }
             else if(originClassEnum == PG_CIMXMLCOMMUNICATIONMECHANISM)
     // ATTN: This one still a problem.  We have to get the name first  
     if (!_validateRequiredProperty(objectPath,  
                 CIM_NAMESPACE_PROPERTY_OBJECTMANAGERNAME,  
                 String::EMPTY))  
     {     {
         propertyName = CIM_NAMESPACE_PROPERTY_OBJECTMANAGERNAME;                expectedTargetRole = PROPERTY_ANTECEDENT;
         valid = false;                expectedOriginRole = PROPERTY_DEPENDENT;
     }     }
     if (!_validateRequiredProperty(objectPath,            break;
                 CIM_NAMESPACE_PROPERTY_CREATIONCLASSNAME,        case PG_ELEMENTCONFORMSTOPROFILE:
                 System::getHostName()))            if(originClass.equal(PEGASUS_CLASSNAME_PG_REGISTEREDPROFILE))
     {     {
         propertyName = CIM_NAMESPACE_PROPERTY_CREATIONCLASSNAME;                expectedTargetRole =
         valid = false;                    ELEMENTCONFORMSTOPROFILE_PROPERTY_MANAGEDELEMENT;
                 expectedOriginRole =
                     ELEMENTCONFORMSTOPROFILE_PROPERTY_CONFORMANTSTANDARD;
     }     }
             else
     if (!_validateRequiredProperty(objectPath,  
                 CIM_NAMESPACE_PROPERTY_NAME,  
                 String::EMPTY))  
     {     {
         propertyName = CIM_NAMESPACE_PROPERTY_NAME;                expectedTargetRole =
         valid = false;                    ELEMENTCONFORMSTOPROFILE_PROPERTY_CONFORMANTSTANDARD;
                 expectedOriginRole =
                     ELEMENTCONFORMSTOPROFILE_PROPERTY_MANAGEDELEMENT;
     }     }
             break;
     if (false)        case PG_SUBPROFILEREQUIRESPROFILE:
             if(originClassEnum == PG_REGISTEREDPROFILE)
     {     {
         PEG_METHOD_EXIT();                expectedTargetRole = PROPERTY_DEPENDENT;
         throw CIMInvalidParameterException(                expectedOriginRole = PROPERTY_ANTECEDENT;
             "Invalid key property: " + propertyName.getString());  
     }     }
     PEG_METHOD_EXIT();            else if(originClassEnum == PG_REGISTEREDSUBPROFILE)
 }  
   
 void _validateCIMNamespaceKeys(const CIMInstance& instance)  
 {  
     PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,  
             "InteropProvider::_validateCIMNamespaceKeys");  
     Boolean valid = true;  
     CIMName propertyName;  
     if (!_validateRequiredProperty(instance,  
                 CIM_NAMESPACE_PROPERTY_SYSTEMCREATIONCLASSNAME,  
                 System::getSystemCreationClassName ()))  
     {     {
         propertyName = CIM_NAMESPACE_PROPERTY_SYSTEMCREATIONCLASSNAME;                expectedTargetRole = PROPERTY_ANTECEDENT;
         valid = false;                expectedOriginRole = PROPERTY_DEPENDENT;
     }     }
             break;
     if (!_validateRequiredProperty(instance,        case PG_ELEMENTSOFTWAREIDENTITY:
                 CIM_NAMESPACE_PROPERTY_SYSTEMNAME,            if(originClassEnum == PG_SOFTWAREIDENTITY)
                 System::getHostName()))  
     {     {
         propertyName = CIM_NAMESPACE_PROPERTY_SYSTEMNAME;                expectedTargetRole = PROPERTY_DEPENDENT;
         valid = false;                expectedOriginRole = PROPERTY_ANTECEDENT;
     }     }
             else if(originClassEnum == PG_REGISTEREDPROFILE ||
     if (!_validateRequiredProperty(instance,                originClassEnum == PG_REGISTEREDSUBPROFILE)
                 CIM_NAMESPACE_PROPERTY_OBJECTMANAGERCREATIONCLASSNAME,  
                 CIM_OBJECTMANAGER_CLASSNAME.getString()))  
     {     {
         propertyName = CIM_NAMESPACE_PROPERTY_OBJECTMANAGERCREATIONCLASSNAME;                expectedTargetRole = PROPERTY_ANTECEDENT;
         valid = false;                expectedOriginRole = PROPERTY_DEPENDENT;
     }     }
             break;
     // ATTN: This one still a problem.  We have to get the name first        case PG_INSTALLEDSOFTWAREIDENTITY:
     if (!_validateRequiredProperty(instance,            if(originClassEnum == PG_SOFTWAREIDENTITY)
                 CIM_NAMESPACE_PROPERTY_OBJECTMANAGERNAME,  
                 String::EMPTY))  
     {     {
         propertyName = CIM_NAMESPACE_PROPERTY_OBJECTMANAGERNAME;                expectedTargetRole = INSTALLEDSOFTWAREIDENTITY_PROPERTY_SYSTEM;
         valid = false;                expectedOriginRole =
                     INSTALLEDSOFTWAREIDENTITY_PROPERTY_INSTALLEDSOFTWARE;
             }
             else if(originClassEnum == PG_COMPUTERSYSTEM)
             {
                 expectedTargetRole =
                     INSTALLEDSOFTWAREIDENTITY_PROPERTY_INSTALLEDSOFTWARE;
                 expectedOriginRole = INSTALLEDSOFTWAREIDENTITY_PROPERTY_SYSTEM;
     }     }
     if (!_validateRequiredProperty(instance,            break;
                 CIM_NAMESPACE_PROPERTY_CREATIONCLASSNAME,        case PG_HOSTEDACCESSPOINT:
                 System::getHostName()))            if(originClassEnum == PG_COMPUTERSYSTEM)
     {     {
         propertyName = CIM_NAMESPACE_PROPERTY_CREATIONCLASSNAME;                expectedTargetRole = PROPERTY_DEPENDENT;
         valid = false;                expectedOriginRole = PROPERTY_ANTECEDENT;
     }     }
             else if(originClassEnum == PG_CIMXMLCOMMUNICATIONMECHANISM)
     if (!_validateRequiredProperty(instance,  
                 CIM_NAMESPACE_PROPERTY_NAME,  
                 String::EMPTY))  
     {     {
         propertyName = CIM_NAMESPACE_PROPERTY_NAME;                expectedTargetRole = PROPERTY_ANTECEDENT;
         valid = false;                expectedOriginRole = PROPERTY_DEPENDENT;
     }     }
         case PG_HOSTEDOBJECTMANAGER:
     if (false)            if(originClassEnum == PG_COMPUTERSYSTEM)
     {     {
         PEG_TRACE_STRING(TRC_CONTROLPROVIDER, Tracer::LEVEL4,                expectedTargetRole = PROPERTY_DEPENDENT;
             "Invalid CIM_Namespace Key Property " +  propertyName.getString());                expectedOriginRole = PROPERTY_ANTECEDENT;
         PEG_METHOD_EXIT();  
         throw CIMInvalidParameterException(  
             "Invalid CIM_Namespace key property: " + propertyName.getString());  
     }     }
     PEG_TRACE_STRING(TRC_CONTROLPROVIDER, Tracer::LEVEL4, "CIM_Namespace Keys Valid");            else if(originClassEnum == PG_OBJECTMANAGER)
     PEG_METHOD_EXIT();  
 }  
   
 /* Given a namespace name, class and instance build the instance path for a  
    the object.  This builds all components of the path  
    @param namespace name to build  
    @return CIMObjectPath containing namespace, class and keybinding  
    components of path  
    @exceptions - 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,                expectedTargetRole = PROPERTY_ANTECEDENT;
             "InteropProvider::_buildInstancePath");                expectedOriginRole = PROPERTY_DEPENDENT;
   
     // get the class CIM_Namespace class to use in building path  
   
     // Exception out if Class does not exist in this namespace  
     CIMClass thisClass = _getClass(_operationNamespace, className);  
   
     // XmlWriter::printInstanceElement(instance);  
   
     CIMObjectPath ref = instance.buildPath(thisClass);  
   
     CDEBUG("_buildInstancePath. Built path. path = " << ref.toString() );  
     PEG_METHOD_EXIT();  
     return(ref);  
 } }
             break;
         default:
 /* _isNamespace determines if the namespace in the second            break;
    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;  
      for(Uint32 i = 0; i < namespaceNames.size(); i++)  
      {  
         if(namespaceNames[i].equal ( namespaceName))  
         {  
             return true;  
         }  
      }  
      return false;  
 } }
  
 Boolean _isChild(  
         CIMNamespaceName& parentNamespaceName,  
         CIMNamespaceName& namespaceName)  
   
 {  
     String parent = parentNamespaceName.getString();  
     String child = namespaceName.getString();  
    //    //
    //  If length of namespace name is shorter than or equal to the      // The rest of this method checks to see if target role and origin roles
    //  length of parent namespace name, cannot be a child      // 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.
    //    //
    if (child.size () <= parent.size ())      if(expectedTargetRole.isNull() ||
           expectedOriginRole.isNull())
    {    {
           PEG_METHOD_EXIT();
       return false;       return false;
    }    }
  
    //      if(targetProperty.size() == 0)
    //  Compare prefix substring of namespace name with parent namespace name  
    //  
    else if (String::equalNoCase (child.subString (0, parent.size ()), parent))  
    {    {
       return true;          targetProperty = expectedTargetRole.getString();
    }    }
       else if(!expectedTargetRole.equal(targetProperty))
       {
           PEG_METHOD_EXIT();
    return false;    return false;
 } }
 //**************************************************************  
 // Overloaded functions to get key value with different params  
 //**************************************************************  
  
 /* find the name key in the keybindings and return the value.      if(originProperty.size() == 0)
     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();          originProperty = expectedOriginRole.getString();
   
     // find the correct key binding  
     for (Uint32 i = 0; i < kbArray.size(); i++)  
     {  
         if (kbArray[i].getName() == keyName)  
         {  
             return (kbArray[i].getValue());  
         }  
     }     }
     throw CIMInvalidParameterException("Invalid key property: " + keyName.getString());      else if(!expectedOriginRole.equal(originProperty))
 }  
   
 String _getKeyValue(const CIMInstance& instance, const CIMName& keyName)  
 {  
     Uint32 pos;  
     CIMValue propertyValue;  
   
     pos = instance.findProperty(keyName);  
     if (pos == PEG_NOT_FOUND)  
     {     {
        throw CIMPropertyNotFoundException          PEG_METHOD_EXIT();
            (NAMESPACE_PROPERTYNAME.getString());          return false;
     }     }
  
     propertyValue = instance.getProperty(pos).getValue();      PEG_METHOD_EXIT();
     if (propertyValue.getType() != CIMTYPE_STRING)      return true;
     {  
        throw CIMInvalidParameterException("Invalid type for property: "  
                              + NAMESPACE_PROPERTYNAME.getString());  
     }  
     String name;  
     propertyValue.get(name);  
     return(name);  
     //ATTN: KS Returns String whereas below returns CIMNamespaceName.  
 } }
  
 /* gets the key value for the __Namespace property "name"  //
    from the instance provided. Sets childNamespaceName and  // Local version of the references operation. It validates the input
    isRelativeName fields  // parameters, setting the origin and target property values if not set
    This overload called if instance provided.  // 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
 void _getKeyValue (  // properties matches the objectName parameter passed into the method. If so,
     const CIMInstance& namespaceInstance,  // then it is added to the array of association instances to be returned.
         CIMNamespaceName& childNamespaceName,  //
         Boolean& isRelativeName)  Array<CIMInstance> InteropProvider::localReferences(
       const OperationContext & context,
       const CIMObjectPath & objectName,
       const CIMName & assocClass,
       String & originProperty,
       String & targetProperty,
       const CIMPropertyList & propertyList,
       const CIMName & targetClass)
 { {
     //Validate key property      PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,
           "InteropProvider::localReferences()");
     Uint32 pos;  
     CIMValue propertyValue;  
  
     // [Key, MaxLen (256), Description (      Array<CIMInstance> instances;
     //       "A string that uniquely identifies the Namespace "      CIMName originClass = objectName.getClassName();
     //       "within the ObjectManager.") ]  
     // string Name;  
  
     pos = namespaceInstance.findProperty(NAMESPACE_PROPERTYNAME);      Array<CIMName> targetSubclasses;
     if (pos == PEG_NOT_FOUND)      CIMNamespaceName lastTargetNamespace;
       CIMNamespaceName originNamespace(objectName.getNameSpace());
   
       // Check that the association traversal request is valid
       if(validAssocClassForObject(assocClass, objectName.getClassName(),
           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())
     {     {
        throw CIMPropertyNotFoundException                          targetNamespace = originNamespace;
            (NAMESPACE_PROPERTYNAME.getString());                          targetPath.setNameSpace(targetNamespace);
     }     }
                       if(targetNamespace != lastTargetNamespace)
     propertyValue = namespaceInstance.getProperty(pos).getValue();  
     if (propertyValue.getType() != CIMTYPE_STRING)  
     {     {
        throw CIMInvalidParameterException("Invalid type for property: "                          try
                              + NAMESPACE_PROPERTYNAME.getString());  
     }  
   
     String cnsName;  
     propertyValue.get(cnsName);  
     childNamespaceName = CIMNamespaceName (cnsName);  
   
     isRelativeName = !(childNamespaceName.isNull());  
   
 }  
 /* gets the key value for the __Namespace property "name"  
    from the instance provided. Sets childNamespaceName and  
    isRelativeName fields  
    This overload called if object path provided.  
 */  
   
 void _getKeyValue (  
         const CIMObjectPath&  instanceName,  
         CIMNamespaceName& childNamespaceName,  
         Boolean& isRelativeName)  
 {  
   
     Array<CIMKeyBinding> kbArray = instanceName.getKeyBindings();  
     if ((kbArray.size() == 1) &&  
             (kbArray[0].getName() == NAMESPACE_PROPERTYNAME))  
     {     {
        childNamespaceName = CIMNamespaceName (kbArray[0].getValue());                              targetSubclasses = repository->enumerateClassNames(
        isRelativeName = !(childNamespaceName.isNull());                                  targetNamespace, targetClass, true);
     }     }
     else                          catch(...)
     {     {
        throw CIMInvalidParameterException("Invalid key property:  ");                              // 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;
 } }
  
 /* generate the full namespace name from the parent and child                      // Try to find the targetPath's class in the search space
    components                      CIMName targetPathClass = targetPath.getClassName();
    @param namespaceNames - List of all namespaces                      for(Uint32 j = 0, m = targetSubclasses.size(); j < m; ++j)
    @param parentNamespaceName  
    @param childNamespaceName  
    @param Boolean isrelative  
    @return full namespacename created from parent + child  
    Note that if isrelative is true, parent is tested for validty  
 */  
 CIMNamespaceName _generateFullNamespaceName(  
         Array<CIMNamespaceName>& namespaceNames,  
         CIMNamespaceName& parentNamespaceName,  
         CIMNamespaceName& childNamespaceName,  
         Boolean isRelativeName)  
   
 {  
     // If isRelativeName is true, then the parentNamespace  
     // MUST exist  
     //  
     CIMNamespaceName fullNamespaceName;  
   
     if (isRelativeName)  
     {     {
       if (!_isNamespace(namespaceNames, parentNamespaceName))                          if(targetPathClass == targetSubclasses[j])
       {       {
          throw CIMObjectNotFoundException("Parent namespace does not exist: "                              instances.append(currentInstance);
                                   + parentNamespaceName.getString());                              break;
                           }
       }       }
       // Create full namespace name by prepending parentNamespaceName  
       fullNamespaceName = CIMNamespaceName (parentNamespaceName.getString()  
           + "/" + childNamespaceName.getString());  
     }     }
     else     else
     {     {
       fullNamespaceName = parentNamespaceName;                      instances.append(currentInstance);
     }  
     return(fullNamespaceName);  
   
 } }
   
 //***************************************************************************  
 //  The following section is the Instance Operation processors  
 //***************************************************************************  
 //                createInstance  
 //***************************************************************************  
 void InteropProvider::createInstance(  
         const OperationContext & context,  
         const CIMObjectPath & instanceReference,  
     const CIMInstance& myInstance,  
         ObjectPathResponseHandler & handler)  
     {  
         PEG_METHOD_ENTER(TRC_CONTROLPROVIDER, "InteropProvider::createInstance()");  
   
         CIMNamespaceName childNamespaceName;  
         CIMNamespaceName newNamespaceName;  
         Boolean isRelativeName;  
         CDEBUG("CreateInstance " << instanceReference.toString());  
         // operation namespace needed internally to get class.  
         _operationNamespace = instanceReference.getNameSpace();  
   
         // Verify that ClassName is correct and get value  
         targetClass classEnum  = _verifyValidClassInput(instanceReference.getClassName());  
         CDEBUG("Class Validated");  
         String userName = _validateUserID(context);  
         CIMObjectPath newInstanceReference;  
         CDEBUG("UserIDValidated");  
         if ((classEnum == CIM_OBJECTMANAGER) ||  
             (classEnum == CIM_OBJECTMANAGERCOMMUNICATIONMECHANISM)||  
             (classEnum == CIM_CIMXMLCOMMUNICATIONMECHANISM))  
             throw CIMNotSupportedException("InteropProvider, Create Not allowed");  
   
         CDEBUG("CreateInstance: No test for CIM_NamepsaceClass");  
         if (classEnum == CIM_NAMESPACE)  
         {  
             CDEBUG("Create Class from CIM_Namespace");  
   
             // Validate that keys are as required. Does its own exception.  
             _validateCIMNamespaceKeys(myInstance);  
             CDEBUG("_validateCIMNamespaceKeys passed");  
             String namespaceName;  
             newNamespaceName = _getKeyValue(myInstance, CIM_NAMESPACE_PROPERTY_NAME);  
             CDEBUG("CreateInstance: rtn form _getKeyValue ");  
   
             CIMInstance instance = _buildInstanceCIMNamespace(namespaceName);  
             CDEBUG("CreateInstance:Rtn from _BuildInstanceCIMNamespace for namespace= " << namespaceName);  
             newInstanceReference = _buildInstancePath(CIMNamespaceName(namespaceName),  
                                         CIM_NAMESPACE_CLASSNAME, instance);  
             CDEBUG("CreateInstance:Go to common create functions");  
         }  
   
         else   // Process the __Namespace request to get namespace name value  
         {  
             CDEBUG("CreateInstance: Fell through to __Namespace processing");  
             _getKeyValue(myInstance, childNamespaceName, isRelativeName);  
             CIMNamespaceName parentNamespaceName = instanceReference.getNameSpace();  
   
             PEG_TRACE_STRING(TRC_CONTROLPROVIDER, Tracer::LEVEL4,  
                "childNamespaceName = " + childNamespaceName.getString() +  
                ", isRelativeName = " +  
                (isRelativeName?String("true"):String("false")) +  
                ", parentNamespaceName = " + parentNamespaceName.getString());  
             CDEBUG("__Namespace Process. parent= " << parentNamespaceName.getString() );  
             Array<CIMNamespaceName> namespaceNames;  
             namespaceNames = _enumerateNameSpaces();  
   
             newNamespaceName = _generateFullNamespaceName(  
                 namespaceNames, parentNamespaceName,  
                          childNamespaceName, isRelativeName);  
   
             // return key (i.e., CIMObjectPath) for newly created namespace  
   
             Array<CIMKeyBinding> keyBindings;  
             keyBindings.append(CIMKeyBinding(NAMESPACE_PROPERTYNAME,  
                  isRelativeName?childNamespaceName.getString():  
                                     parentNamespaceName.getString(),  
                                          CIMKeyBinding::STRING));  
             //Add namespace class and keybindings  
             newInstanceReference.set(String::EMPTY, parentNamespaceName,  
                                          __NAMESPACE_CLASSNAME, keyBindings);  
         }         }
         // Create the new namespace  
         try  
         {  
             CDEBUG("Create namespace " << newNamespaceName.getString());  
             PEG_TRACE_STRING(TRC_CONTROLPROVIDER, Tracer::LEVEL4,  
                 "Namespace = " + newNamespaceName.getString() +  
                     " to be created.");  
   
             _repository->createNameSpace(newNamespaceName);  
   
             PEG_TRACE_STRING(TRC_CONTROLPROVIDER, Tracer::LEVEL4,  
                 "Namespace = " + newNamespaceName.getString() +  
                     " successfully created.");  
             // ATTN: Add standardlog entry here.  
         }         }
         catch(CIMException& e)  
         {  
            PEG_METHOD_EXIT();  
            throw e;  
         }         }
         catch(Exception& e)  
         {  
            PEG_METHOD_EXIT();  
            throw e;  
         }  
   
         // begin processing the request  
         handler.processing();  
   
   
        handler.deliver(newInstanceReference);  
   
        // complete processing the request  
        handler.complete();  
  
        PEG_METHOD_EXIT();        PEG_METHOD_EXIT();
        return;      return instances;
    }    }
  
 //***************************************************************************  
 //                deleteInstance  
 //***************************************************************************  
 void InteropProvider::deleteInstance(  
         const OperationContext & context,  
         const CIMObjectPath & instanceName,  
         ResponseHandler & handler)  
     {  
         PEG_METHOD_ENTER(TRC_CONTROLPROVIDER, "InteropProvider::deleteInstance");  
         CDEBUG("deleteInstance" << instanceName.toString());  
         CIMNamespaceName childNamespaceName;  
         CIMNamespaceName deleteNamespaceName;  
         Boolean isRelativeName;  
   
         // Verify that ClassName is correct and get value  
         targetClass classEnum  = _verifyValidClassInput(instanceName.getClassName());  
   
         String userName = _validateUserID(context);  
   
         Array<CIMNamespaceName> namespaceNames;  
         namespaceNames = _enumerateNameSpaces();  
   
         if ((classEnum == CIM_OBJECTMANAGER) ||  
             (classEnum == CIM_OBJECTMANAGERCOMMUNICATIONMECHANISM)||  
             (classEnum == CIM_CIMXMLCOMMUNICATIONMECHANISM))  
             throw CIMNotSupportedException("Delete Not allowed");  
   
         if (classEnum == CIM_NAMESPACE)  
         {  
             // validate requred keys.  Exception out if not valid  
             _validateCIMNamespaceKeys(instanceName);  
   
             deleteNamespaceName = _getKeyValue(instanceName, CIM_NAMESPACE_PROPERTY_NAME);  
             CDEBUG("Delete namespace = " << deleteNamespaceName );  
         }  
         else  // Procesing for __namespace  
         {  
   
            _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  //
   // Builds an instance of the class named className. Gets Class defintion and
            deleteNamespaceName = _generateFullNamespaceName(  // fills in the correct properties from the class.  This requires a repository
                namespaceNames, parentNamespaceName,  // getClass request for each instance built. The skeleton is built by
                          childNamespaceName, isRelativeName);  // creating the instance and copying qualifiers and properties from
         }  // the class. Finally the instance is cloned to separate it from the
   // original objects.
             // ATTN: KS Why THis???  // NOTE: This is very inefficient for anything larger than a few instances.
         if (deleteNamespaceName.equal (ROOTNS))  // 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,
         CIMClass& returnedClass)
        {        {
            throw CIMNotSupportedException("root namespace cannot be deleted.");      PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,
        }          "InteropProvider::_buildInstanceSkeleton()");
       // get class with lo = false, qualifier = true classorig = true
            _repository->deleteNameSpace(deleteNamespaceName);      returnedClass = repository->getClass(nameSpace,
           className, false, true, true);
            PEG_TRACE_STRING(TRC_CONTROLPROVIDER, Tracer::LEVEL4,      CIMInstance skeleton = returnedClass.buildInstance(true,true,
                "Namespace = " + deleteNamespaceName.getString() +          CIMPropertyList());
                " successfully deleted.");  
   
        Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::INFORMATION,  
            "Interop Provider Delete Namespace: $0",  
            deleteNamespaceName.getString());  
   
        handler.processing();  
   
        // complete processing the request  
        handler.complete();  
  
        PEG_METHOD_EXIT();        PEG_METHOD_EXIT();
        return ;      return skeleton;
     }     }
  
 //***************************************************************************  
 //                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");  
  
         // Verify that ClassName is correct and get value  CIMInstance InteropProvider::buildDependencyInstance(
         targetClass classEnum  = _verifyValidClassInput(instanceName.getClassName());      const String & antecedentId,
       const CIMName & antecedentClass,
       const String & dependentId,
       const CIMName & dependentClass,
       const CIMClass & dependencyClass)
   {
       Array<CIMKeyBinding> dependentKeys;
  
         String userName = _validateUserID(context);      dependentKeys.append(CIMKeyBinding(
           COMMON_PROPERTY_INSTANCEID,
           dependentId,CIMKeyBinding::STRING));
  
         // begin processing the request      return buildDependencyInstanceFromPaths(
         handler.processing();          buildDependencyReference(hostName, antecedentId, antecedentClass),
         if (classEnum == CIM_OBJECTMANAGER)          buildDependencyReference(hostName, dependentId, dependentClass),
         {          dependencyClass);
             CIMInstance instance = _buildInstanceCIMObjectManager();  
             handler.deliver(instance);  
             handler.complete();  
             PEG_METHOD_EXIT();  
             return;  
         }         }
  
         if (classEnum == CIM_OBJECTMANAGERCOMMUNICATIONMECHANISM)  void InteropProvider::initProvider()
         {         {
             // At this point there are no instances of this class.      if(providerInitialized)
             // It is specialized to CIMXMLCommunicationMechanism  
             //CIMInstance instance = _buildInstancCIMObjectCommunicationMechanism();  
             //handler.deliver(instance);  
             handler.complete();  
             PEG_METHOD_EXIT();  
             return;             return;
         }      // Placed METHOD_ENTER trace statement after checking whether the
       // provider is initialized because this method will be called for every
       // operation through the InteropProvider, and this method is only
       // interesting the first time it is successfully run.
       PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,
           "InteropProvider::initProvider()");
  
         if (classEnum == CIM_CIMXMLCOMMUNICATIONMECHANISM)      AutoMutex lock(interopMut);
       if(!providerInitialized)
         {         {
             CIMInstance instance = _buildInstancCIMXMLCommunicationMechanism("PegasusCIMXMLCommunications");          //
             handler.deliver(instance);          // Initialize the object manager instance for the CIM Server, and
             handler.complete();          // retrieve the object manager's name property. This is retrieved once
             PEG_METHOD_EXIT();          // and stored for use in constructing other instances requiring its
             return;          // value.
           //
         }          CIMInstance objectManager = getObjectManagerInstance();
           objectManager.getProperty(objectManager.findProperty(
         // Get List of namespaces              OM_PROPERTY_NAME)).getValue().get(objectManagerName);
         Array<CIMNamespaceName> namespaceNames;  
         namespaceNames = _enumerateNameSpaces();  
         CIMInstance instance;  
   
  
         if (classEnum == CIM_NAMESPACE)          //
           // 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)
         {         {
             // Not clear what we have to take into account here.              CIMConstProperty gatherDataProp =
             // get the namespace from the name value.                  objectManager.getProperty(gatherDataIndex);
             // should check the other keys to see if valid.              if (gatherDataProp.getType() == CIMTYPE_BOOLEAN)
             CIMNamespaceName namespaceName;  
             namespaceName = _getKeyValue(instanceName, CIM_NAMESPACE_PROPERTY_NAME);  
             // ATTN: Why this CIMNamespaceName parentNamespaceName = instanceName.getNameSpace();  
   
             if (!_isNamespace(namespaceNames, namespaceName))  
             {             {
                 throw CIMObjectNotFoundException("Namespace does not exist: "                  CIMValue gatherDataVal  = gatherDataProp.getValue();
                                      + namespaceName.getString());                  if (!gatherDataVal.isNull())
             }  
             PEG_TRACE_STRING(TRC_CONTROLPROVIDER, Tracer::LEVEL4,  
                "Namespace = " + namespaceName.getString() + " successfully found.");  
             instance = _buildInstanceCIMNamespace(namespaceName);  
         }  
         else  // processing for __Namespace  
         {         {
             CIMNamespaceName childNamespaceName;                      Boolean gatherData;
             CIMNamespaceName getNamespaceName;                      gatherDataVal.get(gatherData);
             Boolean isRelativeName;                      if (gatherData == true)
   
             _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: "                          StatisticalData* sd = StatisticalData::current();
                                      + getNamespaceName.getString());                          sd->setCopyGSD(true);
             }             }
             PEG_TRACE_STRING(TRC_CONTROLPROVIDER, Tracer::LEVEL4,  
                "Namespace = " + getNamespaceName.getString() +  
                    " successfully found.");  
   
             //Set name of class  
             CIMInstance instance(__NAMESPACE_CLASSNAME);  
   
             //  
             // construct the instance  
             //  
             instance.addProperty(CIMProperty(NAMESPACE_PROPERTYNAME,  
             isRelativeName?childNamespaceName.getString():  
                               parentNamespaceName.getString()));  
             //instance.setPath(instanceName);  
        }  
   
        handler.deliver(instance);  
   
        // complete processing the request  
        handler.complete();  
   
        PEG_METHOD_EXIT();  
        return ;  
     }  
   
 //***************************************************************************  
 //                enumerateInstances  
 //***************************************************************************  
 void InteropProvider::enumerateInstances(  
     const OperationContext & context,  
     const CIMObjectPath & ref,  
     const Boolean includeQualifiers,  
     const Boolean includeClassOrigin,  
     const CIMPropertyList& propertyList,  
     InstanceResponseHandler & handler)  
     {  
         PEG_METHOD_ENTER(TRC_CONTROLPROVIDER, "InteropProvider::enumerateInstances()");  
         // Verify that ClassName is correct and get value  
   
         targetClass classEnum  = _verifyValidClassInput(ref.getClassName());  
   
         // operation namespace needed internally to get class.  
         _operationNamespace = ref.getNameSpace();  
         //String userName = _validateUserID(context);  
   
         // The following 3 classes deliver a single instance because  
         // that is all there is today.  
         if (classEnum == CIM_OBJECTMANAGER)  
         {  
             CIMInstance instance = _buildInstanceCIMObjectManager();  
             handler.deliver(instance);  
             handler.complete();  
             PEG_METHOD_EXIT();  
             return;  
         }         }
   
         if (classEnum == CIM_OBJECTMANAGERCOMMUNICATIONMECHANISM)  
         {  
             // At this point there are instances of this class.  It is specialized  
             // to the CIMXMLCommunicationMechanism class.  
             //CIMInstance instance = _buildInstancCIMObjectCommunicationMechanism();  
             //handler.deliver(instance);  
             handler.complete();  
             PEG_METHOD_EXIT();  
             return;  
         }         }
   
         if (classEnum == CIM_CIMXMLCOMMUNICATIONMECHANISM)  
         {  
             CIMInstance instance = _buildInstancCIMXMLCommunicationMechanism("PegasusCIMXMLCommunications");  
             handler.deliver(instance);  
             handler.complete();  
             PEG_METHOD_EXIT();  
             return;  
   
         }         }
  
         // ATTN: Fix this up.  should not be here.          // Cache this class definition for use later.
         CIMNamespaceName parentNamespaceName = ref.getNameSpace();          profileCapabilitiesClass = repository->getClass(
               PEGASUS_NAMESPACENAME_INTEROP,
               PEGASUS_CLASSNAME_PG_PROVIDERPROFILECAPABILITIES,
               false, true, false);
  
         // ATTN KS Fix this so references both types of namespace          providerClassifications.append(Uint16(5)); // "Instrumentation"
         PEG_TRACE_STRING(TRC_CONTROLPROVIDER, Tracer::LEVEL4,  
            "parentNamespaceName = " + parentNamespaceName.getString());  
  
         // begin processing the request          //
         handler.processing();          // Initialize the namespaces so that all namespaces with the
           // CIM_ElementConformsToProfile class also have the
         Array<CIMNamespaceName> namespaceNames = _enumerateNameSpaces();          // PG_ElementConformsToProfile class. Needed in order to implement
           // the cross-namespace ElementConformsToProfile association in both
         Array<CIMInstance> instanceArray;          // directions.
         CDEBUG("Found " << namespaceNames.size() << " namespaces.");          //
         // Build response objects based on class requested          Array<CIMNamespaceName> namespaceNames =
         for (Uint32 i = 0; i < namespaceNames.size(); i++)              repository->enumerateNameSpaces();
         {          CIMClass conformsClass = repository->getClass(
             CDEBUG("For namespace' " << namespaceNames[i].getString());              PEGASUS_NAMESPACENAME_INTEROP,
             CDEBUG("Evaluate ClassEnum" << classEnum);              PEGASUS_CLASSNAME_PG_ELEMENTCONFORMSTOPROFILE);
             if (classEnum == CIM_NAMESPACE)          CIMClass profileClass = repository->getClass(
               PEGASUS_NAMESPACENAME_INTEROP,
               PEGASUS_CLASSNAME_PG_REGISTEREDPROFILE);
           for(Uint32 i = 0, n = namespaceNames.size(); i < n; ++i)
             {             {
                 CDEBUG("Evaluate CIM_Namespace" << classEnum);              // Check if the PG_ElementConformsToProfile class is present
                 // Create a valid CIM_Namespace Instance              CIMNamespaceName & currentNamespace = namespaceNames[i];
                 CIMInstance instance = _buildInstanceCIMNamespace(namespaceNames[i]);  
                 instanceArray.append(instance);  
   
                 PEG_TRACE_STRING(TRC_CONTROLPROVIDER, Tracer::LEVEL4,  
                 "Namespace = " + namespaceNames[i].getString());  
  
             }              CIMClass tmpCimClass;
             else // the else covers __NAMESPACE              CIMClass tmpPgClass;
             {              CIMClass tmpPgProfileClass;
                 // 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);                  // Look for these classes in the same try-block since the
                     instance.addProperty(                  // second depends on the first
                         (CIMProperty(NAMESPACE_PROPERTYNAME,                  tmpCimClass = repository->getClass(currentNamespace,
                         namespaceNames[i].getString().subString                      PEGASUS_CLASSNAME_CIM_ELEMENTCONFORMSTOPROFILE);
                             (parentNamespaceName.getString().size()+1,                  tmpPgClass = repository->getClass(currentNamespace,
                             namespaceNames[i].getString().size()-                      PEGASUS_CLASSNAME_PG_ELEMENTCONFORMSTOPROFILE);
                         parentNamespaceName.getString().size()-1))));  
   
                     instanceArray.append(instance);  
   
                     //instance.setPath(instanceName);  
                     PEG_TRACE_STRING(TRC_CONTROLPROVIDER, Tracer::LEVEL4,  
                     "childNamespace = " + namespaceNames[i].getString());  
                 }                 }
             }              catch(const Exception &)
         }  
         handler.deliver(instanceArray);  
   
         // complete processing the request  
         handler.complete();  
   
         PEG_METHOD_EXIT();  
     }  
   
 //***************************************************************************  
 //                enumerateInstanceNames  
 //***************************************************************************  
   
 void InteropProvider::enumerateInstanceNames(  
         const OperationContext & context,  
         const CIMObjectPath & classReference,  
         ObjectPathResponseHandler & handler)  
     {     {
         PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,  
                 "InteropProvider::enumerateInstanceNames()");  
   
         // operation namespace needed internally to get class.  
         _operationNamespace = classReference.getNameSpace();  
   
         targetClass classEnum  = _verifyValidClassInput(classReference.getClassName());  
   
         String userName = _validateUserID(context);  
         // begin processing the request  
         handler.processing();  
   
         // The following 3 classes deliver a single instance because  
         // that is all there is today.  
         if (classEnum == CIM_OBJECTMANAGER)  
         {  
             CIMInstance instance = _buildInstanceCIMObjectManager();  
             CIMObjectPath ref = _buildInstancePath(CIMNamespaceName(),  
                 CIM_OBJECTMANAGER_CLASSNAME, instance);  
             handler.deliver(ref);  
             handler.complete();  
             PEG_METHOD_EXIT();  
             return;  
         }         }
               try
         if (classEnum == CIM_OBJECTMANAGERCOMMUNICATIONMECHANISM)  
         {         {
             // At this point there are no instances of this class. It is specialized                  tmpPgProfileClass = repository->getClass(currentNamespace,
             // to CIMXMLCommunicationMechanism.                      PEGASUS_CLASSNAME_PG_REGISTEREDPROFILE);
             //CIMInstance instance = _buildInstancCIMObjectCommunicationMechanism();  
             //CIMObjectPath ref = _buildInstancePath(CIMNamespaceName(),  
             //    CIM_OBJECTMANAGERCOMMUNICATIONMECHANISM_CLASSNAME, instance);  
             //handler.deliver(ref);  
             //handler.complete();  
             PEG_METHOD_EXIT();  
             return;  
         }         }
               catch(const Exception &)
   
         if (classEnum == CIM_CIMXMLCOMMUNICATIONMECHANISM)  
         {         {
             CIMInstance instance = _buildInstancCIMXMLCommunicationMechanism("PegasusCIMXMLCommunications");                  // Note: if any of the above three classes aren't found,
             CIMObjectPath ref = _buildInstancePath(CIMNamespaceName(),                  // an exception will be thrown, which we can ignore since it's
                 CIM_CIMXMLCOMMUNICATIONMECHANISM_CLASSNAME, instance);                  // an expected case
             handler.deliver(ref);                  // TBD: Log trace message?
             handler.complete();  
             PEG_METHOD_EXIT();  
             return;  
   
         }         }
  
               // If the CIM_ElementConformsToProfile class is present, but
         // ATTN: Move this trace              // the PG_ElementConformsToProfile or PG_RegisteredProfile
         CIMNamespaceName parentNamespaceName = classReference.getNameSpace();              // class is not, then add it to that namespace.
         PEG_TRACE_STRING(TRC_CONTROLPROVIDER, Tracer::LEVEL4,              //
            "parentNamespaceName = " + parentNamespaceName.getString());              // Note that we don't have to check for the
         CDEBUG("Enumerate Instance Names. ns = " << parentNamespaceName.getString());              // CIM_RegisteredProfile class because if the
               // CIM_ElementConformsToProfile class is present, the
         // Get list of all namespaces              // CIM_RegisteredProfile class must also be present.
         Array<CIMNamespaceName> namespaceNames = _enumerateNameSpaces();              if(!tmpCimClass.isUninitialized())
   
         // Build the cimObjectPath for each namespace found  
         for (Uint32 i = 0; i < namespaceNames.size(); i++)  
         {         {
             if (classEnum == CIM_NAMESPACE)                  if(tmpPgClass.isUninitialized())
             {             {
                       CIMObjectPath newPath = conformsClass.getPath();
                 CDEBUG("Calling BuildInstancePath for "<< namespaceNames[i].getString() );                      newPath.setNameSpace(currentNamespace);
                 CIMInstance instance = _buildInstanceCIMNamespace(namespaceNames[i]);                      conformsClass.setPath(newPath);
                 CIMObjectPath ref = _buildInstancePath(CIMNamespaceName(namespaceNames[i]),                      repository->createClass(currentNamespace,
                                             CIM_NAMESPACE_CLASSNAME, instance);                          conformsClass);
   
                 handler.deliver(ref);  
   
                 PEG_TRACE_STRING(TRC_CONTROLPROVIDER, Tracer::LEVEL4,  
                     "namespace = " + namespaceNames[i].getString());  
             }             }
             else                  if(tmpPgProfileClass.isUninitialized())
             {             {
                 Array<CIMKeyBinding> keyBindings;                      CIMObjectPath newPath = conformsClass.getPath();
                 // Build the __Namespace objectpath                      newPath.setNameSpace(currentNamespace);
                 // Note that for the moment, the only property is name.                      conformsClass.setPath(newPath);
                 if (_isChild(parentNamespaceName, namespaceNames[i]))                      repository->createClass(currentNamespace,
                 {                          profileClass);
                     keyBindings.clear();  
                       keyBindings.append(CIMKeyBinding(NAMESPACE_PROPERTYNAME,  
                           namespaceNames[i].getString().subString  
                           (parentNamespaceName.getString().size()+1,  
                           namespaceNames[i].getString().size()-  
                           parentNamespaceName.getString().size()-1),  
                           CIMKeyBinding::STRING));  
   
                       CIMObjectPath ref(String::EMPTY, parentNamespaceName,  
                       __NAMESPACE_CLASSNAME, keyBindings);  
   
                       handler.deliver(ref);  
                       PEG_TRACE_STRING(TRC_CONTROLPROVIDER, Tracer::LEVEL4,  
                           "childNamespace = " + namespaceNames[i].getString());  
                 }  
             }             }
         }         }
   
         handler.complete();  
   
         PEG_METHOD_EXIT();  
     }  
   
   
 //**************************************************************  
 //**************************************************************  
 // Association Functions  
 //**************************************************************  
 //**************************************************************  
   
 void InteropProvider::associators(  
         const OperationContext & context,  
         const CIMObjectPath & objectName,  
         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(          // Now cache the Registration info used for ElementConformsToProfile
         const OperationContext & context,          cacheProfileRegistrationInfo();
         const CIMObjectPath & objectName,  
         const CIMName & associationClass,  
         const CIMName & resultClass,  
         const String & role,  
         const String & resultRole,  
         ObjectPathResponseHandler & handler)  
 {  
         throw CIMNotSupportedException("AssociationProvider::associatorNames");  
 }  
  
 void InteropProvider::references(          providerInitialized = true;
         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");  
 } }
  
 void InteropProvider::referenceNames(      PEG_METHOD_EXIT();
         const OperationContext & context,  
         const CIMObjectPath & objectName,  
         const CIMName & resultClass,  
         const String & role,  
         ObjectPathResponseHandler & handler)  
 {  
         throw CIMNotSupportedException("AssociationProvider::referenceNames");  
 } }
  
 PEGASUS_NAMESPACE_END PEGASUS_NAMESPACE_END
 // END_OF_FILE  
   // END OF FILE


Legend:
Removed from v.1.5.2.4  
changed lines
  Added in v.1.66.4.1

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2