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

Diff for /pegasus/src/Pegasus/ControlProviders/InteropProvider/InteropProvider.cpp between version 1.36 and 1.59

version 1.36, 2005/05/24 10:42:51 version 1.59, 2006/01/30 16:17:41
Line 1 
Line 1 
 //%2005////////////////////////////////////////////////////////////////////////  //%2006////////////////////////////////////////////////////////////////////////
 // //
 // Copyright (c) 2000, 2001, 2002 BMC Software; Hewlett-Packard Development // Copyright (c) 2000, 2001, 2002 BMC Software; Hewlett-Packard Development
 // Company, L.P.; IBM Corp.; The Open Group; Tivoli Systems. // Company, L.P.; IBM Corp.; The Open Group; Tivoli Systems.
Line 8 
Line 8 
 // IBM Corp.; EMC Corporation; VERITAS Software Corporation; The Open Group. // IBM Corp.; EMC Corporation; VERITAS Software Corporation; The Open Group.
 // Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.; // Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.;
 // EMC Corporation; VERITAS Software Corporation; The Open Group. // EMC Corporation; VERITAS Software Corporation; The Open Group.
   // Copyright (c) 2006 Hewlett-Packard Development Company, L.P.; IBM Corp.;
   // EMC Corporation; Symantec Corporation; The Open Group.
 // //
 // Permission is hereby granted, free of charge, to any person obtaining a copy // Permission is hereby granted, free of charge, to any person obtaining a copy
 // of this software and associated documentation files (the "Software"), to // of this software and associated documentation files (the "Software"), to
Line 50 
Line 52 
 //      CIM_ObjectManagerCommunicationMechanism //      CIM_ObjectManagerCommunicationMechanism
 //      CIM_CIMXMLCommunicationMechanism //      CIM_CIMXMLCommunicationMechanism
 //      CIM_ProtocolAdapter  (Note: Removed because deprecated class in cim 2.9) //      CIM_ProtocolAdapter  (Note: Removed because deprecated class in cim 2.9)
 //      CIM_Namespace (Effective Pegasus 2.4 we use PG_Namespace which  //      CIM_Namespace -- Only creates are allowed directly against this class.
 //      is a subclass of CIM_Namespace with additional properties for  //              This allows the publice class CIM_Namespace to be used to
 //      shared namespaces.  //              create namespaces.  Modifies, deletes must use the returned
   //              paths. Enumerates references, etc. all use hiearchy.
   //              NOTE: Changes the class to PG_Namespace and returns that
   //              objectpath
   //
   //      PG_Namespace - Pegasus particular subclass of CIM_Namespace that
   //      add the parameters for shared namespaces
   //
   //      PG_CIMXMLCommunicationMechanism - Pegasus subclass of
   //      CIM_CIMXMLCommunicationMechanism that adds support for passing
   //      additional communication parameters (ie. port, https vs. http, etc.)
 // //
 //      It also services the Interop associations tied to these classes //      It also services the Interop associations tied to these classes
 //      including: //      including:
 //      CIM_NamespaceInManager //      CIM_NamespaceInManager
 //      ... //      ...
   //      Interop forces all creates to the PEGASUS_NAMESPACENAME_INTEROP
   //      namespace. There is a test on each operation that returns
   //      the Invalid Class CIMDError
 //      This is a control provider and as such uses the Tracer functions //      This is a control provider and as such uses the Tracer functions
 //      for data and function traces.  Since we do not expect high volume //      for data and function traces.  Since we do not expect high volume
 //      use we added a number of traces to help diagnostics. //      use we added a number of traces to help diagnostics.
Line 71 
Line 86 
     3. Review the key parameters on create, etc. to be sort out which are     3. Review the key parameters on create, etc. to be sort out which are
        required from user and which we can supply.  I think we are asking too        required from user and which we can supply.  I think we are asking too
        much of the user right now.        much of the user right now.
   
 */ */
  
 #include <Pegasus/Common/Config.h> #include <Pegasus/Common/Config.h>
Line 94 
Line 110 
 #include <Pegasus/Common/OperationContext.h> #include <Pegasus/Common/OperationContext.h>
 #include <Pegasus/Config/ConfigManager.h> #include <Pegasus/Config/ConfigManager.h>
 #include <Pegasus/Common/XmlWriter.h> #include <Pegasus/Common/XmlWriter.h>
 #include <Pegasus/Config/ConfigManager.h>  
 #include <Pegasus/Common/StatisticalData.h> #include <Pegasus/Common/StatisticalData.h>
 #include <Pegasus/Common/HashTable.h> #include <Pegasus/Common/HashTable.h>
  
Line 115 
Line 130 
  
 #define CDEBUG(X) #define CDEBUG(X)
 #define LDEBUG() #define LDEBUG()
 //#define CDEBUG(X) PEGASUS_STD(cout) << "InteropProvider " << X << PEGASUS_STD(endl)  //#define CDEBUG(X) PEGASUS_STD(cout) << "InteropProvider (" << __LINE__ << ") " << X << PEGASUS_STD(endl)
 //#define LDEBUG(X) Logger::put (Logger::DEBUG_LOG, "InteropProvider", Logger::TRACE, "$0", X) //#define LDEBUG(X) Logger::put (Logger::DEBUG_LOG, "InteropProvider", Logger::TRACE, "$0", X)
  
 //************************************************************************** //**************************************************************************
Line 125 
Line 140 
 //************************************************************************** //**************************************************************************
  
 const char * thisProvider = "InteropProvider"; const char * thisProvider = "InteropProvider";
 // The following should be moved to somewhere like constants.  
 static const String PegasusInstanceIDGlobalPrefix = "PEG";  
  
   // This Mutex serializes access to the instance change CIM requests. Keeps from mixing
   // instance creates, modifications, and deletes. This keeps the provider from
   // simultaneously execute creates, modifications, and deletes of instances. While
   // these operations are largely protected by the locking mechanisms of the
   // repository this mutex guarantees that the provider will not simultaneously
   // execute the instance change operations.
   Mutex changeControlMutex;
 /** /**
     The constants representing the class names we process     The constants representing the class names we process
 */ */
 // ATTN DELETE: static const CIMName __NAMESPACE_CLASSNAME  = CIMName ("__Namespace");  
 static const CIMName CIM_NAMESPACE_CLASSNAME  = CIMName ("CIM_Namespace"); static const CIMName CIM_NAMESPACE_CLASSNAME  = CIMName ("CIM_Namespace");
 static const CIMName PG_NAMESPACE_CLASSNAME  = CIMName ("PG_Namespace"); static const CIMName PG_NAMESPACE_CLASSNAME  = CIMName ("PG_Namespace");
  
Line 145 
Line 164 
 static const CIMName CIM_NAMESPACEINMANAGER_CLASSNAME  = static const CIMName CIM_NAMESPACEINMANAGER_CLASSNAME  =
         CIMName ("CIM_NamespaceInManager");         CIMName ("CIM_NamespaceInManager");
  
 // Property Names for __Namespace Class  // Property Names for CIM_Namespace Class
 static const CIMName NAMESPACE_PROPERTYNAME  = CIMName ("Name"); static const CIMName NAMESPACE_PROPERTYNAME  = CIMName ("Name");
   
   // Root Namespace Name for test.
 static const CIMNamespaceName ROOTNS  = CIMNamespaceName ("root"); static const CIMNamespaceName ROOTNS  = CIMNamespaceName ("root");
  
  
 // Property names for CIM_ObjectManager Class // Property names for CIM_ObjectManager Class
 static const CIMName OM_GATHERSTATISTICALDATA  = static const CIMName OM_GATHERSTATISTICALDATA  =
  CIMName ("GatherStatisticalData");  CIMName ("GatherStatisticalData");
   
 // Property for the slp template. // Property for the slp template.
 static const CIMName OM_DESCRIPTIONPROPERTY = static const CIMName OM_DESCRIPTIONPROPERTY =
     CIMName("Description");     CIMName("Description");
Line 213 
Line 235 
 // operations. // operations.
  
 enum targetClass{ enum targetClass{
         //__NAMESPACE = 1,          CIM_NAMESPACE = 1,
         PG_NAMESPACE = 1,          PG_NAMESPACE = 2,
         CIM_OBJECTMANAGER = 2,          CIM_OBJECTMANAGER = 3,
         PG_CIMXMLCOMMUNICATIONMECHANISM = 3,          PG_CIMXMLCOMMUNICATIONMECHANISM = 4,
         CIM_NAMESPACEINMANAGERINST =4,          CIM_NAMESPACEINMANAGERINST =5,
         CIM_COMMMECHANISMFORMANAGERINST=5,          CIM_COMMMECHANISMFORMANAGERINST=6,
         CIM_NAMESPACEINMANAGER=6          CIM_NAMESPACEINMANAGER=7
     };     };
  
  enum targetAssocClass{  enum targetAssocClass{
Line 228 
Line 250 
  };  };
  
  
   String _showPathArray(Array<CIMObjectPath>& p)
   {
       String rtn;
       for (Uint32 i = 0 ; i < p.size() ; i++)
       {
           if (i > 0)
               rtn.append(" ");
           rtn.append(p[i].toString());
       }
       return(rtn);
   }
   
 //************************************************************* //*************************************************************
 //  Constructor //  Constructor
 //********************************************************** //**********************************************************
Line 238 
Line 272 
  
     //***********************************************     //***********************************************
     // This is a tempory fix untill there is a method created for the InteropProvider to     // This is a tempory fix untill there is a method created for the InteropProvider to
     // do it's inaliaztion work. This fix sets StatisticalData::CopyGSD, enabling the      // do it's inalization work. This fix sets StatisticalData::CopyGSD, enabling the
     //statistical gathering function.     //statistical gathering function.
     Array<CIMInstance> instance = repository->enumerateInstances(CIMNamespaceName("root/cimv2"), CIMName ("CIM_ObjectManager"));  
  
     if(instance.size() > 0)       Boolean InstancesExists = true;
        Array<CIMInstance> instance;
   
        try
        {
            instance = repository->enumerateInstances(PEGASUS_NAMESPACENAME_INTEROP,
                                                      CIM_OBJECTMANAGER_CLASSNAME);
        }
        catch(Exception e)
        {
            InstancesExists = false;
        }
   
        if(instance.size() > 0 && InstancesExists)
     {     {
         Boolean output = false;         Boolean output = false;
         Uint32 pos;         Uint32 pos;
Line 264 
Line 310 
             }             }
         }         }
     }     }
     //******************************************* end of temporary fix  
     PEG_METHOD_EXIT();     PEG_METHOD_EXIT();
  }  }
  
   
   
 //*************************************************************** //***************************************************************
 // Provider Utility Functions // Provider Utility Functions
 //*************************************************************** //***************************************************************
Line 291 
Line 334 
     return(tmp);     return(tmp);
 } }
  
   /** Determines if the namespace is allowable for this operation.
       This provider is designed to accept either all namespaces or
       limit itself to just one for operations.  In all cases, it
       will provide the required answers and use the correct namespace
       for any persistent information.  However, it may be configured
       to either accept input operations from any namespace or simply
       from one (normally the interop namespace).
       @ objectReference for the operation.  This must include the
       namespace and class name for the operation.
       @return Returns normally if the namespace test is passed. Otherwise
       it generates a CIMException (CIM_ERR_NOT_SUPPORTED)
       @exception CIMException(CIM_ERR_NOT_SUPPORTED)
   */
   void _isNamespaceAllowed(const CIMObjectPath & path)
   {
       // To allow use of all namespaces, uncomment the following line
       // return;
       if (path.getNameSpace().getString() != PEGASUS_NAMESPACENAME_INTEROP)
       {
               throw CIMNotSupportedException(
                             path.getClassName().getString());
       }
       else
           return;
   }
   /* set the hostname and namespace fields into the cimobjectpath
      of the defined instance
   */
   
   void _setCompleteInstancePath(CIMInstance& instance,
                              const CIMObjectPath& inputPath)
   {
       CIMObjectPath p = instance.getPath();
       p.setHost(inputPath.getHost());
       p.setNameSpace(inputPath.getNameSpace());
   
       instance.setPath(p);
   }
   
   /* complete the instance by setting the complete path into the instance
      and executing the instance filter to set the qualifiers, classorigin and
      propertylist in accordance with the input.  Note that this can only remove
      characteristics, except for the path completion so that it expects instances
      with qualifiers included, class origin included and a complete property
      list.
   */
   
   
    void _finishInstance(CIMInstance& instance, const CIMObjectPath& path, Boolean includeQualifiers,
        Boolean includeClassOrigin, const CIMPropertyList& propertyList)
    {
        _setCompleteInstancePath( instance, path);
        instance.filter(includeQualifiers,
                        includeClassOrigin,
                        propertyList );
    }
 static String _showPropertyList(const CIMPropertyList& pl) static String _showPropertyList(const CIMPropertyList& pl)
 { {
     if (pl.isNull())     if (pl.isNull())
Line 345 
Line 444 
             if (!v1.isNull())             if (!v1.isNull())
                 v1.get(output);                 v1.get(output);
         }         }
           else
               throw CIMInvalidParameterException(
                   "Incorrect Property Type for Property " + propertyName.getString());
     }     }
     return(output);     return(output);
 } }
Line 354 
Line 456 
     If everything fails, gets the definition normally     If everything fails, gets the definition normally
     used for localhost (127.0.0.1).     used for localhost (127.0.0.1).
  
     @param hostName String with the name of the host      @param hostName String with the name of the host. Allows
     @return String with the IP address to be used      String:EMPTY and in that case, gets it directly from system.
     NOTE: This code should not be in slpprovider. This      @param namespaceType - Uint32 representing the
     should be in the Interop classes but for the moment      access protocol for this request.  This is exactly
     it is not.      the definition in the PG_CIMXMLCommunicationMechanism
       mof for the property namespaceAccessProtocol.
       @param port String defining the port to be used.  If
       String::EMPTY, it is not valid and the defaultPortNumber
       is to be inserted.
       @param defaultPortNumber Uint32 defining a default port
       number to be used if port string is not provided.
       @return String with the IP address to be used. This must
       be the complete address sufficient to access the
       IP address. Therefore, it includes the port number.
 */ */
 String _getHostAddress(String hostName)  String _getHostAddress(String & hostName, Uint32  namespaceType,
       const String & port, const Uint32 defaultPortNumber)
 { {
   String ipAddress;   String ipAddress;
  
Line 372 
Line 484 
       // set default address if everything else failed       // set default address if everything else failed
       ipAddress = String("127.0.0.1");       ipAddress = String("127.0.0.1");
   }   }
   return ipAddress;    // Question: is there a case where we leave off the port number.
     // Code to get the property service_location_tcp ( which is equivalent to "IP address:5988")
   
     // if port is valid port number, we use it.  Else use
     // the default portnumber provided.
     // One or the other MUST not be zero.
     ipAddress.append(":");
     if (port == String::EMPTY)
     {
         // convert portNumber to ascii
         char buffer[32];
         sprintf(buffer, "%u", defaultPortNumber);
         ipAddress.append(buffer);
 } }
     else
         ipAddress.append(port);
   
     // now fillout the serviceIDAttribute from the object manager instance name property.
     // This is a key field so must have a value.
     //String strUUID = _getPropertyValue( instance_ObjMgr, namePropertyName, "DefaultEmptyUUID");
  
     return ipAddress;
   }
    /** Fills in the CIMOperation functional profiles and corresponding description
        array.  This function is closely linked to compile and configuration
        features in the CIM Server to determine if certain features are
        enabled and/or compiled.  Definitions correspond to the DMTF SLP template
        version 1.0.
        @param Array<Uint16> profiles provides an array for the profiles
        @return Array<String> with the corresponding profile text descriptions
   */
  Array<String> _getFunctionalProfiles(Array<Uint16> & profiles)  Array<String> _getFunctionalProfiles(Array<Uint16> & profiles)
  {  {
      Array<String> profileDescriptions;      Array<String> profileDescriptions;
        // Note that zero and 1 are unknown and other. Not used by us
        // 2 - 5 are not optional in Pegasus
      profiles.append(2); profileDescriptions.append("Basic Read");      profiles.append(2); profileDescriptions.append("Basic Read");
      profiles.append(3); profileDescriptions.append("Basic Write");      profiles.append(3); profileDescriptions.append("Basic Write");
      profiles.append(4); profileDescriptions.append("Schema Manipulation");      profiles.append(4); profileDescriptions.append("Schema Manipulation");
      profiles.append(5); profileDescriptions.append("Instance Manipulation");      profiles.append(5); profileDescriptions.append("Instance Manipulation");
   
        ConfigManager* configManager = ConfigManager::getInstance();
        if (String::equal(configManager->getCurrentValue("enableAssociationTraversal"), "true"))
        {
      profiles.append(6); profileDescriptions.append("Association Traversal");      profiles.append(6); profileDescriptions.append("Association Traversal");
        }
   #ifndef PEGASUS_DISABLE_EXECQUERY
        profiles.append(7); profileDescriptions.append("Query Execution");
   #endif
      profiles.append(8); profileDescriptions.append("Qualifier Declaration");      profiles.append(8); profileDescriptions.append("Qualifier Declaration");
        if (String::equal(configManager->getCurrentValue("enableIndicationService"), "true"))
        {
      profiles.append(9); profileDescriptions.append("Indications");      profiles.append(9); profileDescriptions.append("Indications");
        }
      return(profileDescriptions);      return(profileDescriptions);
  }  }
  
 /*  get the prefix that will be part of the cimom identification  /*  get the prefix that will be part of the cimom identification.
     This can be either the default PEG or if the environment      This prefix is obtained from the Pegasus Constants.h
     variable PEGASUS_TRADEMARK_PREFIX is defined this is used.  
     NOTE: getting from the environment variable is a hack until  
     we can come up with a better source.  
     @return String containing the unique name for the CIMOM ID     @return String containing the unique name for the CIMOM ID
 */ */
  
 String getTrademarkCIMOMIDPrefix() String getTrademarkCIMOMIDPrefix()
 { {
  
     char * trademark;      return(PEGASUS_INSTANCEID_GLOBAL_PREFIX);
     trademark = getenv("PEGASUS_TRADEMARK_PREFIX");  
     return((trademark)? trademark : PegasusInstanceIDGlobalPrefix);  
 } }
   
 /** Builds the UUID string for this CIMOM. /** Builds the UUID string for this CIMOM.
 **/ **/
 String getUUIDString() String getUUIDString()
Line 472 
Line 621 
     return(false);     return(false);
 } }
  
   /*  _CheckRequiredProperty
       Note validate does about the same thing.
   */
   Boolean _checkRequiredProperty(CIMInstance& instance,
       const CIMName& propertyName,
       const CIMType expectedType,
       const String & message)
   {
       PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,
           "_checkRequiredProperty");
   
       Boolean propertyError = false;
   
       //
       //  Required property must exist in instance
       //
       if (instance.findProperty (propertyName) == PEG_NOT_FOUND)
           propertyError = true;
       else
       {
           //
           //  Get the property
           //
           CIMProperty theProperty = instance.getProperty
               (instance.findProperty (propertyName));
           CIMValue theValue = theProperty.getValue ();
   
           //
           //  Required property must have a non-null value
           //
           if (theValue.isNull ())
               propertyError = true;
           else
           {
               //
               // Must have type defined
               //
   
               if ((theValue.getType ()) != expectedType)
                   propertyError = true;
           }
       }
       PEG_METHOD_EXIT ();
       return(propertyError);
   }
 Boolean _validateRequiredProperty(const CIMInstance& instance, Boolean _validateRequiredProperty(const CIMInstance& instance,
                           const CIMName& propertyName,                           const CIMName& propertyName,
                           const Uint16& value)                           const Uint16& value)
Line 557 
Line 751 
    @return the CIMClass object    @return the CIMClass object
    @Exceptions any repository exceptions if class not found.    @Exceptions any repository exceptions if class not found.
 */ */
 CIMClass InteropProvider::_getClass(const CIMNamespaceName& nameSpace,  CIMClass InteropProvider::_getClass(const CIMObjectPath& objectPath,
                                     const CIMName& className)                                     const CIMName& className)
 { {
     PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,     PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,
             "InteropProvider::_getClass");             "InteropProvider::_getClass");
  
     CIMClass myClass = _repository->getClass(nameSpace, className,      CIMClass myClass = _repository->getClass(objectPath.getNameSpace(), className,
                             false,true,true);                             false,true,true);
     PEG_METHOD_EXIT();     PEG_METHOD_EXIT();
     return myClass;     return myClass;
Line 588 
Line 782 
     if (className.equal(CIM_NAMESPACEINMANAGER_CLASSNAME))     if (className.equal(CIM_NAMESPACEINMANAGER_CLASSNAME))
         return CIM_NAMESPACEINMANAGER;         return CIM_NAMESPACEINMANAGER;
  
       if (className.equal(CIM_NAMESPACE_CLASSNAME))
           return CIM_NAMESPACE;
   
     // Last entry, reverse test and return OK if PG_Namespace     // Last entry, reverse test and return OK if PG_Namespace
     // Note: Changed to PG_Namespace for CIM 2.4     // Note: Changed to PG_Namespace for CIM 2.4
     if (!className.equal(PG_NAMESPACE_CLASSNAME))     if (!className.equal(PG_NAMESPACE_CLASSNAME))
Line 620 
Line 817 
 { {
     PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,     PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,
             "InteropProvider::_validateUserID");             "InteropProvider::_validateUserID");
     //ATTN-DME-P3-20020522: ADD AUTHORIZATION CHECK TO __NAMESPACE PROVIDER  
     String userName;     String userName;
     try     try
     {     {
Line 646 
Line 842 
     @param value String value to set into property     @param value String value to set into property
  
 */ */
 void _setPropertyValue(CIMInstance& instance, const CIMName propertyName, const String& value)  void _setPropertyValue(CIMInstance& instance, const CIMName& propertyName, const String& value)
 { {
     Uint32 pos;     Uint32 pos;
     if ((pos = instance.findProperty(propertyName)) != PEG_NOT_FOUND)     if ((pos = instance.findProperty(propertyName)) != PEG_NOT_FOUND)
         instance.getProperty(pos).setValue(CIMValue(value));         instance.getProperty(pos).setValue(CIMValue(value));
 } }
  
 void _setPropertyValue(CIMInstance& instance, const CIMName propertyName, const Boolean& value)  void _setPropertyValue(CIMInstance& instance, const CIMName& propertyName, const Boolean& value)
 { {
     Uint32 pos;     Uint32 pos;
     if ((pos = instance.findProperty(propertyName)) != PEG_NOT_FOUND)     if ((pos = instance.findProperty(propertyName)) != PEG_NOT_FOUND)
         instance.getProperty(pos).setValue(CIMValue(value));         instance.getProperty(pos).setValue(CIMValue(value));
 } }
  
 void _setPropertyValue(CIMInstance& instance, const CIMName propertyName, const Uint16& value)  void _setPropertyValue(CIMInstance& instance, const CIMName& propertyName, const Uint16& value)
 { {
     Uint32 pos;     Uint32 pos;
     if ((pos = instance.findProperty(propertyName)) != PEG_NOT_FOUND)     if ((pos = instance.findProperty(propertyName)) != PEG_NOT_FOUND)
         instance.getProperty(pos).setValue(CIMValue(value));         instance.getProperty(pos).setValue(CIMValue(value));
 } }
  
 void _setPropertyValue(CIMInstance& instance, const CIMName propertyName, const Array<String>& value)  void _setPropertyValue(CIMInstance& instance, const CIMName& propertyName, const Array<String>& value)
 { {
     Uint32 pos;     Uint32 pos;
     if ((pos = instance.findProperty(propertyName)) != PEG_NOT_FOUND)     if ((pos = instance.findProperty(propertyName)) != PEG_NOT_FOUND)
         instance.getProperty(pos).setValue(CIMValue(value));         instance.getProperty(pos).setValue(CIMValue(value));
 } }
  
 void _setPropertyValue(CIMInstance& instance, const CIMName propertyName, const Array<Uint16>& value)  void _setPropertyValue(CIMInstance& instance, const CIMName& propertyName, const Array<Uint16>& value)
 { {
     Uint32 pos;     Uint32 pos;
     if ((pos = instance.findProperty(propertyName)) != PEG_NOT_FOUND)     if ((pos = instance.findProperty(propertyName)) != PEG_NOT_FOUND)
         instance.getProperty(pos).setValue(CIMValue(value));         instance.getProperty(pos).setValue(CIMValue(value));
 } }
  
 void _setPropertyValue(CIMInstance& instance, const CIMName propertyName, const CIMObjectPath& value)  void _setPropertyValue(CIMInstance& instance, const CIMName& propertyName, const CIMObjectPath& value)
 { {
     Uint32 pos;     Uint32 pos;
     if ((pos = instance.findProperty(propertyName)) != PEG_NOT_FOUND)     if ((pos = instance.findProperty(propertyName)) != PEG_NOT_FOUND)
Line 698 
Line 894 
             "InteropProvider::_fixInstanceCommonKeys()");             "InteropProvider::_fixInstanceCommonKeys()");
     String SystemCreationClassName = System::getSystemCreationClassName ();     String SystemCreationClassName = System::getSystemCreationClassName ();
  
     _setPropertyValue(instance, CIM_NAMESPACE_PROPERTY_SYSTEMCREATIONCLASSNAME,SystemCreationClassName);      _setPropertyValue(instance, CIM_NAMESPACE_PROPERTY_SYSTEMCREATIONCLASSNAME,
               SystemCreationClassName);
  
     // Add property SystemName     // Add property SystemName
       _setPropertyValue(instance, CIM_NAMESPACE_PROPERTY_SYSTEMNAME,
     _setPropertyValue(instance, CIM_NAMESPACE_PROPERTY_SYSTEMNAME,System::getFullyQualifiedHostName());              System::getFullyQualifiedHostName());
     PEG_METHOD_EXIT();     PEG_METHOD_EXIT();
 } }
  
Line 718 
Line 915 
     @return CIMInstance of this class with properties complete.     @return CIMInstance of this class with properties complete.
     @exception passes on any exceptions received from the repository request.     @exception passes on any exceptions received from the repository request.
 */ */
 CIMInstance InteropProvider::_buildInstanceSkeleton(const CIMName& className)  CIMInstance InteropProvider::_buildInstanceSkeleton(const CIMObjectPath & objectPath,
                                                       const CIMName& className,
                                                       CIMClass& returnedClass)
 { {
     PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,     PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,
             "InteropProvider::_buildInstanceSkeleton()");             "InteropProvider::_buildInstanceSkeleton()");
     CIMClass myClass;      // get class with lo = false, qualifier = true classorig = true
       CIMClass myClass = _repository->getClass(objectPath.getNameSpace(),
     CIMInstance skeleton(className);                                          className, false, true, true);
         myClass = _repository->getClass(_operationNamespace, className, false, true, true);      returnedClass = myClass;
       CIMInstance skeleton = myClass.buildInstance(true,true,CIMPropertyList());
     // copy the qualifiers  
     for (Uint32 i = 0 ; i < myClass.getQualifierCount() ; i++)  
         skeleton.addQualifier(myClass.getQualifier(i));  
   
     // copy the properties  
     for (Uint32 i = 0 ; i < myClass.getPropertyCount() ; i++)  
         skeleton.addProperty(myClass.getProperty(i));  
  
     PEG_METHOD_EXIT();     PEG_METHOD_EXIT();
     return(skeleton.clone());      return(skeleton);
 } }
  
 /* build a single instance of the cimxmlcommunicationmechanism class /* build a single instance of the cimxmlcommunicationmechanism class
    using the parameter provided as the name property     using the parameter provided as the name property.
      Builds the complete instance and sets the path into it.
    @parm name String representing the name to be used for this object.    @parm name String representing the name to be used for this object.
    @return CIMInstance of the class    @return CIMInstance of the class
 */ */
 CIMInstance InteropProvider::_buildInstancePGCIMXMLCommunicationMechanism( CIMInstance InteropProvider::_buildInstancePGCIMXMLCommunicationMechanism(
               const CIMObjectPath& objectPath,
                                             const String& namespaceType,                                             const String& namespaceType,
                                             const String& IPAddress,              const Uint16& accessProtocol,
                                             const Boolean& includeQualifiers,              const String& IPAddress)
                                             const Boolean& includeClassOrigin,  
                                             const CIMPropertyList& propertyList)  
 { {
     PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,     PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,
             "InteropProvider::_buildInstancePGCIMXMLCommunicationMechanism()");             "InteropProvider::_buildInstancePGCIMXMLCommunicationMechanism()");
       CIMClass targetClass;
     CIMInstance instance = _buildInstanceSkeleton(PG_CIMXMLCOMMUNICATIONMECHANISM_CLASSNAME);      CIMInstance instance = _buildInstanceSkeleton(objectPath,
                               PG_CIMXMLCOMMUNICATIONMECHANISM_CLASSNAME,
                               targetClass);
  
     _fixInstanceCommonKeys(instance);     _fixInstanceCommonKeys(instance);
  
     //CreationClassName     //CreationClassName
     _setPropertyValue(instance, CIM_NAMESPACE_PROPERTY_CREATIONCLASSNAME,PG_CIMXMLCOMMUNICATIONMECHANISM_CLASSNAME.getString());      _setPropertyValue(instance, CIM_NAMESPACE_PROPERTY_CREATIONCLASSNAME,
               PG_CIMXMLCOMMUNICATIONMECHANISM_CLASSNAME.getString());
  
     //Name, this CommunicationMechanism.  We need to make it unique.  To do this     //Name, this CommunicationMechanism.  We need to make it unique.  To do this
     // we simply append the commtype to the classname since we have max of two right     // we simply append the commtype to the classname since we have max of two right
     // now.     // now.
     _setPropertyValue(instance, CIM_NAMESPACE_PROPERTY_NAME, (String("PEGASUSCOMM") + namespaceType));      _setPropertyValue(instance, CIM_NAMESPACE_PROPERTY_NAME,
               (String("PEGASUSCOMM") + namespaceType));
  
     // CommunicationMechanism Property - Force to 2.     // CommunicationMechanism Property - Force to 2.
     _setPropertyValue(instance, OM_COMMUNICATIONMECHANISM, Uint16(2));     _setPropertyValue(instance, OM_COMMUNICATIONMECHANISM, Uint16(2));
Line 785 
Line 981 
     Array<Uint16> authentications;     Array<Uint16> authentications;
     Array<String> authenticationDescriptions;     Array<String> authenticationDescriptions;
  
     // Note that we have fixed authentication here.      //TODO - get from system.
     authentications.append(3); authenticationDescriptions.append("Basic");      authentications.append(3);
       //authenticationDescriptions.append("Basic");
  
     _setPropertyValue(instance, OM_AUTHENTICATIONMECHANISMSSUPPORTED, authentications);     _setPropertyValue(instance, OM_AUTHENTICATIONMECHANISMSSUPPORTED, authentications);
  
Line 797 
Line 994 
     // Obsolete function     // Obsolete function
     _setPropertyValue(instance, "namespaceType", namespaceType);     _setPropertyValue(instance, "namespaceType", namespaceType);
  
       _setPropertyValue(instance, "namespaceAccessProtocol", accessProtocol);
   
     _setPropertyValue(instance, "IPAddress", IPAddress);     _setPropertyValue(instance, "IPAddress", IPAddress);
  
       // build the instance path and set into instance
       instance.setPath(instance.buildPath(targetClass));
   
     PEG_METHOD_EXIT();     PEG_METHOD_EXIT();
     return(instance);     return(instance);
 } }
  
 Array<CIMInstance> InteropProvider::_buildInstancesPGCIMXMLCommunicationMechanism( Array<CIMInstance> InteropProvider::_buildInstancesPGCIMXMLCommunicationMechanism(
                                             const Boolean includeQualifiers,                                              const CIMObjectPath& objectPath)
                                             const Boolean includeClassOrigin,  
                                             const CIMPropertyList& propertyList)  
 { {
     PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,     PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,
             "InteropProvider::_buildInstancesPGCIMXMLCommunicationMechanism");             "InteropProvider::_buildInstancesPGCIMXMLCommunicationMechanism");
  
     // This is a temporary hack to get the multiple connections.  
     ConfigManager* configManager = ConfigManager::getInstance();     ConfigManager* configManager = ConfigManager::getInstance();
     Boolean enableHttpConnection = String::equal(     Boolean enableHttpConnection = String::equal(
         configManager->getCurrentValue("enableHttpConnection"), "true");         configManager->getCurrentValue("enableHttpConnection"), "true");
     Boolean enableHttpsConnection = String::equal(     Boolean enableHttpsConnection = String::equal(
         configManager->getCurrentValue("enableHttpsConnection"), "true");         configManager->getCurrentValue("enableHttpsConnection"), "true");
  
     String IPAddress = _getHostAddress(System::getHostName());  
     Array<CIMInstance> instances;     Array<CIMInstance> instances;
       Uint32 namespaceAccessProtocol;
       String namespaceType;
  
       // for each type, create the instance if that type is defined.
       String hostName = System::getHostName();
     if (enableHttpConnection)     if (enableHttpConnection)
     {     {
         CDEBUG("building pgcimxmlinstances 1");          namespaceAccessProtocol = 2;
         CIMInstance instance = _buildInstancePGCIMXMLCommunicationMechanism(          namespaceType = "http";
                             "http", IPAddress,          Uint32 portNumberHttp;
                             includeQualifiers,          String httpPort = configManager->getCurrentValue("httpPort");
                             includeClassOrigin,          if (httpPort == String::EMPTY)
                             propertyList);          {
               portNumberHttp = System::lookupPort(WBEM_HTTP_SERVICE_NAME, WBEM_DEFAULT_HTTP_PORT);
           }
           CIMInstance instance =
               _buildInstancePGCIMXMLCommunicationMechanism(
                   objectPath,
                   namespaceType,
                   namespaceAccessProtocol,
                   _getHostAddress(hostName, namespaceAccessProtocol, httpPort, portNumberHttp));
         instances.append(instance);         instances.append(instance);
     }     }
  
     if (enableHttpsConnection)     if (enableHttpsConnection)
     {     {
         CDEBUG("building pgcimxmlinstances 2");          namespaceAccessProtocol = 3;
         CIMInstance instance = _buildInstancePGCIMXMLCommunicationMechanism(          namespaceType = "https";
                                                 "https", IPAddress,          Uint32 portNumberHttps;
                                                 includeQualifiers,          String httpsPort = configManager->getCurrentValue("httpsPort");
                                                 includeClassOrigin,          if (httpsPort == String::EMPTY)
                                                 propertyList);          {
               portNumberHttps = System::lookupPort(WBEM_HTTPS_SERVICE_NAME, WBEM_DEFAULT_HTTPS_PORT);
           }
           CIMInstance instance =
               _buildInstancePGCIMXMLCommunicationMechanism(
                   objectPath,
                   namespaceType,
                   namespaceAccessProtocol,
                   _getHostAddress(hostName, namespaceAccessProtocol, httpsPort, portNumberHttps));
   
         instances.append(instance);         instances.append(instance);
     }     }
   
   
     PEG_METHOD_EXIT();     PEG_METHOD_EXIT();
     return(instances);     return(instances);
 } }
   
 /*  Gets the value for the CIMObjectManager name.  This is a key /*  Gets the value for the CIMObjectManager name.  This is a key
     property with the following characteristics.     property with the following characteristics.
     1. It is persistent. This must be persistent through CIMOM     1. It is persistent. This must be persistent through CIMOM
Line 864 
Line 1086 
     @return Boolean true if already exists. False if     @return Boolean true if already exists. False if
     not initialized. Also returns with the current version set     not initialized. Also returns with the current version set
     into local parameter.     into local parameter.
     ATTN: Probably should get rid of the local parameter since  
     this is used so infrequently, waste of space.  
 */ */
 Boolean InteropProvider::_getInstanceFromRepositoryCIMObjectManager( Boolean InteropProvider::_getInstanceFromRepositoryCIMObjectManager(
                           const CIMObjectPath& objectPath,
                         CIMInstance& rtnInstance,                         CIMInstance& rtnInstance,
                         const Boolean includeQualifiers,                         const Boolean includeQualifiers,
                         const Boolean includeClassOrigin,                         const Boolean includeClassOrigin,
                         const CIMPropertyList& propertyList)                         const CIMPropertyList& propertyList)
 { {
     PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,     PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,
             "InteropProvider::_getInstanceCIMObjectManager");              "InteropProvider::_getInstanceFromRepositoryCIMObjectManager");
   
     // Try to get persistent instance from repository     // Try to get persistent instance from repository
     Array<CIMInstance> instances;     Array<CIMInstance> instances;
     try     try
     {     {
         instances = _repository->enumerateInstances(_operationNamespace,          instances = _repository->enumerateInstances(
                   objectPath.getNameSpace(),
                       CIM_OBJECTMANAGER_CLASSNAME, true, false, includeQualifiers,                       CIM_OBJECTMANAGER_CLASSNAME, true, false, includeQualifiers,
                         includeClassOrigin, propertyList);                         includeClassOrigin, propertyList);
  
         CDEBUG("_getInstancefrom... " << instances.size());  
         if (instances.size() >= 1)         if (instances.size() >= 1)
         {         {
             // set this instance into global variable.             // set this instance into global variable.
Line 895 
Line 1117 
             // but we will still continue to use the first entry.             // but we will still continue to use the first entry.
             if (instances.size() > 1)             if (instances.size() > 1)
             {             {
                 Logger::put(Logger::ERROR_LOG, System::CIMSERVER, Logger::INFORMATION,                  Logger::put(Logger::ERROR_LOG,
                     "Error. Multiple definitons of : $0", CIM_OBJECTMANAGER_CLASSNAME.getString());                      System::CIMSERVER, Logger::INFORMATION,
                       "Error. Multiple definitons of : $0",
                       CIM_OBJECTMANAGER_CLASSNAME.getString());
             }             }
             CDEBUG("getInstanceFromRepository returning true");  
             return(true);             return(true);
         }         }
         else         else
         {         {
             CDEBUG("getInstanceFromRepository returning false");  
             return(false);             return(false);
         }         }
     }     }
     catch(const CIMException&)     catch(const CIMException&)
     {     {
         Logger::put(Logger::ERROR_LOG, System::CIMSERVER, Logger::INFORMATION,         Logger::put(Logger::ERROR_LOG, System::CIMSERVER, Logger::INFORMATION,
             "Error. Cannot access $0 in repository", CIM_OBJECTMANAGER_CLASSNAME.getString());              "Error. Cannot access $0 in repository",
               CIM_OBJECTMANAGER_CLASSNAME.getString());
         PEG_METHOD_EXIT();         PEG_METHOD_EXIT();
         throw;         throw;
     }     }
     catch(const Exception&)     catch(const Exception&)
     {     {
         Logger::put(Logger::ERROR_LOG, System::CIMSERVER, Logger::INFORMATION,         Logger::put(Logger::ERROR_LOG, System::CIMSERVER, Logger::INFORMATION,
             "Error. Cannot access $0 in repository", CIM_OBJECTMANAGER_CLASSNAME.getString());              "Error. Cannot access $0 in repository",
               CIM_OBJECTMANAGER_CLASSNAME.getString());
         PEG_METHOD_EXIT();         PEG_METHOD_EXIT();
         throw;         throw;
     }     }
 } }
  
 /** build an instance of the CIM_ObjectManager class filling out  /** get an instance of the CIM_ObjectManager class filling out
     the required properties if one does not already exist in the     the required properties if one does not already exist in the
     repository. This function will either return an instance     repository. This function will either return an instance
     or throw an exception.     or throw an exception.
Line 935 
Line 1159 
         for this class.         for this class.
 */ */
 CIMInstance InteropProvider::_getInstanceCIMObjectManager( CIMInstance InteropProvider::_getInstanceCIMObjectManager(
                           const CIMObjectPath& objectPath,
                         const Boolean includeQualifiers,                         const Boolean includeQualifiers,
                         const Boolean includeClassOrigin,                         const Boolean includeClassOrigin,
                         const CIMPropertyList& propertyList)                         const CIMPropertyList& propertyList)
Line 944 
Line 1169 
  
     // Try to get the current object.  If true then it is already created.     // Try to get the current object.  If true then it is already created.
     CIMInstance instance;     CIMInstance instance;
     if (!_getInstanceFromRepositoryCIMObjectManager(instance, includeQualifiers,includeClassOrigin,propertyList))      if (!_getInstanceFromRepositoryCIMObjectManager(objectPath,
                   instance, includeQualifiers,includeClassOrigin,propertyList))
     {     {
         //         //
         // No instance in the repository. Build new instance and save it.         // No instance in the repository. Build new instance and save it.
         //         //
         CDEBUG("Creating New instance of CIMOBjectManager");          CIMClass targetClass;
         instance = _buildInstanceSkeleton(CIM_OBJECTMANAGER_CLASSNAME);          instance = _buildInstanceSkeleton(objectPath, CIM_OBJECTMANAGER_CLASSNAME,
                       targetClass);
  
         _fixInstanceCommonKeys(instance);         _fixInstanceCommonKeys(instance);
  
         _setPropertyValue(instance, CIM_NAMESPACE_PROPERTY_CREATIONCLASSNAME,CIM_OBJECTMANAGER_CLASSNAME.getString());          _setPropertyValue(instance, CIM_NAMESPACE_PROPERTY_CREATIONCLASSNAME,
         _setPropertyValue(instance, CIM_NAMESPACE_PROPERTY_NAME,buildObjectManagerName());                  CIM_OBJECTMANAGER_CLASSNAME.getString());
   
           _objectManagerName = buildObjectManagerName();
           _setPropertyValue(instance, CIM_NAMESPACE_PROPERTY_NAME,_objectManagerName);
         _setPropertyValue(instance, CIMName("ElementName"), String("Pegasus"));         _setPropertyValue(instance, CIMName("ElementName"), String("Pegasus"));
  
         //         //
         //Description property this object manager instance         //Description property this object manager instance
         // default is Pegasus CIM_Server Version.          // default is Pegasus CIM_Server Version. Get from
         // Provided undocumented option to get this from the environment.          // fields defined in PegasusVersion.
         // This should probably be removed or documented.          // TODO. Add as an alternative the capability to get this
         //          // from config parameters.
         String description;          // If PEGASUS_CIMOM_DESCRIPTION is non-zero length, use it.
         char * envDescription;          // Otherwise build form the components below.
         envDescription = getenv("PEGASUS_CIMOM_DESCRIPTION");          String descriptionStatus;
           String pegasusProductStatus(PEGASUS_PRODUCT_STATUS);
         description = (envDescription) ? envDescription :          if(pegasusProductStatus.size() > 0)
               descriptionStatus = " " + pegasusProductStatus;
   
           String description = (String(PEGASUS_CIMOM_DESCRIPTION).size() != 0) ?
                   String(PEGASUS_CIMOM_DESCRIPTION)
               :
                   String(PEGASUS_CIMOM_GENERIC_NAME) + " " +
             String(PEGASUS_PRODUCT_NAME) + " Version " +             String(PEGASUS_PRODUCT_NAME) + " Version " +
                 String(PEGASUS_PRODUCT_VERSION);                  String(PEGASUS_PRODUCT_VERSION) +
                   descriptionStatus;
  
         _setPropertyValue(instance, CIMName("Description"), description);         _setPropertyValue(instance, CIMName("Description"), description);
  
Line 981 
Line 1218 
  
         _setPropertyValue(instance, OM_GATHERSTATISTICALDATA, Boolean(gatherStatDataFlag));         _setPropertyValue(instance, OM_GATHERSTATISTICALDATA, Boolean(gatherStatDataFlag));
  
         // ATTN: This one is a problem KS rethink this.          // Set the statistics property into the Statisticaldata class so that
         // the following is a temporary hack to set the value of the statistics          // it can perform statistics gathering if necessary.
         // gathering function dynamically.  We simply get the correct value  
         // and call the internal method to set it each time this object is  
         // built.  
     #ifndef PEGASUS_DISABLE_PERFINST     #ifndef PEGASUS_DISABLE_PERFINST
         StatisticalData* sd = StatisticalData::current();         StatisticalData* sd = StatisticalData::current();
         sd->setCopyGSD(gatherStatDataFlag);         sd->setCopyGSD(gatherStatDataFlag);
Line 993 
Line 1227 
  
         // write instance to the repository         // write instance to the repository
         CIMObjectPath instancePath;         CIMObjectPath instancePath;
         // Add the instance path to this if necessary ATTN ATTN:  
         try         try
         {         {
             CDEBUG("Create Instance for CIM_ObjectManager");              instancePath = _repository->createInstance(objectPath.getNameSpace(),
             instancePath = _repository->createInstance(_operationNamespace,  
                            instance );                            instance );
         }         }
         catch(const CIMException&)         catch(const CIMException&)
         {         {
             // ATTN: KS generate log error if this not possible              // TODO ATTN: KS generate log error if this not possible
             PEG_METHOD_EXIT();             PEG_METHOD_EXIT();
             throw;             throw;
         }         }
Line 1014 
Line 1247 
         }         }
         instance.setPath(instancePath);         instance.setPath(instancePath);
     }     }
     instance.filter(includeQualifiers, includeClassOrigin, propertyList);  
     PEG_METHOD_EXIT();     PEG_METHOD_EXIT();
     return(instance);     return(instance);
 } }
  
   /** getObjectNamagerName returns the name property for this object manager
       return String name of this object manager.  This is a convience function
       to deliver only the name field from the CIM_ObjectManager object.
       If the object Manager has been created and the name saved in this
       provider, that name is returned.  Else it calls the function to
       get the instance of the Object Manager.
       @return String containing the persistent name property for this
       object manager
   
   */
   
   String InteropProvider::_getObjectManagerName()
   {
       if (_objectManagerName != String::EMPTY)
       {
           return _objectManagerName;
       }
       else
       {
           CIMObjectPath path;
           path.setNameSpace(PEGASUS_NAMESPACENAME_INTEROP);
           CIMInstance instance = _getInstanceCIMObjectManager(path, true, true, CIMPropertyList());
           // get the property name.
           String name = _getPropertyValue(instance, CIM_NAMESPACE_PROPERTY_NAME,
                                                   String::EMPTY);
           return name;
       }
   
   }
   
 /** Get the instances of CIM_Namespace. Gets all instances of the namespace from /** Get the instances of CIM_Namespace. Gets all instances of the namespace from
     the repository namespace management functions      the repository namespace management functions. Builds instances that
     Pegasus 2.4 - This now gets CIM_Namespace and its subclass PG_Namespace      match all of the request attributes.
 */ */
 Array<CIMInstance> InteropProvider::_getInstancesCIMNamespace(const Boolean& includeQualifiers,  Array<CIMInstance> InteropProvider::_getInstancesCIMNamespace(
                             const Boolean& includeClassOrigin,                              const CIMObjectPath& objectPath)
                             const CIMPropertyList& propertyList)  
 { {
     PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,     PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,
             "InteropProvider::_getInstancesCIMNamespace()");             "InteropProvider::_getInstancesCIMNamespace()");
  
     CDEBUG("_getinstancesPGNamespace");  
     Array<CIMNamespaceName> namespaceNames = _enumerateNameSpaces();     Array<CIMNamespaceName> namespaceNames = _enumerateNameSpaces();
     CDEBUG("_getInstancesCIMNamespace. count = " << namespaceNames.size());  
     Array<CIMInstance> instanceArray;     Array<CIMInstance> instanceArray;
  
     // We build instances of PG namespace since that is the leaf class      // Build instances of PG namespace since that is the leaf class
     for (Uint32 i = 0; i < namespaceNames.size(); i++)     for (Uint32 i = 0; i < namespaceNames.size(); i++)
     {     {
        instanceArray.append( _buildInstancePGNamespace(namespaceNames[i]));         instanceArray.append( _buildInstancePGNamespace(objectPath, namespaceNames[i]));
     }     }
     CDEBUG("Build this many PG_Namespace Instances. count= " << instanceArray.size());  
     PEG_METHOD_EXIT();     PEG_METHOD_EXIT();
     return(instanceArray);     return(instanceArray);
 } }
Line 1049 
Line 1308 
     for the instance required.     for the instance required.
     ATTN: Note that this is incorrect. We are supplying the namespace name and need to supply     ATTN: Note that this is incorrect. We are supplying the namespace name and need to supply
     the objectpath     the objectpath
     @param TBD      @param objectPath CIMObjectPath from request
       @param nameSpace CIMNamespaceName for instance to get
     @return CIMInstance with the found instance or CIMInstance() if nothing found.     @return CIMInstance with the found instance or CIMInstance() if nothing found.
 */ */
 CIMInstance InteropProvider::_getInstanceCIMNamespace(const CIMNamespaceName & nameSpace)  CIMInstance InteropProvider::_getInstanceCIMNamespace(const CIMObjectPath& objectPath)
 { {
     PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,     PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,
             "InteropProvider::_getInstancesCIMNamespace()");             "InteropProvider::_getInstancesCIMNamespace()");
  
     Array<CIMInstance> instances = _getInstancesCIMNamespace(true, true, CIMPropertyList());      Array<CIMInstance> instances = _getInstancesCIMNamespace(objectPath);
  
       CIMNamespaceName nameSpace = objectPath.getNameSpace();
     // search the instances for one with the name property value = input parameter.     // search the instances for one with the name property value = input parameter.
     for (Uint32 i = 0 ; i < instances.size() ; i++)     for (Uint32 i = 0 ; i < instances.size() ; i++)
     {     {
Line 1072 
Line 1333 
     CIMInstance nullInstance;     CIMInstance nullInstance;
     return(nullInstance);     return(nullInstance);
 } }
   /* build the full instances set of of the association class NamespacInManager.
  
 CIMObjectPath InteropProvider::_buildReference(const CIMInstance& instance, const CIMName& className)      NOTE: THe input object path is not really use at this point.
 {  */
     return(_buildObjectPath(_operationNamespace,className, instance));  Array<CIMInstance> InteropProvider::_buildInstancesNamespaceInManager(
 }                              const CIMObjectPath& objectPath)
   
 Array<CIMInstance> InteropProvider::_buildInstancesNamespaceInManager()  
 { {
     PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,     PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,
             "InteropProvider::_buildInstancesNamespaceInManager");             "InteropProvider::_buildInstancesNamespaceInManager");
  
     Array<CIMInstance> namespaceInstances = _getInstancesCIMNamespace(false,      Array<CIMInstance> namespaceInstances = _getInstancesCIMNamespace(objectPath);
                             false, CIMPropertyList());  
       CIMInstance instanceObjMgr = _getInstanceCIMObjectManager(objectPath,
           true, true, CIMPropertyList());
  
     CIMInstance instanceObjMgr = _getInstanceCIMObjectManager( true, true, CIMPropertyList());      CIMObjectPath refObjMgr = instanceObjMgr.getPath();
  
     CIMObjectPath refObjMgr = _buildReference(instanceObjMgr, CIM_OBJECTMANAGER_CLASSNAME);      refObjMgr.setHost(objectPath.getHost());
       refObjMgr.setNameSpace(objectPath.getNameSpace());
  
     Array<CIMInstance> assocInstances;     Array<CIMInstance> assocInstances;
       CIMClass targetClass;
  
       CIMInstance instanceskel = _buildInstanceSkeleton(objectPath,
           CIM_NAMESPACEINMANAGER_CLASSNAME,
                               targetClass);
       // Build and instance for each namespace instance.
     for (Uint32 i = 0 ; i < namespaceInstances.size() ; i++)     for (Uint32 i = 0 ; i < namespaceInstances.size() ; i++)
     {     {
         CIMInstance instance = _buildInstanceSkeleton(CIM_NAMESPACEINMANAGER_CLASSNAME);          CIMInstance instance = instanceskel.clone();
   
         _setPropertyValue(instance, CIMName("Antecedent"), refObjMgr);         _setPropertyValue(instance, CIMName("Antecedent"), refObjMgr);
         //ATTNATTN: this is weak qualifier.  
         _setPropertyValue(instance, CIMName("Dependent"), _buildReference(namespaceInstances[i],          CIMObjectPath temp = namespaceInstances[i].getPath();
                                                             CIM_NAMESPACEINMANAGER_CLASSNAME));          temp.setHost(objectPath.getHost());
           temp.setNameSpace(objectPath.getNameSpace());
           _setPropertyValue(instance, CIMName("Dependent"), temp);
   
           instance.setPath(instance.buildPath(targetClass));
         assocInstances.append(instance);         assocInstances.append(instance);
     }     }
   
     PEG_METHOD_EXIT();     PEG_METHOD_EXIT();
     return(assocInstances);     return(assocInstances);
 } }
   /* build the instances of the defined association.
 Array<CIMInstance> InteropProvider::_buildInstancesCommMechanismForManager()  */
   Array<CIMInstance> InteropProvider::_buildInstancesCommMechanismForManager(
       const CIMObjectPath& objectPath)
 { {
     PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,     PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,
             "InteropProvider::_buildInstancesCommMechanismForManager");             "InteropProvider::_buildInstancesCommMechanismForManager");
  
     Array<CIMInstance> commInstances = _buildInstancesPGCIMXMLCommunicationMechanism(true,      Array<CIMInstance> commInstances = _buildInstancesPGCIMXMLCommunicationMechanism(
          true, CIMPropertyList());           objectPath);
  
     CIMInstance instanceObjMgr = _getInstanceCIMObjectManager( true, true, CIMPropertyList());      CIMInstance instanceObjMgr = _getInstanceCIMObjectManager(objectPath,
           true, true, CIMPropertyList());
  
     CIMObjectPath refObjMgr = _buildReference(instanceObjMgr, CIM_OBJECTMANAGER_CLASSNAME);      CIMObjectPath refObjMgr = instanceObjMgr.getPath();
     Array<CIMInstance> assocInstances;  
  
       Array<CIMInstance> assocInstances;
       CIMClass targetClass;
       CIMInstance instanceskel = _buildInstanceSkeleton(objectPath,
           CIM_NAMESPACEINMANAGER_CLASSNAME, targetClass);
     for (Uint32 i = 0 ; i < commInstances.size() ; i++)     for (Uint32 i = 0 ; i < commInstances.size() ; i++)
     {     {
           CIMInstance instance = instanceskel.clone();
         CIMInstance instance = _buildInstanceSkeleton(CIM_COMMMECHANISMFORMANAGER_CLASSNAME);  
  
         _setPropertyValue(instance,CIMName("Antecedent"), refObjMgr);         _setPropertyValue(instance,CIMName("Antecedent"), refObjMgr);
         //ATTNATTN: this is weak qualifier.  
         _setPropertyValue(instance,CIMName("Dependent"), _buildReference(commInstances[i],CIM_COMMMECHANISMFORMANAGER_CLASSNAME));          _setPropertyValue(instance, CIMName("Dependent"), commInstances[i].getPath());
   
           instance.setPath(instance.buildPath(targetClass));
         assocInstances.append(instance);         assocInstances.append(instance);
     }     }
  
Line 1138 
Line 1415 
 /* generate one instance of the CIM_Namespace class with the /* generate one instance of the CIM_Namespace class with the
    properties    properties
    NOTE: CIM 2.4 - Changed to build PG namespace    NOTE: CIM 2.4 - Changed to build PG namespace
      @param objectPath
    @param namespace name to put into the class    @param namespace name to put into the class
    @exceptions - exceptions carried forward from create instance    @exceptions - exceptions carried forward from create instance
    and addProperty.    and addProperty.
 */ */
 CIMInstance InteropProvider::_buildInstancePGNamespace(const CIMNamespaceName & nameSpace)  CIMInstance InteropProvider::_buildInstancePGNamespace(const CIMObjectPath& objectPath,
           CIMNamespaceName& nameSpace)
 { {
     PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,     PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,
             "InteropProvider::_buildInstancePGNamespace");             "InteropProvider::_buildInstancePGNamespace");
  
     // ATTN: KS need to get the real objectManager name from elsewhere.  the only place     // ATTN: KS need to get the real objectManager name from elsewhere.  the only place
     // this exists is through the objectmanager object.     // this exists is through the objectmanager object.
     // ATTN: Should we be saving the objectmanager name somewhere internally either in      String ObjectManagerName = _getObjectManagerName();
     // interop or more generally somewhere within the system for common access.  
     String ObjectManagerName = "ObjectManagerNameValue";  
  
     CIMInstance instance = _buildInstanceSkeleton(PG_NAMESPACE_CLASSNAME);      CIMClass targetClass;
       CIMInstance instance = _buildInstanceSkeleton(objectPath, PG_NAMESPACE_CLASSNAME,
                                                     targetClass);
  
     _fixInstanceCommonKeys(instance);     _fixInstanceCommonKeys(instance);
  
Line 1208 
Line 1487 
           {           {
               PEG_METHOD_EXIT();               PEG_METHOD_EXIT();
               // This is poor exception since it reflects internal error. Do error log               // This is poor exception since it reflects internal error. Do error log
               throw PEGASUS_CIM_EXCEPTION (CIM_ERR_NOT_SUPPORTED,                throw CIMNotSupportedException(
                   "Namespace attribute rtnd error for key " + key + "expected " +                   "Namespace attribute rtnd error for key " + key + "expected " +
                    nameSpace.getString()+ value + " in " + String(thisProvider));                    nameSpace.getString()+ value + " in " + String(thisProvider));
           }           }
Line 1232 
Line 1511 
     _setPropertyValue(instance, PG_NAMESPACE_PROPERTY_PARENTNAMESPACE, parent);     _setPropertyValue(instance, PG_NAMESPACE_PROPERTY_PARENTNAMESPACE, parent);
         _setPropertyValue(instance, PG_NAMESPACE_PROPERTY_NAME, name);         _setPropertyValue(instance, PG_NAMESPACE_PROPERTY_NAME, name);
  
       instance.setPath(instance.buildPath(targetClass));
     PEG_METHOD_EXIT();     PEG_METHOD_EXIT();
     return(instance);     return(instance);
 } }
   
 void _validateCIMNamespaceKeys(const CIMObjectPath& objectPath) void _validateCIMNamespaceKeys(const CIMObjectPath& objectPath)
 { {
     PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,     PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,
Line 1296 
Line 1577 
     }     }
     PEG_METHOD_EXIT();     PEG_METHOD_EXIT();
 } }
   
 /** completes a property in the defined instance either /** completes a property in the defined instance either
     by adding the complete property if it does not exist     by adding the complete property if it does not exist
     or by adding the value if the property does exist.     or by adding the value if the property does exist.
Line 1327 
Line 1607 
         }         }
         else         else
         {         {
             //  
             _setPropertyValue(instance, propertyName, value);             _setPropertyValue(instance, propertyName, value);
         }         }
     }     }
Line 1337 
Line 1616 
 } }
 Boolean _completeCIMNamespaceKeys(CIMInstance& instance) Boolean _completeCIMNamespaceKeys(CIMInstance& instance)
 { {
   
     PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,     PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,
             "InteropProvider::_completeCIMNamespaceKeys");             "InteropProvider::_completeCIMNamespaceKeys");
  
Line 1348 
Line 1626 
                 CIM_NAMESPACE_PROPERTY_SYSTEMCREATIONCLASSNAME,                 CIM_NAMESPACE_PROPERTY_SYSTEMCREATIONCLASSNAME,
                 System::getSystemCreationClassName ()))                 System::getSystemCreationClassName ()))
     {     {
   
         propertyName = CIM_NAMESPACE_PROPERTY_SYSTEMCREATIONCLASSNAME;         propertyName = CIM_NAMESPACE_PROPERTY_SYSTEMCREATIONCLASSNAME;
         valid = false;         valid = false;
     }     }
Line 1475 
Line 1752 
 /** builds complete object path from instance and classinfo by building the full path /** builds complete object path from instance and classinfo by building the full path
     with host and namespace names included.     with host and namespace names included.
 */ */
 CIMObjectPath InteropProvider::_buildObjectPath(const CIMNamespaceName& name,  CIMObjectPath InteropProvider::_buildObjectPath(const CIMObjectPath& objectPath,
                                                 const CIMName& className,                                                 const CIMName& className,
                                                 const CIMInstance& instance)                                                 const CIMInstance& instance)
 { {
     PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,     PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,
             "InteropProvider::_buildObjectPath");             "InteropProvider::_buildObjectPath");
  
     CIMObjectPath objectPath;      CIMObjectPath rtnObjectPath;
     objectPath = _buildInstancePath(name,className,instance);      rtnObjectPath = _buildInstancePath(objectPath,className,instance);
  
     objectPath.setHost(System::getHostName());      rtnObjectPath.setHost(objectPath.getHost());
  
     objectPath.setNameSpace(name);      rtnObjectPath.setNameSpace(objectPath.getNameSpace());
  
     PEG_METHOD_EXIT();     PEG_METHOD_EXIT();
     return(objectPath);      return(rtnObjectPath);
 } }
  
 /* Given a class and instance build the instance path for a /* Given a class and instance build the instance path for a
Line 1501 
Line 1778 
    @exceptions - Passes repository exceptions.    @exceptions - Passes repository exceptions.
 */ */
  
 CIMObjectPath InteropProvider::_buildInstancePath(const CIMNamespaceName& name,  CIMObjectPath InteropProvider::_buildInstancePath(const CIMObjectPath& objectPath,
                                            const CIMName& className,                                            const CIMName& className,
                                            const CIMInstance& instance)                                            const CIMInstance& instance)
 { {
     PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,     PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,
             "InteropProvider::_buildInstancePath");             "InteropProvider::_buildInstancePath");
  
     // get the class CIM_Namespace class to use in building path      // get the class  to use in building path
     // Exception out if Class does not exist in this namespace      // Exception if Class does not exist in this namespace
     CIMClass thisClass = _getClass(name, className);      CIMClass thisClass = _getClass(objectPath, className);
  
     CIMObjectPath ref = instance.buildPath(thisClass);     CIMObjectPath ref = instance.buildPath(thisClass);
  
Line 1560 
Line 1837 
     String name;     String name;
     propertyValue.get(name);     propertyValue.get(name);
     return(name);     return(name);
     //ATTN: KS Returns String whereas below returns CIMNamespaceName.  
 } }
  
   /** Test for valid CIMReferences from an association instance. If there is a role
       property, tests if there is a match for this role and the target object.
       Confirms that this role and this reference exist in the target instance.
   
       @param target - The target path for the association. Localization assumed.
       @param instance - The association class instance we are searching for references
       @param role - The role we require. I there is no role, this is String::EMPTY
       @return - returns Boolean true if target is found in a reference that is
       the same role
    */
   Boolean _isInstanceValidReference(const CIMObjectPath& target,
                                     const CIMInstance& instance,
                                     const String& role)
   {
       // Test if role parameter is valid property.
       Uint32 pos;
       if (role != String::EMPTY)
       {
           // Test if property with this role exists.
           if ((pos = instance.findProperty(role)) == PEG_NOT_FOUND)
               throw CIMException(CIM_ERR_INVALID_PARAMETER);
   
            // Check to be sure this is a reference property
            // This test may not be necessary. Combine it into the loop.
            if (instance.getProperty(pos).getType() != CIMTYPE_REFERENCE)
                throw CIMException(CIM_ERR_INVALID_PARAMETER);
       }
       //Search instance for all reference properties
       for (Uint32 j = 0; j < instance.getPropertyCount() ; j++)
       {
           const CIMConstProperty p = instance.getProperty(j);
           if (p.getType() == CIMTYPE_REFERENCE)
           {
               // If there is no role or the role is the same as this property name
               CIMValue v = p.getValue();
               CIMObjectPath path;
               v.get(path);
   
               // if no role or role ==this role and target = this path, rtn true.
               if ((role == String::EMPTY) || (CIMName(role) == p.getName()))
               {
                   // and if target is identical to reference path
                   if (target.identical(path))
                       return(true);
               }
           }
       }
       return( false );
   }
   /** Filters the input of instances (which contain path info)
       using the assocClassName, assocRole, ResultClassName and
       resultRole. Removes any instances from the list that
       do not match the filters.
       @instances Array<CIMInstance to filter.
       @
    * TODO - Shouldn't we remove rather than copy??? faster.
    * TODO - why extra check for no resultClass??
   */
   Array<CIMObject> _filterReferenceInstances(Array<CIMInstance>& instances,
                         const CIMObjectPath& targetobjectName,
                         const CIMName& resultClass,
                         const String& resultRole)
   {
       PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,
               "_filterReferenceInstances()");
   
       CIMObjectPath targetReference = CIMObjectPath(
                               String(),
                               CIMNamespaceName(),
                               targetobjectName.getClassName(),
                               targetobjectName.getKeyBindings());
       Array<CIMObject> rtnObjects;
       for (Uint32 i = 0 ; i < instances.size() ; i++)
       {
           if (resultClass.isNull() || resultClass.equal(instances[i].getClassName()))
           {
               // if this association instance has this role in targetReference, true
               if (_isInstanceValidReference(targetobjectName, instances[i], resultRole))
                   {
                       rtnObjects.append(instances[i]);
                   }
           }
       }
       PEG_METHOD_EXIT();
       return( rtnObjects );
   }
 //*************************************************************************** //***************************************************************************
 //  The following section is the Instance Operation processors //  The following section is the Instance Operation processors
 //*************************************************************************** //***************************************************************************
Line 1576 
Line 1938 
     {     {
         PEG_METHOD_ENTER(TRC_CONTROLPROVIDER, "InteropProvider::createInstance()");         PEG_METHOD_ENTER(TRC_CONTROLPROVIDER, "InteropProvider::createInstance()");
  
           AutoMutex autoMut(changeControlMutex);
   
         Tracer::trace(TRC_CONTROLPROVIDER, Tracer::LEVEL4,         Tracer::trace(TRC_CONTROLPROVIDER, Tracer::LEVEL4,
             "%s createInstance. InstanceReference= %s",             "%s createInstance. InstanceReference= %s",
             thisProvider,             thisProvider,
             (const char *) instanceReference.toString().getCString());             (const char *) instanceReference.toString().getCString());
  
         handler.processing();          // test for legal namespace for this provider. Exception if not
         CIMNamespaceName newNamespaceName;          _isNamespaceAllowed(instanceReference);
  
         CDEBUG("CreateInstance " << instanceReference.toString());          handler.processing();
         // operation namespace needed internally to get class.  
         _operationNamespace = instanceReference.getNameSpace();  
  
         // Verify that ClassName is correct and get value         // Verify that ClassName is correct and get value
         targetClass classEnum  = _verifyValidClassInput(instanceReference.getClassName());         targetClass classEnum  = _verifyValidClassInput(instanceReference.getClassName());
Line 1594 
Line 1956 
         String userName = _validateUserID(context);         String userName = _validateUserID(context);
         CIMObjectPath newInstanceReference;         CIMObjectPath newInstanceReference;
  
         if ((classEnum == CIM_OBJECTMANAGER) ||          CIMNamespaceName newNamespaceName;
             (classEnum == PG_CIMXMLCOMMUNICATIONMECHANISM))          CIMInstance localInstance;
             throw CIMNotSupportedException("InteropProvider, Create Not allowed");          CIMObjectPath localInstanceReference = instanceReference;
   
           if (classEnum == CIM_NAMESPACE)
           {
               // create instance of PG_Namespace and continue.
               CIMInstance localPGInstance(PG_NAMESPACE_CLASSNAME);
               for (Uint32 i = 0 ; i < myInstance.getQualifierCount() ; i++)
               {
                   localInstance.addQualifier(myInstance.getQualifier(i).clone());
               }
  
               for (Uint32 i = 0 ; i < myInstance.getPropertyCount() ; i++)
               {
                   localInstance.addProperty(myInstance.getProperty(i).clone());
               }
               //TODO set path in instance???
               localInstanceReference.setNameSpace(PEGASUS_NAMESPACENAME_INTEROP);
               // set classEnum so next if interprets this as PG_Namespace
               classEnum = PG_NAMESPACE;
           }
         if (classEnum == PG_NAMESPACE)         if (classEnum == PG_NAMESPACE)
         {         {
 #ifdef PEGASUS_OS_OS400 #ifdef PEGASUS_OS_OS400
             MessageLoaderParms mparms("ControlProviders.InteropProvider.CREATE_INSTANCE_NOT_ALLOWED",              MessageLoaderParms mparms(
                   "ControlProviders.InteropProvider.CREATE_INSTANCE_NOT_ALLOWED",
                                       "Create instance operation not allowed by Interop Provider for class $0.",                                       "Create instance operation not allowed by Interop Provider for class $0.",
                                       PG_NAMESPACE_CLASSNAME.getString());                                       PG_NAMESPACE_CLASSNAME.getString());
             throw CIMNotSupportedException(mparms);             throw CIMNotSupportedException(mparms);
 #else #else
             // Create local instance to complete any keys.              // Create local instance to complete any keys if not created above.
             CIMInstance localInstance = myInstance.clone();              if (localInstance.isUninitialized())
               {
                   localInstance = myInstance.clone();
               }
  
             _completeCIMNamespaceKeys(localInstance);             _completeCIMNamespaceKeys(localInstance);
             // Validate that keys are as required. Does its own exception.             // Validate that keys are as required. Does its own exception.
             newNamespaceName = _getKeyValue(myInstance, CIM_NAMESPACE_PROPERTY_NAME);             newNamespaceName = _getKeyValue(myInstance, CIM_NAMESPACE_PROPERTY_NAME);
  
             newInstanceReference = _buildInstancePath(_operationNamespace,              newInstanceReference = _buildInstancePath(localInstanceReference,
                                         PG_NAMESPACE_CLASSNAME, localInstance);                                         PG_NAMESPACE_CLASSNAME, localInstance);
 #endif #endif
         }         }
  
           else if ((classEnum == CIM_OBJECTMANAGER) ||
               (classEnum == PG_CIMXMLCOMMUNICATIONMECHANISM))
           {
               PEG_METHOD_EXIT();
               throw CIMNotSupportedException("InteropProvider, Create Not allowed");
           }
   
         else   // Invalid class for the create functions.         else   // Invalid class for the create functions.
         {         {
             PEGASUS_ASSERT(false);             PEGASUS_ASSERT(false);
Line 1677 
Line 2068 
                 "Namespace = " + newNamespaceName.getString() +                 "Namespace = " + newNamespaceName.getString() +
                     " successfully created.");                     " successfully created.");
             Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE,             Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE,
                 "Create Namespace: Shareable = $0, Updates allows: $1,  Parent: $2",                  "Create Namespace: Shareable = $0, Updates allowed: $1,  Parent: $2",
                 newNamespaceName.getString(), shareable? "true" : "false", shareable? "true" : "false", parent );                  newNamespaceName.getString(), shareable?
                           "true" : "false", shareable? "true" : "false", parent );
  
         }         }
         catch(const CIMException&)         catch(const CIMException&)
Line 1713 
Line 2105 
     {     {
         PEG_METHOD_ENTER(TRC_CONTROLPROVIDER, "InteropProvider::deleteInstance");         PEG_METHOD_ENTER(TRC_CONTROLPROVIDER, "InteropProvider::deleteInstance");
  
           AutoMutex autoMut(changeControlMutex);
   
         Tracer::trace(TRC_CONTROLPROVIDER, Tracer::LEVEL4,         Tracer::trace(TRC_CONTROLPROVIDER, Tracer::LEVEL4,
             "%s deleteInstance. instanceName= %s",             "%s deleteInstance. instanceName= %s",
             thisProvider,             thisProvider,
             (const char *) instanceName.toString().getCString());             (const char *) instanceName.toString().getCString());
  
         _operationNamespace = instanceName.getNameSpace();          // test for legal namespace for this provider. Exception if not
           _isNamespaceAllowed(instanceName);
   
         handler.processing();         handler.processing();
         // Verify that ClassName is correct and get value         // Verify that ClassName is correct and get value
         targetClass classEnum  = _verifyValidClassInput(instanceName.getClassName());         targetClass classEnum  = _verifyValidClassInput(instanceName.getClassName());
Line 1730 
Line 2126 
         {         {
             try             try
             {             {
                 _repository->deleteInstance(_operationNamespace,instanceName);                  _repository->deleteInstance(instanceName.getNameSpace(),instanceName);
             }             }
             catch(const CIMException&)             catch(const CIMException&)
             {             {
Line 1742 
Line 2138 
         {         {
             CIMNamespaceName deleteNamespaceName;             CIMNamespaceName deleteNamespaceName;
 #ifdef PEGASUS_OS_OS400 #ifdef PEGASUS_OS_OS400
             MessageLoaderParms mparms("ControlProviders.InteropProvider.DELETE_INSTANCE_NOT_ALLOWED",              MessageLoaderParms mparms(
                   "ControlProviders.InteropProvider.DELETE_INSTANCE_NOT_ALLOWED",
                                       "Delete instance operation not allowed by Interop Provider for class $0.",                                       "Delete instance operation not allowed by Interop Provider for class $0.",
                                       PG_NAMESPACE_CLASSNAME.getString());                                       PG_NAMESPACE_CLASSNAME.getString());
             throw CIMNotSupportedException(mparms);             throw CIMNotSupportedException(mparms);
Line 1776 
Line 2173 
             throw CIMNotSupportedException("Delete Not allowed for " + instanceName.getClassName().getString());             throw CIMNotSupportedException("Delete Not allowed for " + instanceName.getClassName().getString());
         }         }
  
         handler.processing();  
   
         handler.complete();         handler.complete();
  
         PEG_METHOD_EXIT();         PEG_METHOD_EXIT();
         return ;         return ;
     }     }
  
 //***************************************************************************  /** Local version of getInstance to be used by other functions in the
 //                getInstance      the provider.  Returns a single instance.  Note that it always
 //***************************************************************************      returns an instance.  If none was found, it is unitinialitized.
 void InteropProvider::getInstance(  */
   CIMInstance InteropProvider::localGetInstance(
     const OperationContext & context,     const OperationContext & context,
     const CIMObjectPath & instanceName,     const CIMObjectPath & instanceName,
     const Boolean includeQualifiers,     const Boolean includeQualifiers,
     const Boolean includeClassOrigin,     const Boolean includeClassOrigin,
     const CIMPropertyList & propertyList,      const CIMPropertyList & propertyList)
     InstanceResponseHandler & handler)  
     {     {
         PEG_METHOD_ENTER(TRC_CONTROLPROVIDER, "InteropProvider::getInstance");      PEG_METHOD_ENTER(TRC_CONTROLPROVIDER, "InteropProvider::localGetInstance");
  
         Tracer::trace(TRC_CONTROLPROVIDER, Tracer::LEVEL4,         Tracer::trace(TRC_CONTROLPROVIDER, Tracer::LEVEL4,
             "%s getInstance. instanceName= %s , includeQualifiers= %s, includeClassOrigin= %s, PropertyList= %s",             "%s getInstance. instanceName= %s , includeQualifiers= %s, includeClassOrigin= %s, PropertyList= %s",
Line 1804 
Line 2199 
             (const char *)_showBool(includeQualifiers).getCString(),             (const char *)_showBool(includeQualifiers).getCString(),
             (const char*) _showBool(includeClassOrigin).getCString(),             (const char*) _showBool(includeClassOrigin).getCString(),
             (const char *)_showPropertyList(propertyList).getCString());             (const char *)_showPropertyList(propertyList).getCString());
   
         // Verify that ClassName is correct and get value         // Verify that ClassName is correct and get value
         targetClass classEnum  = _verifyValidClassInput(instanceName.getClassName());         targetClass classEnum  = _verifyValidClassInput(instanceName.getClassName());
  
         _operationNamespace = instanceName.getNameSpace();  
         String userName = _validateUserID(context);         String userName = _validateUserID(context);
         // begin processing the request  
         handler.processing();  
         if (classEnum == CIM_OBJECTMANAGER)  
         {  
             CIMInstance instance = _getInstanceCIMObjectManager(includeQualifiers,  
                                         includeClassOrigin, propertyList);  
             handler.deliver(instance);  
             handler.complete();  
             PEG_METHOD_EXIT();  
             return;  
         }  
  
         if (classEnum == PG_CIMXMLCOMMUNICATIONMECHANISM)      // create reference from host, namespace, class components of
         {      // instance name
             // ATTN: test for correct instance KS: Priority 1  
             Array <CIMInstance> instances = _buildInstancesPGCIMXMLCommunicationMechanism(  
                                     includeQualifiers,  
                                     includeClassOrigin, propertyList);  
             handler.deliver(instances[0]);  
             handler.complete();  
             PEG_METHOD_EXIT();  
             return;  
         }  
  
         if (classEnum == CIM_NAMESPACEINMANAGER)      CIMObjectPath ref;
         {      ref.setHost(instanceName.getHost());
             handler.complete();      ref.setClassName(instanceName.getClassName());
             PEG_METHOD_EXIT();      ref.setNameSpace(instanceName.getNameSpace());
             return;  
         }      // 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,
               includeQualifiers,
               includeClassOrigin,
               propertyList);
  
         // Get List of namespaces      // deliver a single instance if found.
         Array<CIMNamespaceName> namespaceNames;      CIMInstance rtnInstance;
         namespaceNames = _enumerateNameSpaces();  
         CIMInstance instance;  
  
         if (classEnum == PG_NAMESPACE)      for (Uint32 i = 0 ; i < instances.size() ; i++)
         {         {
             // Not clear what we have to take into account here.         if (instanceName == instances[i].getPath())
             // get the namespace from the name value.  
             // should check the other keys to see if valid.  
             CIMNamespaceName namespaceName;  
             namespaceName = _getKeyValue(instanceName, CIM_NAMESPACE_PROPERTY_NAME);  
   
             // ATTN: Why this CIMNamespaceName parentNamespaceName = instanceName.getNameSpace();  
             if (!Contains(namespaceNames, namespaceName))  
             {             {
                 throw CIMObjectNotFoundException("Namespace does not exist: "             /* DEBUG SUPPORT
                                      + namespaceName.getString());             Tracer::trace(TRC_CONTROLPROVIDER, Tracer::LEVEL4,
             }                 "%s getInstance return instance number %u\npath: %s\n %s\n",thisProvider, i,
             PEG_TRACE_STRING(TRC_CONTROLPROVIDER, Tracer::LEVEL4,                 (instances[i].getPath().toString().getCString()),
                "Namespace = " + namespaceName.getString() + " successfully found.");                 ( ( CIMObject) instances[i]).toString().getCString());
              *****/
             instance = _getInstanceCIMNamespace(namespaceName);            rtnInstance = instances[i];
             break;
             // TODO Add test for duplicates somewhere.
         }         }
         else  // processing for __Namespace  
         {  
             PEGASUS_ASSERT(false);  
         }         }
   
        handler.deliver(instance);  
   
        // complete processing the request  
        handler.complete();  
   
        PEG_METHOD_EXIT();        PEG_METHOD_EXIT();
        return ;      return(rtnInstance);
     }     }
   
 //*************************************************************************** //***************************************************************************
 //                enumerateInstances  //                getInstance
 //*************************************************************************** //***************************************************************************
 void InteropProvider::enumerateInstances(  void InteropProvider::getInstance(
     const OperationContext & context,     const OperationContext & context,
     const CIMObjectPath & ref,      const CIMObjectPath & instanceName,
     const Boolean includeQualifiers,     const Boolean includeQualifiers,
     const Boolean includeClassOrigin,     const Boolean includeClassOrigin,
     const CIMPropertyList& propertyList,     const CIMPropertyList& propertyList,
     InstanceResponseHandler & handler)     InstanceResponseHandler & handler)
     {     {
         PEG_METHOD_ENTER(TRC_CONTROLPROVIDER, "InteropProvider::enumerateInstances()");      // test for legal namespace for this provider. Exception if not
       _isNamespaceAllowed(instanceName);
   
       handler.processing();
   
       CIMInstance myInstance = localGetInstance(
                       context,
                       instanceName,
                       includeQualifiers,
                       includeClassOrigin,
                       propertyList);
   
       if (!myInstance.isUninitialized())
           handler.deliver(myInstance);
       else
           throw CIMObjectNotFoundException(instanceName.toString());
   
       handler.complete();
   }
   
   //*****************************************************************************************
   //   localEnumerateInstances
   //   EnumerateInstances equivalent to external but returns instances
   //   Used by other operations to build instances for processing
   //   Note that this delivers instances as a group rather than incrementally.
   //    This technique should only be used for small groups of instances.
   //****************************************************************************************
   
   Array<CIMInstance> InteropProvider::localEnumerateInstances(
       const OperationContext & context,
       const CIMObjectPath & ref,
       const Boolean includeQualifiers,
       const Boolean includeClassOrigin,
       const CIMPropertyList& propertyList)
       {
           PEG_METHOD_ENTER(TRC_CONTROLPROVIDER, "InteropProvider::localEnumerateInstances()");
  
         Tracer::trace(TRC_CONTROLPROVIDER, Tracer::LEVEL4,         Tracer::trace(TRC_CONTROLPROVIDER, Tracer::LEVEL4,
             "%s enumerateInstances. ref= %s, includeQualifiers= %s, includeClassOrigin= %s, PropertyList= %s",              "%s enumerateInstances. referenc= %s , includeQualifiers= %s, includeClassOrigin= %s, PropertyList= %s",
             thisProvider,             thisProvider,
             (const char *) ref.toString().getCString(),             (const char *) ref.toString().getCString(),
             (const char *) _showBool(includeQualifiers).getCString(),             (const char *) _showBool(includeQualifiers).getCString(),
Line 1902 
Line 2304 
         // Verify that ClassName is correct and get value         // Verify that ClassName is correct and get value
         targetClass classEnum  = _verifyValidClassInput(ref.getClassName());         targetClass classEnum  = _verifyValidClassInput(ref.getClassName());
  
         // operation namespace needed internally to get class.          String userName = _validateUserID(context);
         _operationNamespace = ref.getNameSpace();  
         CDEBUG("Namespace = " << _operationNamespace.getString());  
         //String userName = _validateUserID(context);  
  
         // The following 3 classes deliver a single instance because          Array<CIMInstance> instances;
         // that is all there is today.  
         if (classEnum == CIM_OBJECTMANAGER)         if (classEnum == CIM_OBJECTMANAGER)
         {         {
             CIMInstance instance = _getInstanceCIMObjectManager(includeQualifiers,              CIMInstance instance = _getInstanceCIMObjectManager(
                                       ref,
                                       includeQualifiers,
                                     includeClassOrigin,                                     includeClassOrigin,
                                     propertyList);                                     propertyList);
               instances.append(instance);
             //Array<Sint8> tmp;  
             ///XmlWriter::appendInstanceElement(tmp, instance);  
             //tmp.append('\0');  
             //Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE,  
             //        "Instance - XML content: $0", tmp.getData());  
             ///XmlWriter::printInstanceElement(instance);  
             handler.deliver(instance);  
             //handler.complete();  
             //PEG_METHOD_EXIT();  
             //return;  
         }         }
  
         else if (classEnum == PG_CIMXMLCOMMUNICATIONMECHANISM)         else if (classEnum == PG_CIMXMLCOMMUNICATIONMECHANISM)
         {         {
             Array<CIMInstance> instances = _buildInstancesPGCIMXMLCommunicationMechanism(includeQualifiers,              instances = _buildInstancesPGCIMXMLCommunicationMechanism(ref);
                                     includeClassOrigin, propertyList);  
             CDEBUG("Build instances of PGCIMXML. count= " << instances.size());  
             handler.deliver(instances);  
             //handler.complete();  
             //PEG_METHOD_EXIT();  
             //return;  
         }         }
  
         else if (classEnum == CIM_NAMESPACEINMANAGER)         else if (classEnum == CIM_NAMESPACEINMANAGER)
         {         {
             //handler.complete();              instances = _buildInstancesNamespaceInManager(ref);
             //PEG_METHOD_EXIT();  
             //return;  
         }         }
  
         else if (classEnum == PG_NAMESPACE)          else if (classEnum == CIM_COMMMECHANISMFORMANAGERINST)
         {         {
             Array<CIMInstance> instances = _getInstancesCIMNamespace(includeQualifiers,              instances = _buildInstancesCommMechanismForManager(ref);
                                     includeClassOrigin, propertyList);          }
  
             handler.deliver(instances);          else if (classEnum == PG_NAMESPACE)
             //handler.complete();          {
             //PEG_METHOD_EXIT();              instances = _getInstancesCIMNamespace(ref);
             //return;          }
           else if (classEnum == CIM_NAMESPACE)
           {
               // returns nothing if CIM_Namespace
               // This class used only to create. Enumerates
               // automatically get the hiearchy.
         }         }
         else         else
         {         {
               PEG_METHOD_EXIT();
             throw CIMNotSupportedException             throw CIMNotSupportedException
                 ("EnumerateInstance for " + ref.getClassName().getString() + " not supported");                  (ref.getClassName().getString() + " not supported by Interop Provider enumerate");
           }
   
           // Filter and deliver the resulting instances
           for (Uint32 i = 0 ; i < instances.size() ; i++)
           {
               _finishInstance(instances[i],
                               ref,
                               includeQualifiers,
                               includeClassOrigin,
                               propertyList );
   
               /* Debug Trace of the Instances generated
               Tracer::trace(TRC_CONTROLPROVIDER, Tracer::LEVEL4,
                   "%s enumerateInstances return instance number %u\npath: %s\n %s\n",thisProvider, i,
                   (instances[i].getPath().toString().getCString()),
                   ( ( CIMObject) instances[i]).toString().getCString());
               ****/
   
           }
           return(instances);
           PEG_METHOD_EXIT();
         }         }
  
   //***************************************************************************
   //                EnumerateInstances - External Operation call
   //    Delivers instances back through response handler.
   //***************************************************************************
   void InteropProvider::enumerateInstances(
       const OperationContext & context,
       const CIMObjectPath & ref,
       const Boolean includeQualifiers,
       const Boolean includeClassOrigin,
       const CIMPropertyList& propertyList,
       InstanceResponseHandler & handler)
       {
           PEG_METHOD_ENTER(TRC_CONTROLPROVIDER, "InteropProvider::enumerateInstances()");
   
           // test for legal namespace for this provider. Exception if not
           _isNamespaceAllowed(ref);
   
           handler.processing();
   
           // Call the internal enumerateInstances to generate instances of defined
           // class.  This expects the instances to be returned complete including
           // complete path.
           Array<CIMInstance> instances =  localEnumerateInstances(
                   context,
                   ref,
                   includeQualifiers,
                   includeClassOrigin,
                   propertyList);
   
           handler.deliver(instances);
         handler.complete();         handler.complete();
  
         PEG_METHOD_EXIT();         PEG_METHOD_EXIT();
     }     }
  
 void InteropProvider::modifyObjectManagerInstance(const OperationContext & context,  /** Determies if an instance modification is to be allowed. This includes
       tests to determine the validity of the modified instance, the property
       list provided, if qualifier modification was requested.
       @param context
       @param instanceReference CIMObjectPath defining the path of the instance
       to be modified.
       @param modifiedIns CIMInstance containing the modifications
       @param includeQualifiers Boolean defining if qualifiers are to be modified.
       @param propertyList CIMPropertyList provided with the request
       @param allowedModifyProperties CIMPropertyList defining properties that
       are allowed to be modified by the provider
       @return true if there are modifications that can be made.  Note that there
       is an additional decision to be made by the user whether the modifiedIns
       includes all of the properties or they are to be set to default.
       @exception CIM_ERR_NOT_SUPPORTED if the specified modification is not supported
       @exception CIM_ERR_INVALID_PARAMETER  if the modifiedInstance is invalid
    */
   Boolean InteropProvider::isModifyAllowed(const OperationContext & context,
     const CIMObjectPath & instanceReference,     const CIMObjectPath & instanceReference,
     const CIMInstance& modifiedIns,     const CIMInstance& modifiedIns,
     const Boolean includeQualifiers,     const Boolean includeQualifiers,
     const CIMPropertyList& propertyList,     const CIMPropertyList& propertyList,
     ResponseHandler & handler)      const CIMPropertyList& allowedModifyProperties)
 { {
     PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,      // if property list size does not match allowed list.
             "InteropProvider::modifyInstanceManagerInstance");      if ((propertyList.size() > allowedModifyProperties.size())
     // the only allowed modification is this one property, statistical data             || (propertyList.isNull())
     if (modifiedIns.findProperty(OM_GATHERSTATISTICALDATA) != PEG_NOT_FOUND)         )
       {
           throw CIMNotSupportedException(
               "Only Modification of " + _toStringPropertyList(allowedModifyProperties)
                + " allowed");
       }
       // property list indicates nothing to modify return false
       if (propertyList.size() == 0)
     {     {
         // the following is a temporary hack to set the value of the statistics          return(false);
         // gathering function dynamically.  We simply get the  value from input      }
         // and call the internal method to set it each time this object is  
         // built.      // DO NOT allow any qualifier modifications.
       if (includeQualifiers)
       {
           throw CIMNotSupportedException(
               "Qualifier Modification not allowed");
       }
   
       // Assure that nothing is in the propertylist and NOT in
       // the allowed list.
       Array<CIMName> allowedArray = allowedModifyProperties.getPropertyNameArray();
       for (Uint32 i = 0 ; i < propertyList.size() ; i++)
       {
           if (!Contains(allowedArray, propertyList[i]))
           {
               throw CIMNotSupportedException(
                   "Only Modification of " + _toStringPropertyList(allowedModifyProperties)
                    + " allowed");
           }
       }
       // We have something to modify. Property List is valid
       return(true);
   }
   /** Modify the existing object Manager Object.  Only a single property modification
       is allowed, the statistical data setting.  Any other change is rejected
       with an exception
       @param instanceReference - Reference for the instance to be modified.
       @param modifiedIns CIMInstance defining the change. If this includes more than
       a single property, the propertyList must specify modification only of the
       statisticaldata property.
       @includeQualifiers Boolean which must be false unless there are no qualifiers
       in the modifiedIns.
       @propertyList CIMPropertyList defining the property to be modified if there
       is more than one property in the modifiedIns.
       @Exceptions CIMInvalidParameterException if the parameters are not valid for
       the modification.
    */
   void InteropProvider::modifyObjectManagerInstance(const OperationContext & context,
       const CIMObjectPath & instanceReference,
       const CIMInstance& modifiedIns,
       const Boolean includeQualifiers,
       const CIMPropertyList& propertyList)
   {
       PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,
               "InteropProvider::modifyObjectManagerInstance");
   
       // Modification only allowed when Performance staticistics are active
 #ifndef PEGASUS_DISABLE_PERFINST #ifndef PEGASUS_DISABLE_PERFINST
         Boolean statisticsFlag = _getPropertyValue(modifiedIns, OM_GATHERSTATISTICALDATA, false);      // the only allowed modification is one property, statistical data
       Array<CIMName> plA;
       plA.append(CIMName(OM_GATHERSTATISTICALDATA));
       CIMPropertyList allowedModifyPropertyList(plA);
   
       // returns only if no exception and there is property to modify.
       if (isModifyAllowed(context, instanceReference, modifiedIns,
           includeQualifiers, propertyList, allowedModifyPropertyList))
       {
         CIMInstance instance;         CIMInstance instance;
         instance = _getInstanceCIMObjectManager(true, true, CIMPropertyList());          instance = _getInstanceCIMObjectManager(instanceReference,
                   true, true, CIMPropertyList());
  
         if (statisticsFlag != _getPropertyValue(instance,  OM_GATHERSTATISTICALDATA, false))          CIMObjectPath tmpPath;
           tmpPath.setClassName(instanceReference.getClassName());
           tmpPath.setKeyBindings(instanceReference.getKeyBindings());
           if (!(tmpPath == instance.getPath()) )
               throw CIMObjectNotFoundException(instanceReference.toString());
       }
       else    // nothing to modify. return
       {
           return;
       }
       Boolean statisticsFlag;
       CIMInstance myInstance;
   
       // We modify only if this property exists.
       // could either use the property from modifiedIns or simply replace
       // value in property from object manager.
       if (modifiedIns.findProperty(OM_GATHERSTATISTICALDATA) != PEG_NOT_FOUND)
       {
           myInstance = _getInstanceCIMObjectManager(instanceReference,
                                       false, false, propertyList);
           statisticsFlag = _getPropertyValue(modifiedIns, OM_GATHERSTATISTICALDATA, false);
           // set the changed property into the instance
           _setPropertyValue(myInstance, OM_GATHERSTATISTICALDATA, statisticsFlag);
       }
       else
         {         {
             // set the changed property into the          // if statistics property not in place, simply exit. Nothing to do
             _setPropertyValue(instance, OM_GATHERSTATISTICALDATA, statisticsFlag);          // not considered an error
             // Modify the object on disk          PEG_METHOD_EXIT();
           return;
       }
       // Modify the instance on disk
             try             try
             {             {
                 _repository->modifyInstance(_operationNamespace,          _repository->modifyInstance(instanceReference.getNameSpace(),
                                instance );                         myInstance, false,  propertyList);
             }             }
             catch(const CIMException&)             catch(const CIMException&)
             {             {
                 // ATTN: KS generate log error if this not possible  
                 PEG_METHOD_EXIT();                 PEG_METHOD_EXIT();
                 throw;                 throw;
             }             }
             catch(const Exception&)             catch(const Exception&)
             {             {
                 // ATTN: Generate log error.  
                 PEG_METHOD_EXIT();                 PEG_METHOD_EXIT();
                 throw;                 throw;
             }             }
Line 2014 
Line 2556 
                 (statisticsFlag? "true" : "false"));                 (statisticsFlag? "true" : "false"));
             StatisticalData* sd = StatisticalData::current();             StatisticalData* sd = StatisticalData::current();
             sd->setCopyGSD(statisticsFlag);             sd->setCopyGSD(statisticsFlag);
         }      PEG_METHOD_EXIT();
         return;         return;
 #endif  
  
     }  #else
     PEG_METHOD_EXIT();     PEG_METHOD_EXIT();
     // ATTN Expand this defintion to be more precise since it allows only mod of  
     // one property and that property MUST be in the instance to be modifiable.  
     throw CIMNotSupportedException     throw CIMNotSupportedException
         (OM_GATHERSTATISTICALDATA.getString() + " modify operation not supported by Interop Provider");          (OM_GATHERSTATISTICALDATA.getString() +
                   " modify operation not supported by Interop Provider");
   #endif
 } }
 //*************************************************************************** //***************************************************************************
   //***************************************************************************
 //                modifyInstance //                modifyInstance
 //*************************************************************************** //***************************************************************************
   //***************************************************************************
 void InteropProvider::modifyInstance(const OperationContext & context, void InteropProvider::modifyInstance(const OperationContext & context,
     const CIMObjectPath & instanceReference,     const CIMObjectPath & instanceReference,
     const CIMInstance& modifiedIns,     const CIMInstance& modifiedIns,
Line 2035 
Line 2578 
     const CIMPropertyList& propertyList,     const CIMPropertyList& propertyList,
     ResponseHandler & handler)     ResponseHandler & handler)
 { {
   
     PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,     PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,
             "InteropProvider::modifyInstance");             "InteropProvider::modifyInstance");
  
       AutoMutex autoMut(changeControlMutex);
   
     Tracer::trace(TRC_CONTROLPROVIDER, Tracer::LEVEL4,     Tracer::trace(TRC_CONTROLPROVIDER, Tracer::LEVEL4,
         "%s modifyInstance. instanceReference= %s, includeQualifiers= %s, PropertyList= %s",         "%s modifyInstance. instanceReference= %s, includeQualifiers= %s, PropertyList= %s",
         thisProvider,         thisProvider,
Line 2046 
Line 2590 
         (const char *) _showBool(includeQualifiers).getCString(),         (const char *) _showBool(includeQualifiers).getCString(),
         (const char *) _showPropertyList(propertyList).getCString());         (const char *) _showPropertyList(propertyList).getCString());
  
       // test for legal namespace for this provider. Exception if not
       _isNamespaceAllowed(instanceReference);
   
     // ATTN: KS 31 August 2004. This must test for privileged user.     // ATTN: KS 31 August 2004. This must test for privileged user.
     _operationNamespace = instanceReference.getNameSpace();  
     CIMName className =  instanceReference.getClassName();     CIMName className =  instanceReference.getClassName();
     targetClass classEnum  = _verifyValidClassInput(instanceReference.getClassName());      targetClass classEnum  = _verifyValidClassInput(className);
  
     String userName = _validateUserID(context);     String userName = _validateUserID(context);
     // begin processing the request     // begin processing the request
Line 2058 
Line 2605 
     if (classEnum == CIM_OBJECTMANAGER)     if (classEnum == CIM_OBJECTMANAGER)
     {     {
         modifyObjectManagerInstance(context, instanceReference,modifiedIns,         modifyObjectManagerInstance(context, instanceReference,modifiedIns,
             includeQualifiers, propertyList, handler);              includeQualifiers, propertyList);
         // for the moment allow modification of the statistics property only         // for the moment allow modification of the statistics property only
     }     }
  
     else if (classEnum == PG_CIMXMLCOMMUNICATIONMECHANISM)     else if (classEnum == PG_CIMXMLCOMMUNICATIONMECHANISM)
     {     {
   
         PEG_METHOD_EXIT();         PEG_METHOD_EXIT();
         throw CIMNotSupportedException         throw CIMNotSupportedException
             (className.getString() + " not supported by Interop Provider");              (" Modification of " + className.getString() + " not supported by Interop Provider");
     }     }
     else if (classEnum == PG_NAMESPACE)     else if (classEnum == PG_NAMESPACE)
     {     {
 #ifdef PEGASUS_OS_OS400 #ifdef PEGASUS_OS_OS400
             MessageLoaderParms mparms("ControlProviders.InteropProvider.MODIFY_INSTANCE_NOT_ALLOWED",              MessageLoaderParms mparms(
                   "ControlProviders.InteropProvider.MODIFY_INSTANCE_NOT_ALLOWED",
                                       "Modify instance operation not allowed by Interop Provider for class $0.",                                       "Modify instance operation not allowed by Interop Provider for class $0.",
                                       PG_NAMESPACE_CLASSNAME.getString());                                       PG_NAMESPACE_CLASSNAME.getString());
             throw CIMNotSupportedException(mparms);             throw CIMNotSupportedException(mparms);
Line 2085 
Line 2632 
     }     }
     else     else
     {     {
         PEGASUS_ASSERT(false);  // should never get here.          PEG_METHOD_EXIT();
           throw CIMNotSupportedException(
               className.getString() + " not supported by Interop Provider");
     }     }
  
     handler.complete();     handler.complete();
Line 2094 
Line 2643 
 } }
  
 //*************************************************************************** //***************************************************************************
   //***************************************************************************
 //                enumerateInstanceNames //                enumerateInstanceNames
 //*************************************************************************** //***************************************************************************
   //***************************************************************************
   
 void InteropProvider::enumerateInstanceNames( void InteropProvider::enumerateInstanceNames(
         const OperationContext & context,         const OperationContext & context,
         const CIMObjectPath & classReference,         const CIMObjectPath & classReference,
Line 2104 
Line 2656 
         PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,         PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,
                 "InteropProvider::enumerateInstanceNames()");                 "InteropProvider::enumerateInstanceNames()");
  
         // operation namespace needed internally to get class.          Tracer::trace(TRC_CONTROLPROVIDER, Tracer::LEVEL4,
         _operationNamespace = classReference.getNameSpace();              "%s enumerateInstanceNames. classReference= %s",
               thisProvider,
               (const char *) classReference.toString().getCString());
   
           // test for legal namespace for this provider. Exception if not
           _isNamespaceAllowed(classReference);
  
         targetClass classEnum  = _verifyValidClassInput(classReference.getClassName());          targetClass classEnum  =
                   _verifyValidClassInput(classReference.getClassName());
  
         String userName = _validateUserID(context);         String userName = _validateUserID(context);
  
         // begin processing the request         // begin processing the request
         handler.processing();         handler.processing();
  
         // Deliver a single instance because there should only be one instance.          Boolean includeQualifiers = true;
         if (classEnum == CIM_OBJECTMANAGER)          Boolean includeClassOrigin = true;
         {  
             CIMInstance instance = _getInstanceCIMObjectManager( true, true, CIMPropertyList());  
             CIMObjectPath ref = _buildInstancePath(_operationNamespace,  
                 CIM_OBJECTMANAGER_CLASSNAME, instance);  
             handler.deliver(ref);  
             handler.complete();  
             PEG_METHOD_EXIT();  
             return;  
         }  
  
         // Deliver all possible instances of this class          Array<CIMInstance> instances =  localEnumerateInstances(
         if (classEnum == PG_CIMXMLCOMMUNICATIONMECHANISM)                  context,
         {                  classReference,
             Array<CIMInstance> instances = _buildInstancesPGCIMXMLCommunicationMechanism(true,                  includeQualifiers,
                  true, CIMPropertyList());                  includeClassOrigin,
                   CIMPropertyList());
  
             for (Uint32 i = 0 ; i < instances.size() ; i++)             for (Uint32 i = 0 ; i < instances.size() ; i++)
             {             {
                 CIMObjectPath ref = _buildInstancePath(_operationNamespace,              handler.deliver(instances[i].getPath());
                     PG_CIMXMLCOMMUNICATIONMECHANISM_CLASSNAME, instances[i]);  
                 handler.deliver(ref);  
             }  
             handler.complete();  
             PEG_METHOD_EXIT();  
             return;  
         }         }
  
         if (classEnum == CIM_NAMESPACEINMANAGER)  
         {  
             handler.complete();             handler.complete();
             PEG_METHOD_EXIT();             PEG_METHOD_EXIT();
             return;  
         }         }
  
         if (classEnum == PG_NAMESPACE)  //**************************************************************
   //**************************************************************
   // Association Functions
   //**************************************************************
   //**************************************************************
   
   /** _filterInstancesToTargetPaths - Filters one associaton and returns references that represent the result of
       filtering on resultclass and role.  Any reference that matches the resultclass and role
       and not the target is returned
       @param assocInstance - The association instance being processed.
       @param targetObjectPath - The original target. This is required since this is the one reference
       we don't want.
       @resultClass - The resultClass we want to filter on
       @resultRole  - The result role we want to filter on
       @return - returns the CIMObjectPaths that represent the other side of the association that pass
       the resultClass and resultRole filters.
    */
   
   // TODO convert the CIMOBjectPath back to const.
   Array<CIMObjectPath> _filterAssocInstanceToTargetPaths(const CIMObject& assocInstance,
                       const CIMObjectPath& targetObjectPath,
                       const CIMName resultClass,
                       const String resultRole)
         {         {
             Array<CIMInstance> instances = _getInstancesCIMNamespace(false,      Array<CIMObjectPath> returnPaths;
                                     false, CIMPropertyList());      // get all reference properties except for target.
             CDEBUG("EvalNames. Found instances. Count= " << instances.size());      for (Uint32 i = 0 ; i < assocInstance.getPropertyCount() ; i++)
             for (Uint32 i = 0 ; i < instances.size() ; i++)  
             {             {
                 CIMObjectPath ref = _buildInstancePath(_operationNamespace,          CIMConstProperty p = assocInstance.getProperty(i);
                                             CIM_NAMESPACE_CLASSNAME, instances[i]);  
                 handler.deliver(ref);  
             }  
  
             handler.complete();          if (p.getType() == CIMTYPE_REFERENCE)
             PEG_METHOD_EXIT();          {
             return;              CIMValue v = p.getValue();
         }              CIMObjectPath path;
               v.get(path);
  
         if (classEnum == CIM_COMMMECHANISMFORMANAGERINST)              if (!targetObjectPath.identical(path))
         {         {
             Array<CIMInstance> instances = _buildInstancesCommMechanismForManager();                  if (resultClass.isNull() || resultClass == path.getClassName())
             for (Uint32 i = 0 ; i < instances.size() ; i++ )  
             {             {
                 CIMObjectPath ref = _buildObjectPath(_operationNamespace,                      if ((resultRole == String::EMPTY) || (p.getName() == CIMName(resultRole)))
                         CIM_COMMMECHANISMFORMANAGER_CLASSNAME, instances[i]);                          returnPaths.append(path);
                 handler.deliver(ref);  
             }             }
         }         }
   
         if (classEnum == CIM_NAMESPACEINMANAGERINST)  
         {  
             Array<CIMInstance> instances = _buildInstancesNamespaceInManager();  
             for (Uint32 i = 0 ; i < instances.size() ; i++ )  
             {  
                 CIMObjectPath ref = _buildObjectPath(_operationNamespace,  
                         CIM_NAMESPACEINMANAGER_CLASSNAME, instances[i]);  
                 handler.deliver(ref);  
             }             }
         }         }
       CDEBUG("_filterAssoc PathsReturned. Count = " << returnPaths.size()
              << "\n" << _showPathArray(returnPaths));
         // ATTN: Exception response because of error      return( returnPaths );
         PEG_METHOD_EXIT();  
     }     }
  
   
 //************************************************************** //**************************************************************
 //************************************************************** //**************************************************************
 // Association Functions  // Associators Operation Call
 //************************************************************** //**************************************************************
 //************************************************************** //**************************************************************
  
Line 2213 
Line 2762 
         ObjectResponseHandler & handler)         ObjectResponseHandler & handler)
 { {
     PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,     PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,
             "InteropProvider::associatorNames()");              "InteropProvider::associators()");
         //throw CIMNotSupportedException("AssociationProvider::associators");      Tracer::trace(TRC_CONTROLPROVIDER, Tracer::LEVEL4,
           "%s associators. objectName= %s , assocClass= %s resultClass= %s role= %s resultRole %includeQualifiers= %s, includeClassOrigin= %s, PropertyList= %s",
           thisProvider,
           (const char *)objectName.toString().getCString(),
           (const char *)associationClass.getString().getCString(),
           (const char *)resultClass.getString().getCString(),
           (const char *)role.getCString(),
           (const char *)resultRole.getCString(),
           (const char *)_showBool(includeQualifiers).getCString(),
           (const char*) _showBool(includeClassOrigin).getCString(),
           (const char *)_showPropertyList(propertyList).getCString());
   
       // test for legal namespace for this provider. Exception if not
       _isNamespaceAllowed(objectName);
   
       handler.processing();
       // Get references for this object. Note that this
       // uses the associationClass as resultClass.
       Array<CIMObject> referenceObjects = localReferences(
               context,
               objectName,
               associationClass,
               role,
               includeQualifiers,
               includeClassOrigin,
               propertyList);
   
       // Note that Result Class is not always there.  We need to account for
       // both case where it exists and where it does not exist.
       // enumerate all reference instances of the resultClass (i.e. the association)
       // create path for resultClass
   
       // for each reference object, get all non-target references
       Array<CIMObjectPath> resultPaths;
       for (Uint32 i = 0 ; i < referenceObjects.size() ; i++)
       {
           // get Other references from each reference object.
           Array<CIMObjectPath> tempPath =
               _filterAssocInstanceToTargetPaths(
                                   referenceObjects[i],
                                   objectName,
                                   resultClass,
                                   resultRole);
           for (Uint32 i = 0 ; i < tempPath.size() ; i++)
           {
               resultPaths.append(tempPath[i]);
           }
 } }
  
       // get the instance using getInstance.
       for (Uint32 i = 0 ; i < resultPaths.size() ; i++)
       {
           CIMInstance thisInstance = localGetInstance(context, resultPaths[i],
                                           includeQualifiers,
                                           includeClassOrigin, propertyList);
           if (!thisInstance.isUninitialized())
           {
               handler.deliver(thisInstance);
           }
       }
       handler.processing();
       handler.complete();
       PEG_METHOD_EXIT();
   }
   
   //**************************************************************
   //**************************************************************
   // AssociatorNames Operation Function
   //**************************************************************
   //**************************************************************
 void InteropProvider::associatorNames( void InteropProvider::associatorNames(
         const OperationContext & context,         const OperationContext & context,
         const CIMObjectPath & objectName,         const CIMObjectPath & objectName,
Line 2229 
Line 2845 
     PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,     PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,
             "InteropProvider::associatorNames()");             "InteropProvider::associatorNames()");
         //throw CIMNotSupportedException("AssociationProvider::associatorNames");         //throw CIMNotSupportedException("AssociationProvider::associatorNames");
   
       // test for legal namespace for this provider. Exception if not
       _isNamespaceAllowed(objectName);
   
       Tracer::trace(TRC_CONTROLPROVIDER, Tracer::LEVEL4,
           "%s associatorNames. objectName= %s , assocClass= %s resultClass= %s role= %s resultRole",
           thisProvider,
           (const char *)objectName.toString().getCString(),
           (const char *)associationClass.getString().getCString(),
           (const char *)resultClass.getString().getCString(),
           (const char *)role.getCString(),
           (const char *)resultRole.getCString());
   
       handler.processing();
       // Get references for this object. Note that this
       // uses the associationClass as resultClass.
       Array<CIMObject> referenceObjects = localReferences(
               context,
               objectName,
               associationClass,
               role,
               false,
               false,
               CIMPropertyList());
   
       // Note that Result Class is not always there.  We need to account for
       // both case where it exists and where it does not exist.
       // enumerate all reference instances of the resultClass (i.e. the association)
       // create path for resultClass
   
       // for each reference object, get all non-target references
       Array<CIMObjectPath> resultPaths;
       for (Uint32 i = 0 ; i < referenceObjects.size() ; i++)
       {
           // get Other references from each association object.
           Array<CIMObjectPath> tempPath =
               _filterAssocInstanceToTargetPaths(referenceObjects[i],
               objectName, resultClass, resultRole);
   
           for (Uint32 i = 0 ; i < tempPath.size() ; i++)
           {
               resultPaths.append(tempPath[i]);
           }
       }
       handler.deliver(resultPaths);
   
       handler.processing();
       handler.complete();
       PEG_METHOD_EXIT();
 } }
  
   
   Array<CIMObject> InteropProvider::localReferences(
           const OperationContext & context,
           const CIMObjectPath & objectName,
           const CIMName & resultClass,
           const String & role,
           const Boolean includeQualifiers,
           const Boolean includeClassOrigin,
           const CIMPropertyList & propertyList)
   {
   
       PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,
               "InteropProvider::localReferences()");
       Tracer::trace(TRC_CONTROLPROVIDER, Tracer::LEVEL4,
           "%s references. objectName= %s , resultClass= %s role= %s includeQualifiers= %s, includeClassOrigin= %s, PropertyList= %s",
           thisProvider,
           (const char *)objectName.toString().getCString(),
           (const char *)resultClass.getString().getCString(),
           (const char *)role.getCString(),
           (const char *)_showBool(includeQualifiers).getCString(),
           (const char*) _showBool(includeClassOrigin).getCString(),
           (const char *)_showPropertyList(propertyList).getCString());
   
       Array<CIMInstance> rtnInstances;
   
       // operation namespace needed internally to get class.
       String userName = _validateUserID(context);
   
       // determine if valid class result class
       CIMName targetAssocClassName = resultClass;
   
       targetAssocClass classEnum  = _verifyValidAssocClassInput(targetAssocClassName);
   
       // resultClass should NEVER be NULL in Pegasus.
       PEGASUS_ASSERT(!resultClass.isNull());
   
       // enumerate all reference instances of the resultClass (i.e. the association)
       CIMObjectPath classReference(objectName.getHost(), objectName.getNameSpace(),
                                    resultClass);
   
       Array<CIMInstance> assocInstances =
           localEnumerateInstances(context,
                                   classReference,
                                   true, true, CIMPropertyList());
   
       Array<CIMObject> rtnObjects = _filterReferenceInstances(
                       assocInstances, objectName, resultClass, role);
   
       PEG_METHOD_EXIT();
       return(rtnObjects);
   }
 void InteropProvider::references( void InteropProvider::references(
         const OperationContext & context,         const OperationContext & context,
         const CIMObjectPath & objectName,         const CIMObjectPath & objectName,
Line 2243 
Line 2959 
 { {
     PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,     PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,
             "InteropProvider::references()");             "InteropProvider::references()");
         //throw CIMNotSupportedException("AssociationProvider::references");  
 }  
  
 void _filterAssocInstances(Array<CIMInstance>& instances,      // test for legal namespace for this provider. Exception if not
                       CIMName assocClassName,      _isNamespaceAllowed(objectName);
                       String assocRole,  
                       CIMName resultClassName = CIMName(),  
                       String resultRole = String::EMPTY)  
 {  
     return;  
 }  
  
       Tracer::trace(TRC_CONTROLPROVIDER, Tracer::LEVEL4,
           "%s references. objectName= %s , resultClass= %s role= %s includeQualifiers= %s, includeClassOrigin= %s, PropertyList= %s",
           thisProvider,
           (const char *)objectName.toString().getCString(),
           (const char *)resultClass.getString().getCString(),
           (const char *)role.getCString(),
           (const char *)_showBool(includeQualifiers).getCString(),
           (const char*) _showBool(includeClassOrigin).getCString(),
           (const char *)_showPropertyList(propertyList).getCString());
   
       handler.processing();
       Array<CIMObject> rtnObjects =
                       localReferences(context,
                                       objectName,
                                       resultClass,
                                       role,
                                       includeQualifiers,
                                       includeClassOrigin,
                                       propertyList);
   
       handler.deliver(rtnObjects);
       handler.complete();
       PEG_METHOD_EXIT();
   }
 void InteropProvider::referenceNames( void InteropProvider::referenceNames(
         const OperationContext & context,         const OperationContext & context,
         const CIMObjectPath & objectName,         const CIMObjectPath & objectName,
Line 2264 
Line 2996 
 { {
     PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,     PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,
             "InteropProvider::referenceNames()");             "InteropProvider::referenceNames()");
   
       // test for legal namespace for this provider. Exception if not
       _isNamespaceAllowed(objectName);
   
     CDEBUG("::referenceNames(): object= " << objectName.toString() << " result Class= " << resultClass.getString());     CDEBUG("::referenceNames(): object= " << objectName.toString() << " result Class= " << resultClass.getString());
  
     // operation namespace needed internally to get class.     // operation namespace needed internally to get class.
     _operationNamespace = objectName.getNameSpace();  
     String userName = _validateUserID(context);     String userName = _validateUserID(context);
   
     // begin processing the request     // begin processing the request
     handler.processing();     handler.processing();
  
     // determine if valid class result class      Array<CIMObject> rtnObjects =
           localReferences(context,
     CIMName targetAssocClassName = resultClass;                          objectName,
                           resultClass,
     CIMName targetClassName = objectName.getClassName();                          role,
                           true,
     targetAssocClass classEnum  = _verifyValidAssocClassInput(targetAssocClassName);                          true,
                           CIMPropertyList());
     Array<CIMInstance> assocInstances;  
   
     if (classEnum == CIM_COMMMECHANISMFORMANAGERASSOC)  
         assocInstances = _buildInstancesCommMechanismForManager();  
   
     if (classEnum == CIM_NAMESPACEINMANAGERASSOC)  
         assocInstances = _buildInstancesNamespaceInManager();  
   
     _filterAssocInstances(assocInstances, resultClass, role);  
  
     for (Uint32 i = 0 ; i < assocInstances.size() ; i++ )      for (Uint32 i = 0 ; i < rtnObjects.size() ; i++ )
     {     {
         CIMObjectPath ref = _buildObjectPath(_operationNamespace,          CIMObjectPath ref = rtnObjects[i].getPath();
                 targetAssocClassName, assocInstances[i]);  
         CDEBUG("referenceNames returns: " << ref.toString());         CDEBUG("referenceNames returns: " << ref.toString());
         handler.deliver(ref);         handler.deliver(ref);
     }     }
Line 2301 
Line 3027 
     handler.complete();     handler.complete();
  
     PEG_METHOD_EXIT();     PEG_METHOD_EXIT();
     // Convert the instances to referenceNames response  
 } }
  
 PEGASUS_NAMESPACE_END PEGASUS_NAMESPACE_END


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

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2