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

   1 karl  1.18 //%2005////////////////////////////////////////////////////////////////////////
   2 karl  1.1  //
   3 karl  1.12 // Copyright (c) 2000, 2001, 2002 BMC Software; Hewlett-Packard Development
   4            // Company, L.P.; IBM Corp.; The Open Group; Tivoli Systems.
   5            // Copyright (c) 2003 BMC Software; Hewlett-Packard Development Company, L.P.;
   6 karl  1.3  // IBM Corp.; EMC Corporation, The Open Group.
   7 karl  1.12 // Copyright (c) 2004 BMC Software; Hewlett-Packard Development Company, L.P.;
   8            // IBM Corp.; EMC Corporation; VERITAS Software Corporation; The Open Group.
   9 karl  1.18 // Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.;
  10            // EMC Corporation; VERITAS Software Corporation; The Open Group.
  11 karl  1.1  //
  12            // Permission is hereby granted, free of charge, to any person obtaining a copy
  13            // of this software and associated documentation files (the "Software"), to
  14            // deal in the Software without restriction, including without limitation the
  15            // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
  16            // sell copies of the Software, and to permit persons to whom the Software is
  17            // furnished to do so, subject to the following conditions:
  18 david.dillard 1.32 //
  19 karl          1.1  // THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
  20                    // ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED
  21                    // "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
  22                    // LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
  23                    // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
  24                    // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
  25                    // ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
  26                    // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  27                    //
  28                    //==============================================================================
  29                    //
  30                    // Author: Karl Schopmeyer (k.schopmeyer@opengroup.org)
  31                    //
  32                    // Modified By: Carol Ann Krug Graves, Hewlett-Packard Company
  33                    //                (carolann_graves@hp.com)
  34 karl          1.8  //              Karl Schopmeyer - Created Cim_Namespace capabilities.
  35                    //              Karl Schopmeyer - added objectmanager and communication classes
  36 joyce.j       1.30 //              Josephine Eskaline Joyce, IBM (jojustin@in.ibm.com) for Bug#3194
  37 david.dillard 1.32 //              David Dillard, VERITAS Software Corp.
  38                    //                  (david.dillard@veritas.com)
  39 aruran.ms     1.36 //              Aruran, IBM (ashanmug@in.ibm.com) for Bug# 3659
  40 karl          1.1  //
  41                    //%////////////////////////////////////////////////////////////////////////////
  42                    
  43                    
  44                    ///////////////////////////////////////////////////////////////////////////////
  45 karl          1.5  //  Interop Provider - This provider services those classes from the
  46                    //  DMTF Interop schema association with the CIMOM itself
  47 karl          1.1  //
  48 karl          1.5  //  This provider services the following classes:
  49                    //      CIMObjectManager
  50                    //      CIM_ObjectManagerCommunicationMechanism
  51                    //      CIM_CIMXMLCommunicationMechanism
  52 karl          1.19 //      CIM_ProtocolAdapter  (Note: Removed because deprecated class in cim 2.9)
  53 karl          1.37 //      CIM_Namespace (Effective Pegasus 2.4 we use PG_Namespace.
  54 david.dillard 1.32 //
  55 karl          1.37 //      PG_Namespace - Pegasus particular subclass of CIM_Namespace that
  56                    //      add the parameters for shared namespaces
  57                    //
  58                    //      PG_CIMXMLCommunicationMechanism - Pegasus subclass of 
  59                    //      CIM_CIMXMLCommunicationMechanism that adds support for passing
  60                    //      additional communication parameters (ie. port, https vs. http, etc.)
  61                    //   
  62 karl          1.5  //      It also services the Interop associations tied to these classes
  63                    //      including:
  64                    //      CIM_NamespaceInManager
  65                    //      ...
  66 karl          1.11 //      This is a control provider and as such uses the Tracer functions
  67                    //      for data and function traces.  Since we do not expect high volume
  68 david.dillard 1.32 //      use we added a number of traces to help diagnostics.
  69 karl          1.1  ///////////////////////////////////////////////////////////////////////////////
  70 karl          1.11 /* TODO LIST:
  71                        1. Finish the association functions
  72 david.dillard 1.32 
  73 karl          1.11     2. UUID generation should become a system function since it will be used
  74                           by many providers, etc. as part of id generation.
  75 david.dillard 1.32 
  76 karl          1.11     3. Review the key parameters on create, etc. to be sort out which are
  77                           required from user and which we can supply.  I think we are asking too
  78                           much of the user right now.
  79 tony          1.6  */
  80 karl          1.1  
  81                    #include <Pegasus/Common/Config.h>
  82                    #include <Pegasus/Common/PegasusVersion.h>
  83                    
  84                    #include <cctype>
  85                    #include <iostream>
  86                    
  87                    #include "InteropProvider.h"
  88 tony          1.6  #include "Guid.h"
  89 karl          1.1  #include <Pegasus/Common/String.h>
  90                    #include <Pegasus/Common/System.h>
  91                    #include <Pegasus/Common/ArrayInternal.h>
  92                    #include <Pegasus/Common/CIMName.h>
  93                    #include <Pegasus/Common/CIMType.h>
  94                    #include <Pegasus/Common/CIMInstance.h>
  95                    #include <Pegasus/Common/CIMObjectPath.h>
  96                    #include <Pegasus/Common/InternalException.h>
  97                    #include <Pegasus/Common/CIMStatusCode.h>
  98                    #include <Pegasus/Common/Tracer.h>
  99                    #include <Pegasus/Common/OperationContext.h>
 100                    #include <Pegasus/Config/ConfigManager.h>
 101 tony          1.6  #include <Pegasus/Common/XmlWriter.h>
 102                    #include <Pegasus/Config/ConfigManager.h>
 103 karl          1.8  #include <Pegasus/Common/StatisticalData.h>
 104                    #include <Pegasus/Common/HashTable.h>
 105 karl          1.1  
 106                    
 107 tony          1.6  #include <stdlib.h>
 108 karl          1.1  
 109 tony          1.6  //The following include is needed for gethostbyname
 110                    #if defined(PEGASUS_OS_TYPE_WINDOWS)
 111                    #include <objbase.h>
 112                    #else
 113                    #include <netdb.h>
 114                    #include <arpa/inet.h>
 115                    #endif
 116 karl          1.1  
 117                    PEGASUS_USING_STD;
 118                    
 119                    PEGASUS_NAMESPACE_BEGIN
 120                    
 121 karl          1.27 #define CDEBUG(X)
 122 karl          1.11 #define LDEBUG()
 123 karl          1.27 //#define CDEBUG(X) PEGASUS_STD(cout) << "InteropProvider " << X << PEGASUS_STD(endl)
 124 kumpf         1.35 //#define LDEBUG(X) Logger::put (Logger::DEBUG_LOG, "InteropProvider", Logger::TRACE, "$0", X)
 125 tony          1.6  
 126                    //**************************************************************************
 127                    //
 128                    //    Constants representing the class names processed
 129                    //
 130                    //**************************************************************************
 131                    
 132 karl          1.10 const char * thisProvider = "InteropProvider";
 133 tony          1.6  // The following should be moved to somewhere like constants.
 134 karl          1.5  static const String PegasusInstanceIDGlobalPrefix = "PEG";
 135 karl          1.1  
 136                    /**
 137                        The constants representing the class names we process
 138                    */
 139                    static const CIMName CIM_NAMESPACE_CLASSNAME  = CIMName ("CIM_Namespace");
 140 karl          1.8  static const CIMName PG_NAMESPACE_CLASSNAME  = CIMName ("PG_Namespace");
 141                    
 142 karl          1.1  static const CIMName CIM_OBJECTMANAGER_CLASSNAME  = CIMName ("CIM_ObjectManager");
 143 david.dillard 1.32 static const CIMName CIM_OBJECTMANAGERCOMMUNICATIONMECHANISM_CLASSNAME  =
 144 karl          1.1          CIMName ("CIM_ObjectManagerCommunicationMechanism");
 145 david.dillard 1.32 static const CIMName PG_CIMXMLCOMMUNICATIONMECHANISM_CLASSNAME  =
 146 tony          1.6          CIMName ("PG_CIMXMLCommunicationMechanism");
 147 david.dillard 1.32 static const CIMName CIM_COMMMECHANISMFORMANAGER_CLASSNAME  =
 148 tony          1.6          CIMName ("CIM_CommMechanismForManager");
 149 david.dillard 1.32 static const CIMName CIM_NAMESPACEINMANAGER_CLASSNAME  =
 150 tony          1.6          CIMName ("CIM_NamespaceInManager");
 151 karl          1.1  
 152 karl          1.37 // Property Names for CIM_Namespace Class
 153 karl          1.1  static const CIMName NAMESPACE_PROPERTYNAME  = CIMName ("Name");
 154 karl          1.37 
 155                    // Root Namespace Name for test.
 156 karl          1.1  static const CIMNamespaceName ROOTNS  = CIMNamespaceName ("root");
 157                    
 158                    
 159                    // Property names for CIM_ObjectManager Class
 160                    static const CIMName OM_GATHERSTATISTICALDATA  =
 161                     CIMName ("GatherStatisticalData");
 162 karl          1.37 
 163 tony          1.6  // Property for the slp template.
 164                    static const CIMName OM_DESCRIPTIONPROPERTY =
 165                        CIMName("Description");
 166 karl          1.1  
 167                    // Property Names for ObjectManagerCommunicationMechanism Class
 168 david.dillard 1.32 static const CIMName OM_COMMUNICATIONMECHANISM  =
 169 karl          1.1          CIMName ("CommunicationMechanism");
 170                    static const CIMName OM_FUNCTIONALPROFILESSUPPORTED  =
 171                     CIMName ("FunctionalProfilesSupported");
 172                    static const CIMName OM_FUNCTIONALPROFILEDESCRIPTIONS  =
 173                     CIMName ("FunctionalProfileDescriptions");
 174                    static const CIMName OM_AUTHENTICATIONMECHANISMSSUPPORTED  =
 175                     CIMName ("AuthenticationMechanismsSupported");
 176                    static const CIMName OM_AUTHENTICATIONMECHANISMDESCRIPTIONS  =
 177                     CIMName ("AuthenticationMechanismDescriptions");
 178                    static const CIMName OM_MULTIPLEOPERATIONSSUPPORTED  =
 179                     CIMName ("MultipleOperationsSupported");
 180                    static const CIMName OM_VERSION  =
 181                     CIMName ("Version");
 182                    
 183                    // Property Names for CIMXML CommunicationMechanism
 184                    
 185                    static const CIMName CIMVALIDATED  =
 186                     CIMName ("CIMValidated");
 187                    
 188                    static const String CIMXMLProtocolVersion = "1.0";
 189                    
 190 karl          1.5  // Property names for CIM_Namespace Class
 191 karl          1.1  
 192 david.dillard 1.32 static const CIMName CIM_NAMESPACE_PROPERTY_SYSTEMCREATIONCLASSNAME =
 193 karl          1.1          CIMName ("SystemCreationClassName");
 194 david.dillard 1.32 static const CIMName CIM_NAMESPACE_PROPERTY_SYSTEMNAME =
 195 karl          1.1          CIMName ("SystemName");
 196 david.dillard 1.32 static const CIMName CIM_NAMESPACE_PROPERTY_OBJECTMANAGERCREATIONCLASSNAME =
 197 karl          1.1          CIMName ("ObjectManagerCreationClassName");
 198 david.dillard 1.32 static const CIMName CIM_NAMESPACE_PROPERTY_OBJECTMANAGERNAME =
 199 karl          1.1          CIMName ("ObjectManagerName");
 200 david.dillard 1.32 static const CIMName CIM_NAMESPACE_PROPERTY_CREATIONCLASSNAME =
 201 karl          1.1          CIMName ("CreationClassName");
 202                    static const CIMName CIM_NAMESPACE_PROPERTY_NAME  = CIMName ("Name");
 203 david.dillard 1.32 static const CIMName CIM_NAMESPACE_PROPERTY_CLASSINFO =
 204 karl          1.1          CIMName ("ClassInfo");
 205 david.dillard 1.32 static const CIMName CIM_NAMESPACE_PROPERTY_DESCRIPTIONOFCLASSINFO =
 206 karl          1.1          CIMName ("DescriptionOfClassInfo");
 207                    
 208 karl          1.8  // Additional Property names for PG_Namespace Class
 209                    
 210 david.dillard 1.32 static const CIMName PG_NAMESPACE_PROPERTY_SCHEMAUPDATESALLOWED =
 211 karl          1.8          CIMName ("SchemaUpdatesAllowed");
 212 david.dillard 1.32 static const CIMName PG_NAMESPACE_PROPERTY_ISSHAREABLE =
 213 karl          1.8          CIMName ("IsShareable");
 214 david.dillard 1.32 static const CIMName PG_NAMESPACE_PROPERTY_PARENTNAMESPACE =
 215 karl          1.8          CIMName ("ParentNamespace");
 216 david.dillard 1.32 static const CIMName PG_NAMESPACE_PROPERTY_NAME =
 217 karl          1.11         CIMName ("Name");
 218 karl          1.8  
 219 karl          1.5  // Defines to serve as the ENUM for class selection for instance
 220                    // operations.
 221                    
 222                    enum targetClass{
 223 karl          1.11         PG_NAMESPACE = 1,
 224                            CIM_OBJECTMANAGER = 2,
 225                            PG_CIMXMLCOMMUNICATIONMECHANISM = 3,
 226                            CIM_NAMESPACEINMANAGERINST =4,
 227 karl          1.19         CIM_COMMMECHANISMFORMANAGERINST=5,
 228                            CIM_NAMESPACEINMANAGER=6
 229 karl          1.11     };
 230 david.dillard 1.32 
 231 tony          1.6   enum targetAssocClass{
 232 karl          1.19      CIM_NAMESPACEINMANAGERASSOC = 1,
 233                         CIM_COMMMECHANISMFORMANAGERASSOC=2
 234 tony          1.6   };
 235 karl          1.5  
 236 w.white       1.34 
 237                    //*************************************************************
 238                    //  Constructor
 239                    //**********************************************************
 240                    InteropProvider::InteropProvider(CIMRepository* repository)
 241                    {
 242                        PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,"InteropProvider::InteropProvider");
 243                         _repository = repository;
 244                    
 245                        //***********************************************
 246                        // This is a tempory fix untill there is a method created for the InteropProvider to 
 247 karl          1.37     // do it's inalization work. This fix sets StatisticalData::CopyGSD, enabling the 
 248 w.white       1.34     //statistical gathering function.
 249                    
 250 w.white       1.38 
 251                         Boolean InstancesExists = true;
 252                         Array<CIMInstance> instance;
 253                    
 254                         try
 255                         {
 256                             instance = repository->enumerateInstances(CIMNamespaceName("root/cimv2"), 
 257                                                                       CIMName ("CIM_ObjectManager"));
 258                         }
 259                         catch(Exception e)
 260                         {
 261                           InstancesExists = false;
 262                         }
 263                    
 264 w.white       1.39      /* When Bug 3696 is fixed the following try block will replace the try block above. But for
 265                            now if no instances of the CIM_ObjectManager class are found in the root/cimv2 name space
 266                            the root/PG_InterOp name space will be checked
 267                         */
 268                         if(!InstancesExists)
 269                         {
 270                             try
 271                             { 
 272                                 instance = repository->enumerateInstances(CIMNamespaceName("root/PG_InterOp"), 
 273                                                                           CIMName ("CIM_ObjectManager"));
 274                             }
 275                             catch(Exception e)
 276                             {
 277                                 InstancesExists = false;
 278                             }
 279                         }
 280                    
 281 w.white       1.38      if(instance.size() > 0 && InstancesExists)
 282                         {                               
 283 w.white       1.34         Boolean output = false;
 284                            Uint32 pos;
 285                            if ((pos = instance[0].findProperty(CIMName("GatherStatisticalData"))) != PEG_NOT_FOUND)
 286                            {
 287                                CIMConstProperty p1 = instance[0].getProperty(pos);
 288                                if (p1.getType() == CIMTYPE_BOOLEAN)
 289                                {
 290                                    CIMValue v1  = p1.getValue();
 291                                    if (!v1.isNull())
 292                                    {
 293                                        v1.get(output);
 294                                        if (v1 == true) 
 295                                        {
 296                                            StatisticalData* sd = StatisticalData::current();
 297                                            sd->setCopyGSD(true);
 298                                        }
 299                                    }
 300                                }                 
 301                            }  
 302                        }
 303                        //******************************************* end of temporary fix
 304 w.white       1.34     PEG_METHOD_EXIT();
 305                     }
 306                    
 307 karl          1.1  //***************************************************************
 308 karl          1.5  // Provider Utility Functions
 309 karl          1.1  //***************************************************************
 310 tony          1.6  
 311 karl          1.26 String _showBool(Boolean x)
 312                    {
 313                        return(x? "true" : "false");
 314                    }
 315                    
 316 carson.hovey  1.29 static String _toStringPropertyList(const CIMPropertyList& pl)
 317 karl          1.26 {
 318                        String tmp;
 319                        for (Uint32 i = 0; i < pl.size() ; i++)
 320                        {
 321                            if (i > 0)
 322                                tmp.append(", ");
 323                            tmp.append(pl[i].getString());
 324                        }
 325                        return(tmp);
 326                    }
 327                    
 328 karl          1.40 
 329                    /* set the hostname and namespace fields into the cimobjectpath
 330                       of the defined instance
 331                    */
 332                    
 333                    void _setCompleteInstancePath(CIMInstance& instance,
 334                                               const CIMObjectPath& inputPath)
 335                    {
 336                        CIMObjectPath p = instance.getPath();
 337                        p.setHost(inputPath.getHost());
 338                        p.setNameSpace(inputPath.getNameSpace());
 339                    
 340                        instance.setPath(p);
 341                    }
 342                    
 343                    /* complete the instance by setting the complete path into the instance
 344                       and executing the instance filter to set the qualifiers, classorigin and
 345                       propertylist in accordance with the input.  Note that this can only remove
 346                       characteristics, except for the path completion so that it expects instances
 347                       with qualifiers included, class origin included and a complete property
 348                       list.
 349 karl          1.40 */
 350                    
 351                    
 352                     void _finishInstance(CIMInstance& instance, const CIMObjectPath& path, Boolean includeQualifiers,
 353                         Boolean includeClassOrigin, const CIMPropertyList& propertyList)
 354                     {
 355                         _setCompleteInstancePath( instance, path);
 356                    
 357                         instance.filter(includeQualifiers,
 358                                         includeClassOrigin,
 359                                         propertyList );
 360                     }
 361 carson.hovey  1.29 static String _showPropertyList(const CIMPropertyList& pl)
 362 karl          1.26 {
 363                        if (pl.isNull())
 364                            return("NULL");
 365                    
 366                        String tmp;
 367                    
 368                        tmp.append((pl.size() == 0) ? "Empty" : _toStringPropertyList(pl));
 369                        return(tmp);
 370                    }
 371                    
 372 karl          1.8  /** get one string property from an instance. Note that these functions simply
 373                        return the default value if the property cannot be found or is of the wrong
 374 david.dillard 1.32     type thus, in reality being a maintenance problem since there is no
 375 karl          1.8      error indication.
 376 tony          1.6      @param instance CIMInstance from which we get property value
 377                        @param propertyName String name of the property containing the value
 378                        @param default String optional parameter that is substituted if the property does
 379                        not exist, is Null, or is not a string type. The substitute is String::EMPTY
 380                        @return String value found or defaultValue.
 381                    */
 382 karl          1.10 String _getPropertyValue(const CIMInstance& instance, const CIMName& propertyName, const String& defaultValue)
 383 tony          1.6  {
 384 karl          1.8      String output = defaultValue;
 385 tony          1.6      Uint32 pos;
 386                        if ((pos = instance.findProperty(propertyName)) != PEG_NOT_FOUND)
 387                        {
 388                            CIMConstProperty p1 = instance.getProperty(pos);
 389                            if (p1.getType() == CIMTYPE_STRING)
 390                            {
 391                                CIMValue v1  = p1.getValue();
 392                    
 393                                if (!v1.isNull())
 394                                    v1.get(output);
 395                            }
 396                        }
 397 karl          1.8      return(output);
 398                    }
 399                    
 400                    // Overload of _getPropertyValue for boolean type
 401 karl          1.10 Boolean _getPropertyValue(const CIMInstance& instance, const CIMName& propertyName, const Boolean defaultValue)
 402 karl          1.8  {
 403                        Boolean output = defaultValue;
 404                        Uint32 pos;
 405                        if ((pos = instance.findProperty(propertyName)) != PEG_NOT_FOUND)
 406                        {
 407                            CIMConstProperty p1 = instance.getProperty(pos);
 408                            if (p1.getType() == CIMTYPE_BOOLEAN)
 409                            {
 410                                CIMValue v1  = p1.getValue();
 411                    
 412                                if (!v1.isNull())
 413                                    v1.get(output);
 414                            }
 415                        }
 416 tony          1.6      return(output);
 417                    }
 418 karl          1.11 
 419 tony          1.6  /** get Host IP address from host name. If the
 420                        host name is not provided, uses internal function.
 421                        If everything fails, gets the definition normally
 422                        used for localhost (127.0.0.1).
 423 david.dillard 1.32 
 424 tony          1.6      @param hostName String with the name of the host
 425 karl          1.41     @param namespaceType - Uint32 representing the
 426                        access protocol for this request.  This is exactly
 427                        the definition in the PG_CIMXMLCommunicationMechanism
 428                        mof for the property namespaceAccessProtocol.
 429                        @return String with the IP address to be used. This must
 430                        be the complete address sufficient to access the
 431                        IP address. Therefore, it includes the port number.
 432 tony          1.6  */
 433 karl          1.41 String _getHostAddress(String & hostName, Uint32  namespaceType)
 434 david.dillard 1.32 {
 435 marek         1.14   String ipAddress;
 436 david.dillard 1.32 
 437 tony          1.6    if (hostName == String::EMPTY)
 438                        	hostName = System::getHostName();
 439                    
 440 marek         1.14   if ((ipAddress = System::getHostIP(hostName)) == String::EMPTY)
 441                      {
 442                          // set default address if everything else failed
 443                          ipAddress = String("127.0.0.1");
 444                      }
 445 karl          1.41   // Question: is there a case where we leave off the port number.
 446                      // Code to get the property service_location_tcp ( which is equivalent to "IP address:5988")
 447                      // Need to tie these two together.
 448                      Uint32 portNumber;
 449                    
 450                      /********************** Drop this
 451                      ConfigManager* configManager = ConfigManager::getInstance();
 452                      Boolean enableHttpConnection = String::equal(
 453                          configManager->getCurrentValue("enableHttpConnection"), "true");
 454                      Boolean enableHttpsConnection = String::equal(
 455                          configManager->getCurrentValue("enableHttpsConnection"), "true");
 456                      ***********************/
 457                    
 458                      // ATTN: The following is incorrect and must be modified as part
 459                      // of bug 1857 and possibly other bug reports. KS. This is 2.5 mustfix.
 460                    
 461                      // Match the protocol and port number from internal information.
 462                      if (namespaceType == 3)
 463                           portNumber = System::lookupPort(WBEM_HTTPS_SERVICE_NAME,
 464                              WBEM_DEFAULT_HTTPS_PORT);
 465                      else if (namespaceType == 2)
 466 karl          1.41   {
 467                          portNumber = System::lookupPort(WBEM_HTTP_SERVICE_NAME,
 468                              WBEM_DEFAULT_HTTP_PORT);
 469                      }
 470                      else
 471                          portNumber = 0;
 472                      // convert portNumber to ascii
 473                      char buffer[32];
 474                      sprintf(buffer, ":%u", portNumber);
 475                      if (portNumber != 0)
 476                          ipAddress.append(buffer);
 477                    
 478                      // now fillout the serviceIDAttribute from the object manager instance name property.
 479                      // This is a key field so must have a value.
 480                      //String strUUID = _getPropertyValue( instance_ObjMgr, namePropertyName, "DefaultEmptyUUID");
 481                    
 482 tony          1.6    return ipAddress;
 483                    }
 484                    
 485 karl          1.19  Array<String> _getFunctionalProfiles(Array<Uint16> & profiles)
 486 tony          1.6   {
 487                         Array<String> profileDescriptions;
 488                         profiles.append(2); profileDescriptions.append("Basic Read");
 489                         profiles.append(3); profileDescriptions.append("Basic Write");
 490                         profiles.append(4); profileDescriptions.append("Schema Manipulation");
 491                         profiles.append(5); profileDescriptions.append("Instance Manipulation");
 492                         profiles.append(6); profileDescriptions.append("Association Traversal");
 493                         profiles.append(8); profileDescriptions.append("Qualifier Declaration");
 494                         profiles.append(9); profileDescriptions.append("Indications");
 495                         return(profileDescriptions);
 496                     }
 497                    
 498                    /*  get the prefix that will be part of the cimom identification
 499                        This can be either the default PEG or if the environment
 500                        variable PEGASUS_TRADEMARK_PREFIX is defined this is used.
 501                        NOTE: getting from the environment variable is a hack until
 502                        we can come up with a better source.
 503                        @return String containing the unique name for the CIMOM ID
 504                    */
 505                    
 506                    String getTrademarkCIMOMIDPrefix()
 507 tony          1.6  {
 508                    
 509                        char * trademark;
 510                        trademark = getenv("PEGASUS_TRADEMARK_PREFIX");
 511                        return((trademark)? trademark : PegasusInstanceIDGlobalPrefix);
 512                    }
 513                    /** Builds the UUID string for this CIMOM.
 514                    **/
 515                    String getUUIDString()
 516                    {
 517                        return(Guid::getGuid());
 518                    }
 519 karl          1.1  
 520                    /* Test the keys in the CIM_Namespace for valid values
 521                       This includes all of the keys above the name key.
 522                       THis is a dummy for now.
 523                       ATTN: KS Extend and finish this function.
 524                    */
 525 karl          1.5  Boolean _validateProperties(const CIMObjectPath& path)
 526 karl          1.1  {
 527                        return true;
 528                    }
 529 karl          1.28 
 530 karl          1.5  Boolean _validateProperties(const CIMInstance& instance)
 531 karl          1.1  {
 532                        return true;
 533                    }
 534                    
 535 tony          1.6  /* Validate that the property exists, is string type and
 536 karl          1.5     optionally the value itself. Note processes only String
 537 tony          1.6     properties.
 538                       @param Instance to search for property.
 539                       @param CIMName containing property Name
 540 david.dillard 1.32    @value String containing value. If not String::EMPTY, compare to
 541 karl          1.5     value in the property
 542 tony          1.6     @return True if passes all tests
 543 karl          1.5  */
 544 david.dillard 1.32 Boolean _validateRequiredProperty(const CIMInstance& instance,
 545 karl          1.5                            const CIMName& propertyName,
 546                                              const String& value)
 547                    {
 548 tony          1.6      PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,
 549                                "InteropProvider::_validateRequiredProperty()");
 550 karl          1.5      Uint32 pos;
 551 tony          1.6  
 552 karl          1.5      if ((pos = instance.findProperty (propertyName)) == PEG_NOT_FOUND)
 553 tony          1.6      {
 554                            PEG_METHOD_EXIT();
 555 karl          1.5          return(false);
 556 tony          1.6      }
 557 karl          1.5      //
 558                        //  Get the property
 559                        //
 560                        CIMConstProperty theProperty = instance.getProperty(pos);
 561                        const CIMValue theValue = theProperty.getValue ();
 562                        //
 563 tony          1.6      //  ATTN: Required property must have a non-null value
 564 karl          1.5      //
 565 tony          1.6      if ((theValue.getType() != CIMTYPE_STRING) || (theValue.isNull()))
 566                        {
 567                            PEG_METHOD_EXIT();
 568 karl          1.5          return(false);
 569 tony          1.6      }
 570                    
 571                        String valueField;
 572                        theValue.get(valueField);
 573                        if ((value == String::EMPTY) || (valueField == value))
 574 karl          1.5      {
 575 tony          1.6          PEG_METHOD_EXIT();
 576                            return(true);
 577 karl          1.5      }
 578 tony          1.6      PEG_METHOD_EXIT();
 579                        return(false);
 580 karl          1.5  }
 581                    
 582                    Boolean _validateRequiredProperty(const CIMInstance& instance,
 583                                              const CIMName& propertyName,
 584                                              const Uint16& value)
 585                    {
 586 tony          1.6      PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,
 587                            "InteropProvider::_validateRequiredProperty()");
 588 david.dillard 1.32 
 589 tony          1.6      PEG_TRACE_STRING(TRC_CONTROLPROVIDER, Tracer::LEVEL4, "Validate "
 590                            + propertyName.getString());
 591                    
 592 karl          1.5      Uint32 pos;
 593                        if ((pos = instance.findProperty (propertyName)) == PEG_NOT_FOUND)
 594 tony          1.6      {
 595                            PEG_METHOD_EXIT();
 596 karl          1.5          return(false);
 597 tony          1.6      }
 598 karl          1.5      //
 599                        //  Get the property
 600                        //
 601                        CIMConstProperty theProperty = instance.getProperty(pos);
 602                        CIMValue theValue = theProperty.getValue ();
 603                        //
 604 tony          1.6      //  ATTN:Required property must have a non-null value
 605 karl          1.5      //
 606 david.dillard 1.32     if ((theValue.getType() != CIMTYPE_UINT16)
 607                            || (theValue.isNull()) )
 608 tony          1.6      {
 609                            PEG_METHOD_EXIT();
 610 karl          1.5          return(false);
 611 tony          1.6      }
 612                        PEG_METHOD_EXIT();
 613 karl          1.5      return(true);
 614                    }
 615 karl          1.28 
 616 karl          1.5  Boolean _validateRequiredProperty(const CIMObjectPath& objectPath,
 617                                              const CIMName& propertyName,
 618                                              const String value)
 619                    {
 620 tony          1.6      PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,
 621                                "InteropProvider::_validateRequiedProperty()");
 622 karl          1.5      Array<CIMKeyBinding> kbArray = objectPath.getKeyBindings();
 623                    
 624                        // find the correct key binding
 625                        for (Uint32 i = 0; i < kbArray.size(); i++)
 626                        {
 627                            if (kbArray[i].getName() == propertyName)
 628                            {
 629                                if (value != String::EMPTY)
 630                                {
 631                                    if (value !=kbArray[i].getValue())
 632                                    {
 633 tony          1.6                      PEG_METHOD_EXIT();
 634 karl          1.5                      return(true);
 635                                    }
 636                                }
 637                            }
 638                        }
 639 tony          1.6      PEG_METHOD_EXIT();
 640 karl          1.5      return(true);
 641                    }
 642 karl          1.1  
 643                    /* Query the repository for array of all namespacenames
 644 tony          1.6     @return Array<CIMNamespaceName> with all namespaces
 645                       @exception Passes all exception that repository may generate.
 646 david.dillard 1.32 */
 647 karl          1.1  Array<CIMNamespaceName> InteropProvider::_enumerateNameSpaces()
 648                    {
 649                        PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,
 650                                "InteropProvider::_enumerateNameSpaces()");
 651 tony          1.6  
 652 karl          1.1      Array<CIMNamespaceName> namespaceNames;
 653 david.dillard 1.32 
 654 tony          1.6      namespaceNames = _repository->enumerateNameSpaces();
 655 karl          1.1  
 656                        PEG_METHOD_EXIT();
 657                        return(namespaceNames);
 658                    }
 659                    
 660 tony          1.6  /* get a class defintion. Gets the class defined by
 661                        the parameters. Generates exception of class not defined.
 662 karl          1.1     @param namespace in which to look for the class.
 663                       @param name of class to get.
 664                       @return the CIMClass object
 665                       @Exceptions any repository exceptions if class not found.
 666 david.dillard 1.32 */
 667 karl          1.37 CIMClass InteropProvider::_getClass(const CIMObjectPath& objectPath,
 668 tony          1.6                                      const CIMName& className)
 669 karl          1.1  {
 670                        PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,
 671 tony          1.6              "InteropProvider::_getClass");
 672                    
 673 karl          1.37     CIMClass myClass = _repository->getClass(objectPath.getNameSpace(), className,
 674 tony          1.6                              false,true,true);
 675 karl          1.1      PEG_METHOD_EXIT();
 676                        return myClass;
 677                    }
 678                    
 679                    /* Verify that this is one of the legal classnames and
 680                       return indicator which.
 681                       @param - Classname
 682                       @return - Uint32 indicating type
 683                       @Exceptions - throws CIMNotSupportedException if invalid class.
 684                    */
 685 kumpf         1.17 static targetClass _verifyValidClassInput(const CIMName& className)
 686 karl          1.1  {
 687 karl          1.10     PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,
 688                                "InteropProvider::_verifyValidClassInput");
 689 karl          1.1      if (className.equal(CIM_OBJECTMANAGER_CLASSNAME))
 690                            return CIM_OBJECTMANAGER;
 691                    
 692 tony          1.6      if (className.equal(PG_CIMXMLCOMMUNICATIONMECHANISM_CLASSNAME))
 693                            return PG_CIMXMLCOMMUNICATIONMECHANISM;
 694 karl          1.1  
 695 karl          1.19     if (className.equal(CIM_NAMESPACEINMANAGER_CLASSNAME))
 696                            return CIM_NAMESPACEINMANAGER;
 697                    
 698 karl          1.10     // Last entry, reverse test and return OK if PG_Namespace
 699 karl          1.8      // Note: Changed to PG_Namespace for CIM 2.4
 700                        if (!className.equal(PG_NAMESPACE_CLASSNAME))
 701 karl          1.1          throw CIMNotSupportedException
 702                                (className.getString() + " not supported by Interop Provider");
 703                    
 704 karl          1.10     PEG_METHOD_EXIT();
 705 karl          1.8      return PG_NAMESPACE;
 706 karl          1.1  }
 707                    
 708 kumpf         1.17 static targetAssocClass _verifyValidAssocClassInput(const CIMName& className)
 709 tony          1.6  {
 710 karl          1.10     PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,
 711                                "InteropProvider::_verifyValidAssocClassInput");
 712 tony          1.6      if (className.equal(CIM_NAMESPACEINMANAGER_CLASSNAME))
 713 karl          1.19         return CIM_NAMESPACEINMANAGERASSOC;
 714                    
 715 karl          1.8      // Last entry, reverse test and return OK if CIM_CommMech....
 716 tony          1.6      if (!className.equal(CIM_COMMMECHANISMFORMANAGER_CLASSNAME))
 717                            throw CIMNotSupportedException
 718                                (className.getString() + " not supported by Interop Provider");
 719                    
 720 karl          1.10     PEG_METHOD_EXIT();
 721 karl          1.19     return CIM_COMMMECHANISMFORMANAGERASSOC;
 722 tony          1.6  }
 723                    
 724 karl          1.1  /* validate the authorization of the user name against the namespace.
 725                    */
 726                    String _validateUserID(const OperationContext & context)
 727                    {
 728 karl          1.10     PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,
 729                                "InteropProvider::_validateUserID");
 730 karl          1.1      //ATTN-DME-P3-20020522: ADD AUTHORIZATION CHECK TO __NAMESPACE PROVIDER
 731                        String userName;
 732                        try
 733                        {
 734                            IdentityContainer container = context.get(IdentityContainer::NAME);
 735                            userName = container.getUserName();
 736                        }
 737 karl          1.10 
 738 karl          1.1      catch (...)
 739                        {
 740                           userName = String::EMPTY;
 741                        }
 742 karl          1.10 
 743                        PEG_METHOD_EXIT();
 744 karl          1.1      return userName;
 745                    }
 746                    
 747 karl          1.11 /** Set the value of a property defined by property name in the instance provided.
 748 tony          1.6      Sets a String into the value field unless the property name cannot be found.
 749                        If the property cannot be found, it simply returns.
 750                        ATTN: This function does not pass an error back if property not found.
 751                        @param instance CIMInstance in which to set property value
 752                        @param propertyName CIMName of property in which value will be set.
 753                        @param value String value to set into property
 754 david.dillard 1.32 
 755 tony          1.6  */
 756                    void _setPropertyValue(CIMInstance& instance, const CIMName propertyName, const String& value)
 757                    {
 758                        Uint32 pos;
 759                        if ((pos = instance.findProperty(propertyName)) != PEG_NOT_FOUND)
 760                            instance.getProperty(pos).setValue(CIMValue(value));
 761                    }
 762                    
 763                    void _setPropertyValue(CIMInstance& instance, const CIMName propertyName, const Boolean& value)
 764                    {
 765                        Uint32 pos;
 766                        if ((pos = instance.findProperty(propertyName)) != PEG_NOT_FOUND)
 767                            instance.getProperty(pos).setValue(CIMValue(value));
 768                    }
 769 karl          1.1  
 770 tony          1.6  void _setPropertyValue(CIMInstance& instance, const CIMName propertyName, const Uint16& value)
 771                    {
 772                        Uint32 pos;
 773                        if ((pos = instance.findProperty(propertyName)) != PEG_NOT_FOUND)
 774                            instance.getProperty(pos).setValue(CIMValue(value));
 775                    }
 776                    
 777                    void _setPropertyValue(CIMInstance& instance, const CIMName propertyName, const Array<String>& value)
 778                    {
 779                        Uint32 pos;
 780                        if ((pos = instance.findProperty(propertyName)) != PEG_NOT_FOUND)
 781                            instance.getProperty(pos).setValue(CIMValue(value));
 782                    }
 783                    
 784                    void _setPropertyValue(CIMInstance& instance, const CIMName propertyName, const Array<Uint16>& value)
 785                    {
 786                        Uint32 pos;
 787                        if ((pos = instance.findProperty(propertyName)) != PEG_NOT_FOUND)
 788                            instance.getProperty(pos).setValue(CIMValue(value));
 789                    }
 790                    
 791 tony          1.6  void _setPropertyValue(CIMInstance& instance, const CIMName propertyName, const CIMObjectPath& value)
 792                    {
 793                        Uint32 pos;
 794                        if ((pos = instance.findProperty(propertyName)) != PEG_NOT_FOUND)
 795                            instance.getProperty(pos).setValue(CIMValue(value));
 796                    }
 797                    
 798                    /** add the correct values to the common keys defined for all of the classes. This is
 799                        systemcreationclassname and systemname
 800                        Note that if the properties do not exist, we simply ignore them.
 801                    */
 802                    void _fixInstanceCommonKeys(CIMInstance& instance)
 803 karl          1.1  {
 804                        PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,
 805 tony          1.6              "InteropProvider::_fixInstanceCommonKeys()");
 806 karl          1.1      String SystemCreationClassName = System::getSystemCreationClassName ();
 807                    
 808 karl          1.37     _setPropertyValue(instance, CIM_NAMESPACE_PROPERTY_SYSTEMCREATIONCLASSNAME,
 809                                SystemCreationClassName);
 810 karl          1.1  
 811 karl          1.5      // Add property SystemName
 812 karl          1.37     _setPropertyValue(instance, CIM_NAMESPACE_PROPERTY_SYSTEMNAME,
 813                                System::getFullyQualifiedHostName());
 814 karl          1.1      PEG_METHOD_EXIT();
 815                    }
 816                    
 817 tony          1.6  /** builds one instance of the class named className. Gets Class defintion and f
 818                        fills in the correct properties from the class.  This requires a repository
 819                        getclass request for each instance built. The skeleton is built by
 820                        creating the instance and copying qualifiers and properties from
 821                        the class. Finally the instance is cloned to separate it from the
 822                        original objects.
 823                        NOTE: This is very inefficient for anything larger than a few instances.
 824                        We should separate the get from the createSkeleton.
 825                        @param className CIMName of the class for which the instance is to be built
 826                        @return CIMInstance of this class with properties complete.
 827                        @exception passes on any exceptions received from the repository request.
 828                    */
 829 karl          1.37 CIMInstance InteropProvider::_buildInstanceSkeleton(const CIMObjectPath & objectPath,
 830 karl          1.40                                                     const CIMName& className,
 831                                                                        CIMClass& returnedClass)
 832 karl          1.1  {
 833                        PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,
 834 tony          1.6              "InteropProvider::_buildInstanceSkeleton()");
 835 karl          1.40     // get class with lo = false, qualifier = true classorig = true
 836                        CIMClass myClass = _repository->getClass(objectPath.getNameSpace(),
 837 karl          1.37                                         className, false, true, true);
 838 karl          1.40     returnedClass = myClass;
 839                        CIMInstance skeleton = myClass.buildInstance(true,true,CIMPropertyList());
 840 karl          1.1  
 841                        PEG_METHOD_EXIT();
 842 karl          1.40     return(skeleton);
 843 karl          1.1  }
 844                    
 845 tony          1.6  /* build a single instance of the cimxmlcommunicationmechanism class
 846                       using the parameter provided as the name property
 847                       @parm name String representing the name to be used for this object.
 848                       @return CIMInstance of the class
 849 karl          1.5  */
 850 tony          1.6  CIMInstance InteropProvider::_buildInstancePGCIMXMLCommunicationMechanism(
 851 karl          1.37             const CIMObjectPath& objectPath,
 852                                const String& namespaceType,
 853 karl          1.41             const Uint16& accessProtocol,
 854 karl          1.37             const String& IPAddress,
 855                                const Boolean& includeQualifiers,
 856                                const Boolean& includeClassOrigin,
 857                                const CIMPropertyList& propertyList)
 858 karl          1.1  {
 859                        PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,
 860 tony          1.6              "InteropProvider::_buildInstancePGCIMXMLCommunicationMechanism()");
 861 karl          1.40     CIMClass targetClass;
 862 karl          1.37     CIMInstance instance = _buildInstanceSkeleton(objectPath,
 863 karl          1.40                             PG_CIMXMLCOMMUNICATIONMECHANISM_CLASSNAME,
 864                                                targetClass);
 865 karl          1.1  
 866 tony          1.6      _fixInstanceCommonKeys(instance);
 867 karl          1.1  
 868 tony          1.6      //CreationClassName
 869 karl          1.37     _setPropertyValue(instance, CIM_NAMESPACE_PROPERTY_CREATIONCLASSNAME,
 870                                PG_CIMXMLCOMMUNICATIONMECHANISM_CLASSNAME.getString());
 871 karl          1.1  
 872 karl          1.19     //Name, this CommunicationMechanism.  We need to make it unique.  To do this
 873                        // we simply append the commtype to the classname since we have max of two right
 874                        // now.
 875 karl          1.37     _setPropertyValue(instance, CIM_NAMESPACE_PROPERTY_NAME,
 876                                (String("PEGASUSCOMM") + namespaceType));
 877 karl          1.1  
 878 karl          1.19     // CommunicationMechanism Property - Force to 2.
 879 tony          1.6      _setPropertyValue(instance, OM_COMMUNICATIONMECHANISM, Uint16(2));
 880 karl          1.1  
 881                        //Functional Profiles Supported Property.
 882                        Array<Uint16> profiles;
 883 tony          1.6      Array<String> profileDescriptions = _getFunctionalProfiles(profiles);
 884 karl          1.1  
 885 tony          1.6      // Set functional profiles in instance
 886                        _setPropertyValue(instance, OM_FUNCTIONALPROFILESSUPPORTED, profiles);
 887                    
 888                        _setPropertyValue(instance, OM_FUNCTIONALPROFILEDESCRIPTIONS, profileDescriptions);
 889 karl          1.1  
 890                        // Multiple OperationsSupported Property
 891 tony          1.6      _setPropertyValue(instance, OM_MULTIPLEOPERATIONSSUPPORTED, false);
 892 karl          1.5  
 893                        // AuthenticationMechanismsSupported Property
 894 karl          1.1      Array<Uint16> authentications;
 895                        Array<String> authenticationDescriptions;
 896 karl          1.5  
 897 david.dillard 1.32     // Note that we have fixed authentication here.
 898 tony          1.7      authentications.append(3); authenticationDescriptions.append("Basic");
 899 karl          1.5  
 900 tony          1.6      _setPropertyValue(instance, OM_AUTHENTICATIONMECHANISMSSUPPORTED, authentications);
 901                    
 902                        _setPropertyValue(instance, OM_AUTHENTICATIONMECHANISMDESCRIPTIONS, authenticationDescriptions);
 903 david.dillard 1.32 
 904 tony          1.6      _setPropertyValue(instance, OM_VERSION, CIMXMLProtocolVersion);
 905                    
 906 marek         1.33     // Obsolete function 
 907                        _setPropertyValue(instance, "namespaceType", namespaceType);
 908 tony          1.6  
 909 karl          1.41     _setPropertyValue(instance, "namespaceAccessProtocol", accessProtocol);
 910                    
 911 tony          1.6      _setPropertyValue(instance, "IPAddress", IPAddress);
 912 karl          1.1  
 913                        PEG_METHOD_EXIT();
 914                        return(instance);
 915                    }
 916 tony          1.6  
 917                    Array<CIMInstance> InteropProvider::_buildInstancesPGCIMXMLCommunicationMechanism(
 918 karl          1.37                                             const CIMObjectPath& objectPath,
 919 tony          1.6                                              const Boolean includeQualifiers,
 920                                                                const Boolean includeClassOrigin,
 921                                                                const CIMPropertyList& propertyList)
 922                    {
 923 karl          1.10     PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,
 924                                "InteropProvider::_buildInstancesPGCIMXMLCommunicationMechanism");
 925 david.dillard 1.32 
 926 tony          1.6      // This is a temporary hack to get the multiple connections.
 927 karl          1.41     // This is based on the configmanager being the source of what
 928                        // protocols are available, http and https.
 929                    
 930 tony          1.6      ConfigManager* configManager = ConfigManager::getInstance();
 931                        Boolean enableHttpConnection = String::equal(
 932                            configManager->getCurrentValue("enableHttpConnection"), "true");
 933                        Boolean enableHttpsConnection = String::equal(
 934                            configManager->getCurrentValue("enableHttpsConnection"), "true");
 935                    
 936                        Array<CIMInstance> instances;
 937 karl          1.41     Uint32 namespaceAccessProtocol;
 938                        String namespaceType;
 939 tony          1.6  
 940 karl          1.41     // for each type, create the instance if that type is defined.
 941 karl          1.42     String hostName = System::getHostName();
 942 tony          1.6      if (enableHttpConnection)
 943                        {
 944 karl          1.41         namespaceAccessProtocol = 2;
 945                            namespaceType = "http";
 946                            CIMInstance instance = 
 947                                _buildInstancePGCIMXMLCommunicationMechanism(
 948                                    objectPath,
 949                                    namespaceType,
 950                                    namespaceAccessProtocol,
 951 karl          1.42                 _getHostAddress(hostName, namespaceAccessProtocol),
 952 karl          1.41                 includeQualifiers,
 953                                    includeClassOrigin,
 954                                    propertyList);
 955 tony          1.6          instances.append(instance);
 956                        }
 957                    
 958                        if (enableHttpsConnection)
 959                        {
 960 karl          1.41         namespaceAccessProtocol = 3;
 961                            namespaceType = "https";
 962                            CIMInstance instance = 
 963                                _buildInstancePGCIMXMLCommunicationMechanism(
 964                                    objectPath,
 965                                    namespaceType,
 966                                    namespaceAccessProtocol,
 967 karl          1.42                 _getHostAddress(hostName, namespaceAccessProtocol),
 968 karl          1.41                 includeQualifiers,
 969                                    includeClassOrigin,
 970                                    propertyList);
 971 tony          1.6          instances.append(instance);
 972                        }
 973 karl          1.40 
 974 karl          1.41 
 975 karl          1.10     PEG_METHOD_EXIT();
 976 tony          1.6      return(instances);
 977                    }
 978                    /*  Gets the value for the CIMObjectManager name.  This is a key
 979                        property with the following characteristics.
 980                        1. It is persistent. This must be persistent through CIMOM
 981 david.dillard 1.32     restarts.  We will save it in the instance database to achieve this.
 982 tony          1.6      2. It must be unique. We cannot create duplicate CIMOM names
 983                        3. It is based on the DMTF description of how unique InstanceIds
 984                        are defined (Trademark/etc followed by unique identification.
 985                        Use the Global constant PegasusInstanceIDGlobalPrefix as the
 986                        prefix allowing this to be changed.
 987                    */
 988                    String buildObjectManagerName()
 989                    {
 990                        return(getTrademarkCIMOMIDPrefix() + ":" + getUUIDString());
 991 karl          1.1  }
 992                    
 993 karl          1.10 /** get either the local or disk CIMObjectmanager instance.
 994 david.dillard 1.32     @return Boolean true if already exists. False if
 995 karl          1.10     not initialized. Also returns with the current version set
 996                        into local parameter.
 997                        ATTN: Probably should get rid of the local parameter since
 998                        this is used so infrequently, waste of space.
 999                    */
1000 karl          1.26 Boolean InteropProvider::_getInstanceFromRepositoryCIMObjectManager(
1001 karl          1.37                         const CIMObjectPath& objectPath,
1002 karl          1.26                         CIMInstance& rtnInstance,
1003 karl          1.10                         const Boolean includeQualifiers,
1004                                            const Boolean includeClassOrigin,
1005                                            const CIMPropertyList& propertyList)
1006                    {
1007                        PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,
1008                                "InteropProvider::_getInstanceCIMObjectManager");
1009 karl          1.41 
1010 karl          1.10     // Try to get persistent instance from repository
1011                        Array<CIMInstance> instances;
1012                        try
1013                        {
1014 karl          1.37         instances = _repository->enumerateInstances(
1015                                    objectPath.getNameSpace(),
1016                                    CIM_OBJECTMANAGER_CLASSNAME, true, false, includeQualifiers,
1017                                    includeClassOrigin, propertyList);
1018 karl          1.26 
1019                            CDEBUG("_getInstancefrom... " << instances.size());
1020 karl          1.10         if (instances.size() >= 1)
1021                            {
1022                                // set this instance into global variable.
1023 karl          1.26             rtnInstance = instances[0];
1024 david.dillard 1.32 
1025 karl          1.10             // log entry if there is more than one instance.
1026                                // Some day we may support multiple entries to see other CIMOMs but
1027                                // for now this should be illegal and represent an internal error.
1028                                // but we will still continue to use the first entry.
1029                                if (instances.size() > 1)
1030                                {
1031 karl          1.37                 Logger::put(Logger::ERROR_LOG,
1032                                        System::CIMSERVER, Logger::INFORMATION,
1033                                        "Error. Multiple definitons of : $0",
1034                                        CIM_OBJECTMANAGER_CLASSNAME.getString());
1035 karl          1.10             }
1036                                return(true);
1037                            }
1038                            else
1039 karl          1.26         {
1040 karl          1.10             return(false);
1041 karl          1.26         }
1042 karl          1.10     }
1043 david.dillard 1.32     catch(const CIMException&)
1044 karl          1.10     {
1045                            Logger::put(Logger::ERROR_LOG, System::CIMSERVER, Logger::INFORMATION,
1046 karl          1.37             "Error. Cannot access $0 in repository", 
1047                                CIM_OBJECTMANAGER_CLASSNAME.getString());
1048 karl          1.10         PEG_METHOD_EXIT();
1049 david.dillard 1.32         throw;
1050 karl          1.10     }
1051 david.dillard 1.32     catch(const Exception&)
1052 karl          1.10     {
1053                            Logger::put(Logger::ERROR_LOG, System::CIMSERVER, Logger::INFORMATION,
1054 karl          1.37             "Error. Cannot access $0 in repository", 
1055                                CIM_OBJECTMANAGER_CLASSNAME.getString());
1056 karl          1.10         PEG_METHOD_EXIT();
1057 david.dillard 1.32         throw;
1058 karl          1.10     }
1059                    }
1060                    
1061 tony          1.6  /** build an instance of the CIM_ObjectManager class filling out
1062 karl          1.26     the required properties if one does not already exist in the
1063                        repository. This function will either return an instance
1064                        or throw an exception.
1065 tony          1.6      @param includeQualifiers Boolean
1066                        @param includeClassOrigin Boolean
1067 david.dillard 1.32     @param propertylist CIMPropertyList
1068 tony          1.6      @return CIMInstance with a single built instance of the class
1069                        @exception repository instances if exception to enumerateInstances
1070                            for this class.
1071                    */
1072 karl          1.26 CIMInstance InteropProvider::_getInstanceCIMObjectManager(
1073 karl          1.37                         const CIMObjectPath& objectPath,
1074 tony          1.6                          const Boolean includeQualifiers,
1075                                            const Boolean includeClassOrigin,
1076                                            const CIMPropertyList& propertyList)
1077 karl          1.1  {
1078                        PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,
1079 karl          1.10             "InteropProvider::_buildInstanceCIMObjectManager");
1080 karl          1.1  
1081 karl          1.10     // Try to get the current object.  If true then it is already created.
1082 karl          1.24     CIMInstance instance;
1083 karl          1.37     if (!_getInstanceFromRepositoryCIMObjectManager(objectPath,
1084                                    instance, includeQualifiers,includeClassOrigin,propertyList))
1085 karl          1.24     {
1086                            //
1087                            // No instance in the repository. Build new instance and save it.
1088                            //
1089 karl          1.40         CIMClass targetClass;
1090                            instance = _buildInstanceSkeleton(objectPath, CIM_OBJECTMANAGER_CLASSNAME,
1091                                        targetClass);
1092 david.dillard 1.32 
1093 karl          1.24         _fixInstanceCommonKeys(instance);
1094 david.dillard 1.32 
1095 karl          1.37         _setPropertyValue(instance, CIM_NAMESPACE_PROPERTY_CREATIONCLASSNAME,
1096                                    CIM_OBJECTMANAGER_CLASSNAME.getString());
1097 karl          1.24         _setPropertyValue(instance, CIM_NAMESPACE_PROPERTY_NAME,buildObjectManagerName());
1098                            _setPropertyValue(instance, CIMName("ElementName"), String("Pegasus"));
1099 david.dillard 1.32 
1100 karl          1.24         //
1101                            //Description property this object manager instance
1102 karl          1.43         // default is Pegasus CIM_Server Version. Get from
1103                            // fields defined in PegasusVersion.
1104                            // TODO. Add as an alternative the capability to get this
1105                            // from config parameters.
1106                            // If PEGASUS_CIMOM_DESCRIPTION is non-zero length, use it.
1107                            // Otherwise build form the components below.
1108                    
1109                            String description = (String(PEGASUS_CIMOM_DESCRIPTION).size() != 0) ?
1110                                    String(PEGASUS_CIMOM_DESCRIPTION)
1111                                :
1112                                    String(PEGASUS_CIMOM_GENERIC_NAME) + " " +
1113                                    String(PEGASUS_PRODUCT_NAME) + " Version " +
1114                                    String(PEGASUS_PRODUCT_VERSION) + " " +
1115                                    String(PEGASUS_PRODUCT_STATUS);
1116 david.dillard 1.32 
1117 karl          1.43         cout << "Description: " << description << endl;
1118 karl          1.24         _setPropertyValue(instance, CIMName("Description"), description);
1119 david.dillard 1.32 
1120 karl          1.24         //Property GatherStatisticalData. Initially this is set to false
1121                            // and can then be modified by a modify instance on the instance.
1122 david.dillard 1.32 
1123 karl          1.24         Boolean gatherStatDataFlag = false;
1124 david.dillard 1.32 
1125 karl          1.24         _setPropertyValue(instance, OM_GATHERSTATISTICALDATA, Boolean(gatherStatDataFlag));
1126 david.dillard 1.32 
1127 karl          1.24         // ATTN: This one is a problem KS rethink this.
1128                            // the following is a temporary hack to set the value of the statistics
1129                            // gathering function dynamically.  We simply get the correct value
1130                            // and call the internal method to set it each time this object is
1131                            // built.
1132                        #ifndef PEGASUS_DISABLE_PERFINST
1133                            StatisticalData* sd = StatisticalData::current();
1134                            sd->setCopyGSD(gatherStatDataFlag);
1135                        #endif
1136 david.dillard 1.32 
1137 karl          1.24         // write instance to the repository
1138                            CIMObjectPath instancePath;
1139                            // Add the instance path to this if necessary ATTN ATTN:
1140                            try
1141                            {
1142 karl          1.28             CDEBUG("Create Instance for CIM_ObjectManager");
1143 karl          1.37             instancePath = _repository->createInstance(objectPath.getNameSpace(),
1144 karl          1.24                            instance );
1145                            }
1146 david.dillard 1.32         catch(const CIMException&)
1147 karl          1.24         {
1148                                // ATTN: KS generate log error if this not possible
1149                                PEG_METHOD_EXIT();
1150 david.dillard 1.32             throw;
1151 karl          1.24         }
1152 david.dillard 1.32         catch(const Exception&)
1153 karl          1.24         {
1154                                // ATTN: Generate log error.
1155                                PEG_METHOD_EXIT();
1156 david.dillard 1.32             throw;
1157 karl          1.24         }
1158                            instance.setPath(instancePath);
1159 karl          1.5      }
1160 karl          1.40     // KS_TEMP Drop Thisinstance.filter(includeQualifiers, includeClassOrigin, propertyList);
1161 karl          1.5      PEG_METHOD_EXIT();
1162 karl          1.20     return(instance);
1163 karl          1.1  }
1164                    
1165 karl          1.8  /** Get the instances of CIM_Namespace. Gets all instances of the namespace from
1166 karl          1.40     the repository namespace management functions. Builds instances that
1167                        match all of the request attributes.
1168 tony          1.6  */
1169 karl          1.37 Array<CIMInstance> InteropProvider::_getInstancesCIMNamespace(
1170                                                const CIMObjectPath& objectPath,
1171                                                const Boolean& includeQualifiers,
1172 tony          1.6                              const Boolean& includeClassOrigin,
1173                                                const CIMPropertyList& propertyList)
1174                    {
1175                        PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,
1176                                "InteropProvider::_getInstancesCIMNamespace()");
1177 karl          1.8  
1178                        CDEBUG("_getinstancesPGNamespace");
1179 tony          1.6      Array<CIMNamespaceName> namespaceNames = _enumerateNameSpaces();
1180 karl          1.10     CDEBUG("_getInstancesCIMNamespace. count = " << namespaceNames.size());
1181 tony          1.6      Array<CIMInstance> instanceArray;
1182                    
1183 karl          1.40     // Build instances of PG namespace since that is the leaf class
1184 tony          1.6      for (Uint32 i = 0; i < namespaceNames.size(); i++)
1185                        {
1186 karl          1.37        instanceArray.append( _buildInstancePGNamespace(objectPath, namespaceNames[i]));
1187 tony          1.6      }
1188 karl          1.10     CDEBUG("Build this many PG_Namespace Instances. count= " << instanceArray.size());
1189 tony          1.6      PEG_METHOD_EXIT();
1190                        return(instanceArray);
1191                    }
1192                    
1193                    /** get the instance of namespace defined by the input parameter which is the object path
1194                        for the instance required.
1195                        ATTN: Note that this is incorrect. We are supplying the namespace name and need to supply
1196                        the objectpath
1197 karl          1.37     @param objectPath CIMObjectPath from request
1198                        @param nameSpace CIMNamespaceName for instance to get
1199 tony          1.6      @return CIMInstance with the found instance or CIMInstance() if nothing found.
1200                    */
1201 karl          1.37 CIMInstance InteropProvider::_getInstanceCIMNamespace(const CIMObjectPath& objectPath)
1202 tony          1.6  {
1203                        PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,
1204                                "InteropProvider::_getInstancesCIMNamespace()");
1205                    
1206 karl          1.37     Array<CIMInstance> instances = _getInstancesCIMNamespace(objectPath, true, true, CIMPropertyList());
1207 tony          1.6  
1208 karl          1.37     CIMNamespaceName nameSpace = objectPath.getNameSpace();
1209 karl          1.8      // search the instances for one with the name property value = input parameter.
1210 tony          1.6      for (Uint32 i = 0 ; i < instances.size() ; i++)
1211                        {
1212 karl          1.8          if (_getPropertyValue(instances[i], CIMName("name"), String::EMPTY) == nameSpace.getString())
1213 tony          1.6          {
1214                                PEG_METHOD_EXIT();
1215                                return(instances[i]);
1216                            }
1217                        }
1218                        PEG_METHOD_EXIT();
1219                        CIMInstance nullInstance;
1220                        return(nullInstance);
1221                    }
1222                    
1223 karl          1.37 CIMObjectPath InteropProvider::_buildReference(const CIMObjectPath& objectPath,
1224                            const CIMInstance& instance, const CIMName& className)
1225 tony          1.6  {
1226 karl          1.37     return(_buildObjectPath(objectPath,className, instance));
1227 tony          1.6  }
1228                    
1229 karl          1.37 Array<CIMInstance> InteropProvider::_buildInstancesNamespaceInManager(const CIMObjectPath& objectPath)
1230 tony          1.6  {
1231 karl          1.10     PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,
1232                                "InteropProvider::_buildInstancesNamespaceInManager");
1233 tony          1.6  
1234 karl          1.37     Array<CIMInstance> namespaceInstances = _getInstancesCIMNamespace(objectPath, false,
1235 tony          1.6                              false, CIMPropertyList());
1236                    
1237 karl          1.37     CIMInstance instanceObjMgr = _getInstanceCIMObjectManager(objectPath, true, true, CIMPropertyList());
1238 tony          1.6  
1239 karl          1.37     CIMObjectPath refObjMgr = _buildReference(objectPath,instanceObjMgr, CIM_OBJECTMANAGER_CLASSNAME);
1240 tony          1.6  
1241                        Array<CIMInstance> assocInstances;
1242 karl          1.40     CIMClass targetClass;
1243 tony          1.6  
1244                        for (Uint32 i = 0 ; i < namespaceInstances.size() ; i++)
1245                        {
1246 karl          1.40         CIMInstance instance = _buildInstanceSkeleton(objectPath, CIM_NAMESPACEINMANAGER_CLASSNAME,
1247                                                                        targetClass);
1248 tony          1.6  
1249 aruran.ms     1.36         _setPropertyValue(instance, CIMName("Antecedent"), refObjMgr);
1250 tony          1.6          //ATTNATTN: this is weak qualifier.
1251 karl          1.37         _setPropertyValue(instance, CIMName("Dependent"), 
1252                                _buildReference(objectPath, namespaceInstances[i], CIM_NAMESPACEINMANAGER_CLASSNAME));
1253 karl          1.40         instance.setPath(instance.buildPath(targetClass));
1254 tony          1.6          assocInstances.append(instance);
1255                        }
1256 karl          1.10 
1257                        PEG_METHOD_EXIT();
1258 karl          1.40     
1259 tony          1.6      return(assocInstances);
1260                    }
1261                    
1262 karl          1.37 Array<CIMInstance> InteropProvider::_buildInstancesCommMechanismForManager(
1263                        const CIMObjectPath& objectPath)
1264 tony          1.6  {
1265 karl          1.10     PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,
1266                                "InteropProvider::_buildInstancesCommMechanismForManager");
1267 tony          1.6  
1268 karl          1.37     Array<CIMInstance> commInstances = _buildInstancesPGCIMXMLCommunicationMechanism(
1269                             objectPath,true,
1270 tony          1.6           true, CIMPropertyList());
1271                    
1272 karl          1.37     CIMInstance instanceObjMgr = _getInstanceCIMObjectManager(objectPath, true, true, CIMPropertyList());
1273 tony          1.6  
1274 karl          1.37     CIMObjectPath refObjMgr = _buildReference(objectPath, instanceObjMgr, CIM_OBJECTMANAGER_CLASSNAME);
1275 karl          1.40 
1276 tony          1.6      Array<CIMInstance> assocInstances;
1277 karl          1.40     CIMClass targetClass;
1278 tony          1.6      for (Uint32 i = 0 ; i < commInstances.size() ; i++)
1279                        {
1280 david.dillard 1.32 
1281 karl          1.40         CIMInstance instance = _buildInstanceSkeleton(objectPath,CIM_COMMMECHANISMFORMANAGER_CLASSNAME,
1282                                                                          targetClass);
1283 tony          1.6  
1284 aruran.ms     1.36         _setPropertyValue(instance,CIMName("Antecedent"), refObjMgr);
1285 tony          1.6          //ATTNATTN: this is weak qualifier.
1286 karl          1.37         _setPropertyValue(instance,CIMName("Dependent"), 
1287                                _buildReference(objectPath, commInstances[i],CIM_COMMMECHANISMFORMANAGER_CLASSNAME));
1288 karl          1.40 
1289                            instance.setPath(instance.buildPath(targetClass));
1290 tony          1.6          assocInstances.append(instance);
1291                        }
1292 karl          1.10 
1293                        PEG_METHOD_EXIT();
1294 tony          1.6      return(assocInstances);
1295                    }
1296                    
1297 karl          1.1  /* generate one instance of the CIM_Namespace class with the
1298                       properties
1299 karl          1.8     NOTE: CIM 2.4 - Changed to build PG namespace
1300 karl          1.37    @param objectPath
1301 karl          1.1     @param namespace name to put into the class
1302                       @exceptions - exceptions carried forward from create instance
1303                       and addProperty.
1304                    */
1305 karl          1.37 CIMInstance InteropProvider::_buildInstancePGNamespace(const CIMObjectPath& objectPath,
1306                            CIMNamespaceName& nameSpace)
1307 karl          1.1  {
1308                        PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,
1309 karl          1.10             "InteropProvider::_buildInstancePGNamespace");
1310 david.dillard 1.32 
1311 tony          1.6      // ATTN: KS need to get the real objectManager name from elsewhere.  the only place
1312 david.dillard 1.32     // this exists is through the objectmanager object.
1313 tony          1.6      // ATTN: Should we be saving the objectmanager name somewhere internally either in
1314                        // interop or more generally somewhere within the system for common access.
1315 karl          1.1      String ObjectManagerName = "ObjectManagerNameValue";
1316 david.dillard 1.32 
1317 karl          1.40     CIMClass targetClass;
1318                        CIMInstance instance = _buildInstanceSkeleton(objectPath, PG_NAMESPACE_CLASSNAME,
1319                                                                      targetClass);
1320 karl          1.1  
1321 tony          1.6      _fixInstanceCommonKeys(instance);
1322 karl          1.1  
1323                        //ObjectManagerCreationClassName
1324 tony          1.6      _setPropertyValue(instance, CIM_NAMESPACE_PROPERTY_OBJECTMANAGERCREATIONCLASSNAME, CIM_OBJECTMANAGER_CLASSNAME.getString());
1325                    
1326 karl          1.1      //ObjectManagerName
1327 tony          1.6      _setPropertyValue(instance, CIM_NAMESPACE_PROPERTY_OBJECTMANAGERNAME, ObjectManagerName);
1328                    
1329 karl          1.1      //CreationClassName
1330 david.dillard 1.32     // Class in which this was created,
1331 tony          1.6      _setPropertyValue(instance, CIM_NAMESPACE_PROPERTY_CREATIONCLASSNAME, CIM_NAMESPACE_CLASSNAME.getString());
1332 karl          1.1      //Name
1333 tony          1.6      // This is the namespace name itself
1334                        _setPropertyValue(instance, CIM_NAMESPACE_PROPERTY_NAME, nameSpace.getString());
1335 karl          1.1  
1336                        //ClassInfo
1337 tony          1.6      // Set the classinfo to unknown and the description to namespace.
1338                        _setPropertyValue(instance, CIM_NAMESPACE_PROPERTY_CLASSINFO, Uint16(0));
1339                        _setPropertyValue(instance, CIM_NAMESPACE_PROPERTY_DESCRIPTIONOFCLASSINFO, String("namespace"));
1340                    
1341 karl          1.8      //
1342                        //  Everything above was commmon to CIM Namespace.  The following is PG_Namespace Properties
1343                        //
1344                        // ATTN: KS Get the correct values for these entities from repository interface.
1345 karl          1.28 
1346                        CIMRepository::NameSpaceAttributes attributes;
1347 karl          1.8      _repository->getNameSpaceAttributes(nameSpace.getString(), attributes);
1348                        String parent="";
1349 karl          1.11 	String name = "";
1350 karl          1.8      Boolean shareable=false;
1351                        Boolean updatesAllowed=true;
1352 david.dillard 1.32     for (CIMRepository::NameSpaceAttributes::Iterator i = attributes.start(); i; i++)
1353 karl          1.8      {
1354                           String key=i.key();
1355 karl          1.10        String value = i.value();
1356 karl          1.28 
1357 karl          1.8         if (String::equalNoCase(key,"shareable"))
1358 karl          1.11 	   {
1359 karl          1.10           if (String::equalNoCase(value,"true"))
1360                                  shareable=true;
1361 karl          1.11 	   }
1362 david.dillard 1.32        else if (String::equalNoCase(key,"updatesAllowed"))
1363 karl          1.11 	   {
1364 karl          1.10           if (String::equalNoCase(value,"false"))
1365                                  updatesAllowed=false;
1366 karl          1.11 	   }
1367 karl          1.10        // Test to be sure we are returning proper namespace name
1368                           else if (String::equalNoCase(key,"name"))
1369 karl          1.8         {
1370 karl          1.10           if (!String::equalNoCase(value, nameSpace.getString()))
1371                              {
1372                                  PEG_METHOD_EXIT();
1373                                  // This is poor exception since it reflects internal error. Do error log
1374 david.dillard 1.32               throw PEGASUS_CIM_EXCEPTION (CIM_ERR_NOT_SUPPORTED,
1375 karl          1.10                   "Namespace attribute rtnd error for key " + key + "expected " +
1376                                       nameSpace.getString()+ value + " in " + String(thisProvider));
1377                              }
1378 karl          1.11 
1379                    		  name = value;
1380 karl          1.8         }
1381                           else if (String::equalNoCase(key,"parent"))
1382 karl          1.11 	   {
1383 karl          1.10           parent=value;
1384 karl          1.11 	   }
1385 david.dillard 1.32        else
1386 karl          1.8         {
1387                              PEG_METHOD_EXIT();
1388 karl          1.10           // Poor error definition since it reflects internal error. do error log
1389 karl          1.8            throw PEGASUS_CIM_EXCEPTION (CIM_ERR_NOT_SUPPORTED, nameSpace.getString()+
1390 karl          1.10               " namespace attribute " + key + " option not supported in"+ String(thisProvider));
1391 karl          1.8         }
1392                        }
1393                        _setPropertyValue(instance, PG_NAMESPACE_PROPERTY_SCHEMAUPDATESALLOWED, updatesAllowed);
1394                        _setPropertyValue(instance, PG_NAMESPACE_PROPERTY_ISSHAREABLE, shareable);
1395                        _setPropertyValue(instance, PG_NAMESPACE_PROPERTY_PARENTNAMESPACE, parent);
1396 karl          1.11 	_setPropertyValue(instance, PG_NAMESPACE_PROPERTY_NAME, name);
1397 karl          1.8  
1398 karl          1.40     instance.setPath(instance.buildPath(targetClass));
1399 karl          1.1      PEG_METHOD_EXIT();
1400                        return(instance);
1401                    }
1402 karl          1.37 
1403 karl          1.5  void _validateCIMNamespaceKeys(const CIMObjectPath& objectPath)
1404                    {
1405 tony          1.6      PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,
1406                                "InteropProvider::_validateCIMNamespaceKeys");
1407                    
1408 karl          1.5      Boolean valid = true;
1409                        CIMName propertyName;
1410                        if (!_validateRequiredProperty(objectPath,
1411                                    CIM_NAMESPACE_PROPERTY_SYSTEMCREATIONCLASSNAME,
1412                                    System::getSystemCreationClassName ()))
1413                        {
1414                            propertyName = CIM_NAMESPACE_PROPERTY_SYSTEMCREATIONCLASSNAME;
1415                            valid = false;
1416                        }
1417                        if (!_validateRequiredProperty(objectPath,
1418                                    CIM_NAMESPACE_PROPERTY_SYSTEMNAME,
1419 joyce.j       1.30                 System::getFullyQualifiedHostName()))
1420 karl          1.5      {
1421                            propertyName = CIM_NAMESPACE_PROPERTY_SYSTEMNAME;
1422                            valid = false;
1423                        }
1424                        if (!_validateRequiredProperty(objectPath,
1425                                    CIM_NAMESPACE_PROPERTY_OBJECTMANAGERCREATIONCLASSNAME,
1426                                    CIM_OBJECTMANAGER_CLASSNAME.getString()))
1427                        {
1428                            propertyName = CIM_NAMESPACE_PROPERTY_OBJECTMANAGERCREATIONCLASSNAME;
1429                            valid = false;
1430                        }
1431                    
1432                        // ATTN: This one still a problem.  We have to get the name first
1433                        if (!_validateRequiredProperty(objectPath,
1434                                    CIM_NAMESPACE_PROPERTY_OBJECTMANAGERNAME,
1435                                    String::EMPTY))
1436                        {
1437                            propertyName = CIM_NAMESPACE_PROPERTY_OBJECTMANAGERNAME;
1438                            valid = false;
1439                        }
1440                        if (!_validateRequiredProperty(objectPath,
1441 karl          1.5                  CIM_NAMESPACE_PROPERTY_CREATIONCLASSNAME,
1442                                    System::getHostName()))
1443                        {
1444                            propertyName = CIM_NAMESPACE_PROPERTY_CREATIONCLASSNAME;
1445                            valid = false;
1446                        }
1447                    
1448                        if (!_validateRequiredProperty(objectPath,
1449                                    CIM_NAMESPACE_PROPERTY_NAME,
1450                                    String::EMPTY))
1451                        {
1452                            propertyName = CIM_NAMESPACE_PROPERTY_NAME;
1453                            valid = false;
1454                        }
1455                    
1456                        if (false)
1457                        {
1458 tony          1.6          PEG_METHOD_EXIT();
1459 karl          1.5          throw CIMInvalidParameterException(
1460                                "Invalid key property: " + propertyName.getString());
1461                        }
1462 tony          1.6      PEG_METHOD_EXIT();
1463                    }
1464 karl          1.5  
1465 karl          1.11 /** completes a property in the defined instance either
1466                        by adding the complete property if it does not exist
1467                        or by adding the value if the property does exist.
1468                        Used to make sure that key properties for things
1469 david.dillard 1.32     like systemcreationclass are included in the
1470 karl          1.11     creation of new instances and that the
1471                        values are logical for the CIMOM.
1472                    */
1473                    Boolean _completeProperty(CIMInstance& instance,
1474                        const CIMName& propertyName,
1475                        const String& value)
1476                    {
1477                    
1478                        PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,
1479                                "InteropProvider::_completeProperty()");
1480                    
1481                        Uint32 pos;
1482                    
1483                        if (!_validateRequiredProperty(instance,
1484                                    propertyName,
1485                                    value))
1486                        {
1487                            if ((pos = instance.findProperty (propertyName)) == PEG_NOT_FOUND)
1488                            {
1489                                // Add the property.  Should be from the class.
1490                                PEG_METHOD_EXIT();
1491 karl          1.11             return(false);
1492                            }
1493                            else
1494                            {
1495                                _setPropertyValue(instance, propertyName, value);
1496                            }
1497                        }
1498                    
1499                        PEG_METHOD_EXIT();
1500                        return(true);
1501                    }
1502                    Boolean _completeCIMNamespaceKeys(CIMInstance& instance)
1503                    {
1504                    
1505                        PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,
1506                                "InteropProvider::_completeCIMNamespaceKeys");
1507                    
1508                        Boolean valid = true;
1509                        CIMName propertyName;
1510                    
1511                        if (!_completeProperty(instance,
1512 karl          1.11                 CIM_NAMESPACE_PROPERTY_SYSTEMCREATIONCLASSNAME,
1513                                    System::getSystemCreationClassName ()))
1514                        {
1515                    
1516                            propertyName = CIM_NAMESPACE_PROPERTY_SYSTEMCREATIONCLASSNAME;
1517                            valid = false;
1518                        }
1519                    
1520                        if (!_completeProperty(instance,
1521                                    CIM_NAMESPACE_PROPERTY_SYSTEMNAME,
1522 joyce.j       1.30                 System::getFullyQualifiedHostName()))
1523 karl          1.11     {
1524                            propertyName = CIM_NAMESPACE_PROPERTY_SYSTEMNAME;
1525                            valid = false;
1526                        }
1527                    
1528                        if (!_completeProperty(instance,
1529                                    CIM_NAMESPACE_PROPERTY_OBJECTMANAGERCREATIONCLASSNAME,
1530                                    CIM_OBJECTMANAGER_CLASSNAME.getString()))
1531                        {
1532                            propertyName = CIM_NAMESPACE_PROPERTY_OBJECTMANAGERCREATIONCLASSNAME;
1533                            valid = false;
1534                        }
1535                    
1536                        if (!_completeProperty(instance,
1537                                    CIM_NAMESPACE_PROPERTY_OBJECTMANAGERNAME,
1538                                    String::EMPTY))
1539                        {
1540                            propertyName = CIM_NAMESPACE_PROPERTY_OBJECTMANAGERNAME;
1541                            valid = false;
1542                        }
1543                        if (!_completeProperty(instance,
1544 karl          1.11                 CIM_NAMESPACE_PROPERTY_CREATIONCLASSNAME,
1545                                    System::getHostName()))
1546                        {
1547                            propertyName = CIM_NAMESPACE_PROPERTY_CREATIONCLASSNAME;
1548                            valid = false;
1549                        }
1550                    
1551                        if (!_completeProperty(instance,
1552                                    CIM_NAMESPACE_PROPERTY_NAME,
1553                                    String::EMPTY))
1554                        {
1555                            propertyName = CIM_NAMESPACE_PROPERTY_NAME;
1556                            valid = false;
1557                        }
1558                    
1559                        if (!valid)
1560                        {
1561                            PEG_TRACE_STRING(TRC_CONTROLPROVIDER, Tracer::LEVEL4,
1562                                "Invalid CIM_Namespace Key Property " +  propertyName.getString());
1563                            PEG_METHOD_EXIT();
1564                            throw CIMInvalidParameterException(
1565 karl          1.11             "Invalid CIM_Namespace key property: " + propertyName.getString());
1566                        }
1567                        PEG_TRACE_STRING(TRC_CONTROLPROVIDER, Tracer::LEVEL4, "CIM_Namespace Keys Valid");
1568                        PEG_METHOD_EXIT();
1569                        return(valid);
1570                    }
1571                    
1572                    
1573 karl          1.5  void _validateCIMNamespaceKeys(const CIMInstance& instance)
1574                    {
1575 tony          1.6      PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,
1576                                "InteropProvider::_validateCIMNamespaceKeys");
1577 karl          1.5      Boolean valid = true;
1578                        CIMName propertyName;
1579                        if (!_validateRequiredProperty(instance,
1580                                    CIM_NAMESPACE_PROPERTY_SYSTEMCREATIONCLASSNAME,
1581                                    System::getSystemCreationClassName ()))
1582                        {
1583                            propertyName = CIM_NAMESPACE_PROPERTY_SYSTEMCREATIONCLASSNAME;
1584                            valid = false;
1585                        }
1586                    
1587                        if (!_validateRequiredProperty(instance,
1588                                    CIM_NAMESPACE_PROPERTY_SYSTEMNAME,
1589 joyce.j       1.30                 System::getFullyQualifiedHostName ()))
1590 karl          1.5      {
1591                            propertyName = CIM_NAMESPACE_PROPERTY_SYSTEMNAME;
1592                            valid = false;
1593                        }
1594                    
1595                        if (!_validateRequiredProperty(instance,
1596                                    CIM_NAMESPACE_PROPERTY_OBJECTMANAGERCREATIONCLASSNAME,
1597                                    CIM_OBJECTMANAGER_CLASSNAME.getString()))
1598                        {
1599                            propertyName = CIM_NAMESPACE_PROPERTY_OBJECTMANAGERCREATIONCLASSNAME;
1600                            valid = false;
1601                        }
1602                    
1603                        // ATTN: This one still a problem.  We have to get the name first
1604                        if (!_validateRequiredProperty(instance,
1605                                    CIM_NAMESPACE_PROPERTY_OBJECTMANAGERNAME,
1606                                    String::EMPTY))
1607                        {
1608                            propertyName = CIM_NAMESPACE_PROPERTY_OBJECTMANAGERNAME;
1609                            valid = false;
1610                        }
1611 karl          1.5      if (!_validateRequiredProperty(instance,
1612                                    CIM_NAMESPACE_PROPERTY_CREATIONCLASSNAME,
1613                                    System::getHostName()))
1614                        {
1615                            propertyName = CIM_NAMESPACE_PROPERTY_CREATIONCLASSNAME;
1616                            valid = false;
1617                        }
1618                    
1619                        if (!_validateRequiredProperty(instance,
1620                                    CIM_NAMESPACE_PROPERTY_NAME,
1621                                    String::EMPTY))
1622                        {
1623                            propertyName = CIM_NAMESPACE_PROPERTY_NAME;
1624                            valid = false;
1625                        }
1626                    
1627                        if (false)
1628                        {
1629 tony          1.6          PEG_TRACE_STRING(TRC_CONTROLPROVIDER, Tracer::LEVEL4,
1630                                "Invalid CIM_Namespace Key Property " +  propertyName.getString());
1631                            PEG_METHOD_EXIT();
1632 karl          1.5          throw CIMInvalidParameterException(
1633 tony          1.6              "Invalid CIM_Namespace key property: " + propertyName.getString());
1634 karl          1.5      }
1635 tony          1.6      PEG_TRACE_STRING(TRC_CONTROLPROVIDER, Tracer::LEVEL4, "CIM_Namespace Keys Valid");
1636                        PEG_METHOD_EXIT();
1637                    }
1638                    
1639                    /** builds complete object path from instance and classinfo by building the full path
1640                        with host and namespace names included.
1641                    */
1642 karl          1.37 CIMObjectPath InteropProvider::_buildObjectPath(const CIMObjectPath& objectPath,
1643 tony          1.6                                                  const CIMName& className,
1644                                                                    const CIMInstance& instance)
1645                    {
1646 karl          1.10     PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,
1647                                "InteropProvider::_buildObjectPath");
1648                    
1649 karl          1.37     CIMObjectPath rtnObjectPath;
1650                        rtnObjectPath = _buildInstancePath(objectPath,className,instance);
1651 tony          1.6  
1652 karl          1.37     rtnObjectPath.setHost(objectPath.getHost());
1653 tony          1.6  
1654 karl          1.37     rtnObjectPath.setNameSpace(objectPath.getNameSpace());
1655 karl          1.10 
1656                        PEG_METHOD_EXIT();
1657 karl          1.37     return(rtnObjectPath);
1658 karl          1.5  }
1659                    
1660 tony          1.6  /* Given a class and instance build the instance path for a
1661 karl          1.1     the object.  This builds all components of the path
1662                       @param namespace name to build
1663 david.dillard 1.32    @return CIMObjectPath containing namespace, class and keybinding
1664 karl          1.1     components of path
1665 tony          1.6     @exceptions - Passes repository exceptions.
1666 karl          1.1  */
1667                    
1668 karl          1.37 CIMObjectPath InteropProvider::_buildInstancePath(const CIMObjectPath& objectPath,
1669 david.dillard 1.32                                            const CIMName& className,
1670 karl          1.1                                             const CIMInstance& instance)
1671                    {
1672                        PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,
1673 tony          1.6              "InteropProvider::_buildInstancePath");
1674 karl          1.1  
1675                        // get the class CIM_Namespace class to use in building path
1676 tony          1.6      // Exception out if Class does not exist in this namespace
1677 karl          1.37     CIMClass thisClass = _getClass(objectPath, className);
1678 karl          1.1  
1679                        CIMObjectPath ref = instance.buildPath(thisClass);
1680 david.dillard 1.32 
1681 karl          1.1      PEG_METHOD_EXIT();
1682                        return(ref);
1683                    }
1684                    
1685                    //**************************************************************
1686                    // Overloaded functions to get key value with different params
1687                    //**************************************************************
1688                    
1689 tony          1.6  /*  find the name key in the keybindings and return the value.
1690 karl          1.1      Executes exception if the key not found
1691                        @param object path we will search
1692                        @param keyName - Name of the key to find.
1693                        @return value of name property
1694                        @exceptions CIMInvalidParameterException
1695                    */
1696                    String _getKeyValue(const CIMObjectPath& instanceName, const CIMName& keyName)
1697                    {
1698                        Array<CIMKeyBinding> kbArray = instanceName.getKeyBindings();
1699                    
1700                        // find the correct key binding
1701                        for (Uint32 i = 0; i < kbArray.size(); i++)
1702                        {
1703                            if (kbArray[i].getName() == keyName)
1704                                return (kbArray[i].getValue());
1705                        }
1706 tony          1.6  
1707 karl          1.1      throw CIMInvalidParameterException("Invalid key property: " + keyName.getString());
1708                    }
1709                    
1710                    String _getKeyValue(const CIMInstance& instance, const CIMName& keyName)
1711                    {
1712                        Uint32 pos;
1713                        CIMValue propertyValue;
1714                    
1715                        pos = instance.findProperty(keyName);
1716                        if (pos == PEG_NOT_FOUND)
1717                           throw CIMPropertyNotFoundException
1718                               (NAMESPACE_PROPERTYNAME.getString());
1719 david.dillard 1.32 
1720 karl          1.1      propertyValue = instance.getProperty(pos).getValue();
1721                        if (propertyValue.getType() != CIMTYPE_STRING)
1722                           throw CIMInvalidParameterException("Invalid type for property: "
1723                                                 + NAMESPACE_PROPERTYNAME.getString());
1724                        String name;
1725                        propertyValue.get(name);
1726                        return(name);
1727                    }
1728                    
1729                    //***************************************************************************
1730                    //  The following section is the Instance Operation processors
1731                    //***************************************************************************
1732                    //                createInstance
1733                    //***************************************************************************
1734                    void InteropProvider::createInstance(
1735                    	const OperationContext & context,
1736                    	const CIMObjectPath & instanceReference,
1737                        const CIMInstance& myInstance,
1738                    	ObjectPathResponseHandler & handler)
1739                        {
1740                            PEG_METHOD_ENTER(TRC_CONTROLPROVIDER, "InteropProvider::createInstance()");
1741 david.dillard 1.32 
1742                            Tracer::trace(TRC_CONTROLPROVIDER, Tracer::LEVEL4,
1743 karl          1.26             "%s createInstance. InstanceReference= %s",
1744                                thisProvider,
1745                                (const char *) instanceReference.toString().getCString());
1746                    
1747 karl          1.11         handler.processing();
1748 karl          1.26 
1749 karl          1.1          CDEBUG("CreateInstance " << instanceReference.toString());
1750                            // operation namespace needed internally to get class.
1751 karl          1.37         // KS_TEMP _operationNamespace = instanceReference.getNameSpace();
1752 david.dillard 1.32 
1753 karl          1.1          // Verify that ClassName is correct and get value
1754 karl          1.11         targetClass classEnum  = _verifyValidClassInput(instanceReference.getClassName());
1755                    
1756 karl          1.1          String userName = _validateUserID(context);
1757                            CIMObjectPath newInstanceReference;
1758 karl          1.11 
1759 karl          1.37         CIMNamespaceName newNamespaceName;
1760 karl          1.8          if (classEnum == PG_NAMESPACE)
1761 karl          1.1          {
1762 humberto      1.23 #ifdef PEGASUS_OS_OS400
1763 karl          1.37             MessageLoaderParms mparms(
1764                                    "ControlProviders.InteropProvider.CREATE_INSTANCE_NOT_ALLOWED",
1765                                    "Create instance operation not allowed by Interop Provider for class $0.",
1766                                    PG_NAMESPACE_CLASSNAME.getString());
1767 humberto      1.23             throw CIMNotSupportedException(mparms);
1768                    #else
1769 karl          1.11             // Create local instance to complete any keys.
1770                                CIMInstance localInstance = myInstance.clone();
1771                    
1772                                _completeCIMNamespaceKeys(localInstance);
1773 tony          1.6              // Validate that keys are as required. Does its own exception.
1774 karl          1.11             newNamespaceName = _getKeyValue(myInstance, CIM_NAMESPACE_PROPERTY_NAME);
1775                    
1776 karl          1.37             newInstanceReference = _buildInstancePath(instanceReference,
1777 karl          1.11                                         PG_NAMESPACE_CLASSNAME, localInstance);
1778 humberto      1.23 #endif
1779 karl          1.1          }
1780 tony          1.6  
1781 karl          1.37         else if ((classEnum == CIM_OBJECTMANAGER) ||
1782                                (classEnum == PG_CIMXMLCOMMUNICATIONMECHANISM))
1783                            {
1784                                PEG_METHOD_EXIT();
1785                                throw CIMNotSupportedException("InteropProvider, Create Not allowed");
1786                            }
1787                    
1788 karl          1.11         else   // Invalid class for the create functions.
1789 karl          1.1          {
1790 karl          1.10             PEGASUS_ASSERT(false);
1791 karl          1.1          }
1792 karl          1.10 
1793 karl          1.1          // Create the new namespace
1794                            try
1795                            {
1796 tony          1.6              PEG_TRACE_STRING(TRC_CONTROLPROVIDER, Tracer::LEVEL4,
1797 david.dillard 1.32                 "Namespace = " + newNamespaceName.getString() +
1798 tony          1.6                      " to be created.");
1799 karl          1.10             Boolean updatesAllowed = false;
1800                                Boolean shareable = false;
1801                                String parent = String::EMPTY;
1802 karl          1.11 
1803 karl          1.8              CIMRepository::NameSpaceAttributes attributes;
1804 karl          1.10             // optional property.  Set false if not found.
1805                                // ATTN: Should set to class default.
1806 karl          1.8              if (myInstance.findProperty(PG_NAMESPACE_PROPERTY_ISSHAREABLE) != PEG_NOT_FOUND)
1807                                {
1808                                    if (_getPropertyValue(myInstance, PG_NAMESPACE_PROPERTY_ISSHAREABLE, false))
1809 karl          1.10                 {
1810 karl          1.8                      attributes.insert("shareable","true");
1811 karl          1.10                     shareable = true;
1812                                    }
1813 karl          1.8                  else
1814 karl          1.10                     attributes.insert("shareable", "false");
1815 karl          1.8              }
1816                                else
1817 karl          1.10                 attributes.insert("shareable", "false");
1818 karl          1.8  
1819 karl          1.10             // Optional property.  Set false if not found.
1820 karl          1.8              if (myInstance.findProperty(PG_NAMESPACE_PROPERTY_SCHEMAUPDATESALLOWED) != PEG_NOT_FOUND)
1821                                {
1822                                    if (_getPropertyValue(myInstance, PG_NAMESPACE_PROPERTY_SCHEMAUPDATESALLOWED, false))
1823 karl          1.10                 {
1824 karl          1.8                      attributes.insert("updatesAllowed","true");
1825 karl          1.10                     updatesAllowed = true;
1826                                    }
1827 karl          1.8                  else
1828                                        attributes.insert("updatesAllowed", "false");
1829                                }
1830                                else
1831                                    attributes.insert("updatesAllowed", "false");
1832                    
1833 karl          1.10             // ATTN: Need to reflect and dependencies between these properties. Right now
1834                                // this lets anything happen.
1835 karl          1.8              if (myInstance.findProperty(PG_NAMESPACE_PROPERTY_PARENTNAMESPACE) != PEG_NOT_FOUND)
1836                                {
1837                                    String parent = _getPropertyValue(myInstance, PG_NAMESPACE_PROPERTY_PARENTNAMESPACE, String::EMPTY);
1838                                    if (parent != String::EMPTY)
1839 karl          1.10                     attributes.insert("parent",parent);
1840 karl          1.8              }
1841                                _repository->createNameSpace(newNamespaceName, attributes);
1842 david.dillard 1.32 
1843 karl          1.1              PEG_TRACE_STRING(TRC_CONTROLPROVIDER, Tracer::LEVEL4,
1844 david.dillard 1.32                 "Namespace = " + newNamespaceName.getString() +
1845 karl          1.1                      " successfully created.");
1846 kumpf         1.35             Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE,
1847 karl          1.37                 "Create Namespace: Shareable = $0, Updates allowed: $1,  Parent: $2",
1848                                    newNamespaceName.getString(), shareable? 
1849                                            "true" : "false", shareable? "true" : "false", parent );
1850 karl          1.11 
1851 karl          1.1          }
1852 david.dillard 1.32         catch(const CIMException&)
1853 karl          1.1          {
1854                               PEG_METHOD_EXIT();
1855 david.dillard 1.32            throw;
1856 karl          1.1          }
1857 david.dillard 1.32         catch(const Exception&)
1858 karl          1.1          {
1859                               PEG_METHOD_EXIT();
1860 david.dillard 1.32            throw;
1861 karl          1.1          }
1862 david.dillard 1.32 
1863 karl          1.1          // begin processing the request
1864                    
1865                           handler.deliver(newInstanceReference);
1866                    
1867                           // complete processing the request
1868                           handler.complete();
1869                    
1870                           PEG_METHOD_EXIT();
1871                           return;
1872                       }
1873                    
1874                    //***************************************************************************
1875                    //                deleteInstance
1876                    //***************************************************************************
1877                    void InteropProvider::deleteInstance(
1878                    	const OperationContext & context,
1879                    	const CIMObjectPath & instanceName,
1880                    	ResponseHandler & handler)
1881                        {
1882                            PEG_METHOD_ENTER(TRC_CONTROLPROVIDER, "InteropProvider::deleteInstance");
1883 tony          1.6  
1884 david.dillard 1.32         Tracer::trace(TRC_CONTROLPROVIDER, Tracer::LEVEL4,
1885 karl          1.26             "%s deleteInstance. instanceName= %s",
1886                                thisProvider,
1887                                (const char *) instanceName.toString().getCString());
1888                    
1889 karl          1.37         // KS_TEMP _operationNamespace = instanceName.getNameSpace();
1890 tony          1.6          handler.processing();
1891 karl          1.1          // Verify that ClassName is correct and get value
1892 david.dillard 1.32         targetClass classEnum  = _verifyValidClassInput(instanceName.getClassName());
1893                    
1894 karl          1.1          String userName = _validateUserID(context);
1895 david.dillard 1.32 
1896 tony          1.6          // Delete the instance since it may be in persistent storage
1897                            if ((classEnum == CIM_OBJECTMANAGER))
1898                            {
1899                                try
1900                                {
1901 karl          1.37                 _repository->deleteInstance(instanceName.getNameSpace(),instanceName);
1902 tony          1.6              }
1903 david.dillard 1.32             catch(const CIMException&)
1904 tony          1.6              {
1905                                    PEG_METHOD_EXIT();
1906 david.dillard 1.32                 throw;
1907 tony          1.6              }
1908                            }
1909 karl          1.26         else if (classEnum == PG_NAMESPACE)
1910 karl          1.1          {
1911 karl          1.26             CIMNamespaceName deleteNamespaceName;
1912 humberto      1.23 #ifdef PEGASUS_OS_OS400
1913 karl          1.37             MessageLoaderParms mparms(
1914                                    "ControlProviders.InteropProvider.DELETE_INSTANCE_NOT_ALLOWED",
1915                                    "Delete instance operation not allowed by Interop Provider for class $0.",
1916                                    PG_NAMESPACE_CLASSNAME.getString());
1917 humberto      1.23             throw CIMNotSupportedException(mparms);
1918                    #else
1919 karl          1.5              // validate requred keys.  Exception out if not valid
1920                                _validateCIMNamespaceKeys(instanceName);
1921 david.dillard 1.32 
1922 karl          1.1              deleteNamespaceName = _getKeyValue(instanceName, CIM_NAMESPACE_PROPERTY_NAME);
1923 humberto      1.23 #endif
1924 karl          1.1  
1925 karl          1.26             Array<CIMNamespaceName> namespaceNames;
1926                                namespaceNames = _enumerateNameSpaces();
1927 karl          1.1  
1928 karl          1.26             if (deleteNamespaceName.equal (ROOTNS))
1929                                {
1930                                   throw CIMNotSupportedException("root namespace cannot be deleted.");
1931                                }
1932 david.dillard 1.32 
1933 karl          1.26             _repository->deleteNameSpace(deleteNamespaceName);
1934 david.dillard 1.32 
1935 karl          1.26             PEG_TRACE_STRING(TRC_CONTROLPROVIDER, Tracer::LEVEL4,
1936 david.dillard 1.32                "Namespace = " + deleteNamespaceName.getString() +
1937 karl          1.26                    " successfully deleted.");
1938 david.dillard 1.32 
1939 kumpf         1.35             Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE,
1940 karl          1.26                "Interop Provider Delete Namespace: $0",
1941                                   deleteNamespaceName.getString());
1942                            }
1943                            else
1944                            {
1945                                throw CIMNotSupportedException("Delete Not allowed for " + instanceName.getClassName().getString());
1946                            }
1947 karl          1.1  
1948 karl          1.26         handler.complete();
1949 karl          1.5  
1950 karl          1.26         PEG_METHOD_EXIT();
1951                            return ;
1952 karl          1.1      }
1953                    
1954                    //***************************************************************************
1955                    //                getInstance
1956                    //***************************************************************************
1957                    void InteropProvider::getInstance(
1958                        const OperationContext & context,
1959                        const CIMObjectPath & instanceName,
1960                        const Boolean includeQualifiers,
1961                        const Boolean includeClassOrigin,
1962 tony          1.6      const CIMPropertyList & propertyList,
1963 karl          1.1      InstanceResponseHandler & handler)
1964                        {
1965                            PEG_METHOD_ENTER(TRC_CONTROLPROVIDER, "InteropProvider::getInstance");
1966 david.dillard 1.32 
1967                            Tracer::trace(TRC_CONTROLPROVIDER, Tracer::LEVEL4,
1968 karl          1.26             "%s getInstance. instanceName= %s , includeQualifiers= %s, includeClassOrigin= %s, PropertyList= %s",
1969                                thisProvider,
1970                                (const char *)instanceName.toString().getCString(),
1971                                (const char *)_showBool(includeQualifiers).getCString(),
1972                                (const char*) _showBool(includeClassOrigin).getCString(),
1973                                (const char *)_showPropertyList(propertyList).getCString());
1974 karl          1.37 
1975 karl          1.1          // Verify that ClassName is correct and get value
1976 david.dillard 1.32         targetClass classEnum  = _verifyValidClassInput(instanceName.getClassName());
1977                    
1978 karl          1.1          String userName = _validateUserID(context);
1979 karl          1.37 
1980 karl          1.1          // begin processing the request
1981                            handler.processing();
1982 karl          1.40         CIMInstance instance;
1983                            Boolean found = false;
1984 karl          1.1          if (classEnum == CIM_OBJECTMANAGER)
1985                            {
1986 karl          1.40             instance = _getInstanceCIMObjectManager(
1987 karl          1.37                             instanceName,
1988                                                includeQualifiers,
1989                                                includeClassOrigin, propertyList);
1990 karl          1.40             if (instanceName == instance.getPath())
1991                                {
1992                                    found = true;
1993                                }
1994                                //handler.deliver(instance);
1995 karl          1.1          }
1996 david.dillard 1.32 
1997 karl          1.37         else if (classEnum == PG_CIMXMLCOMMUNICATIONMECHANISM)
1998 karl          1.1          {
1999 david.dillard 1.32             // ATTN: test for correct instance KS: Priority 1
2000 karl          1.37             Array <CIMInstance> instances = 
2001                                    _buildInstancesPGCIMXMLCommunicationMechanism(
2002                                                instanceName,
2003                                                includeQualifiers,
2004                                                includeClassOrigin, propertyList);
2005 karl          1.40             for (Uint32 i = 0 ; i < instances.size() ; i++)
2006                                {
2007                                    if (instanceName == instances[i].getPath())
2008                                    {
2009                                        instance = instances[i];
2010                                        found = true;
2011                                        break;
2012                                    }
2013                                }
2014                                //instance = instances[0];
2015                                //handler.deliver(instances[0]);
2016 karl          1.1          }
2017 david.dillard 1.32 
2018 karl          1.37         else if (classEnum == CIM_NAMESPACEINMANAGER)
2019 karl          1.19         {
2020                            }
2021                    
2022 karl          1.37         else if (classEnum == PG_NAMESPACE)
2023                            {
2024                                // Get List of namespaces
2025                                Array<CIMNamespaceName> namespaceNames;
2026                                namespaceNames = _enumerateNameSpaces();
2027 david.dillard 1.32 
2028 karl          1.1              // Not clear what we have to take into account here.
2029                                // get the namespace from the name value.
2030                                // should check the other keys to see if valid.
2031 karl          1.37             CIMNamespaceName namespaceName = 
2032                                    _getKeyValue(instanceName, CIM_NAMESPACE_PROPERTY_NAME);
2033 tony          1.6  
2034 karl          1.1              // ATTN: Why this CIMNamespaceName parentNamespaceName = instanceName.getNameSpace();
2035 kumpf         1.31             if (!Contains(namespaceNames, namespaceName))
2036 karl          1.1              {
2037                                    throw CIMObjectNotFoundException("Namespace does not exist: "
2038                                                         + namespaceName.getString());
2039                                }
2040                                PEG_TRACE_STRING(TRC_CONTROLPROVIDER, Tracer::LEVEL4,
2041                                   "Namespace = " + namespaceName.getString() + " successfully found.");
2042 tony          1.6  
2043 karl          1.40             instance = _getInstanceCIMNamespace(instanceName);
2044                                found = true;
2045 karl          1.1          }
2046                            else  // processing for __Namespace
2047                            {
2048 karl          1.37             PEG_METHOD_EXIT();
2049                                throw CIMNotSupportedException
2050                                    (instanceName.getClassName().getString() + " not supported by Interop Provider");
2051 karl          1.8          }
2052 karl          1.40        if (found)
2053                           {
2054                               instance.filter( includeQualifiers,
2055                                                includeClassOrigin,
2056                                                propertyList); 
2057                               handler.deliver(instance);
2058                           }
2059 karl          1.1  
2060                           handler.complete();
2061                    
2062                           PEG_METHOD_EXIT();
2063                           return ;
2064                        }
2065                    
2066 karl          1.40 
2067                    
2068 karl          1.1  //***************************************************************************
2069                    //                enumerateInstances
2070                    //***************************************************************************
2071                    void InteropProvider::enumerateInstances(
2072                        const OperationContext & context,
2073                        const CIMObjectPath & ref,
2074                        const Boolean includeQualifiers,
2075                        const Boolean includeClassOrigin,
2076                        const CIMPropertyList& propertyList,
2077                        InstanceResponseHandler & handler)
2078                        {
2079                            PEG_METHOD_ENTER(TRC_CONTROLPROVIDER, "InteropProvider::enumerateInstances()");
2080 karl          1.24 
2081 david.dillard 1.32         Tracer::trace(TRC_CONTROLPROVIDER, Tracer::LEVEL4,
2082 karl          1.26             "%s enumerateInstances. ref= %s, includeQualifiers= %s, includeClassOrigin= %s, PropertyList= %s",
2083                                thisProvider,
2084                                (const char *) ref.toString().getCString(),
2085                                (const char *) _showBool(includeQualifiers).getCString(),
2086                                (const char *) _showBool(includeClassOrigin).getCString(),
2087                                (const char *) _showPropertyList(propertyList).getCString());
2088                    
2089 karl          1.1          // Verify that ClassName is correct and get value
2090 david.dillard 1.32         targetClass classEnum  = _verifyValidClassInput(ref.getClassName());
2091                    
2092 tony          1.6          //String userName = _validateUserID(context);
2093 david.dillard 1.32 
2094 karl          1.1          // The following 3 classes deliver a single instance because
2095                            // that is all there is today.
2096 karl          1.37 
2097 karl          1.40         Array<CIMInstance> instances;
2098 karl          1.1          if (classEnum == CIM_OBJECTMANAGER)
2099                            {
2100 karl          1.37             CIMInstance instance = _getInstanceCIMObjectManager(
2101                                                        ref,
2102                                                        includeQualifiers,
2103 tony          1.6                                      includeClassOrigin,
2104                                                        propertyList);
2105 karl          1.10 
2106 karl          1.40             instances.append(instance);
2107 karl          1.1          }
2108 david.dillard 1.32 
2109 karl          1.26         else if (classEnum == PG_CIMXMLCOMMUNICATIONMECHANISM)
2110 karl          1.1          {
2111 karl          1.40             instances = _buildInstancesPGCIMXMLCommunicationMechanism(
2112 karl          1.37                                     ref,
2113                                                        includeQualifiers,
2114 karl          1.40                                     includeClassOrigin,
2115                                                        propertyList);
2116 karl          1.1          }
2117                    
2118 karl          1.26         else if (classEnum == CIM_NAMESPACEINMANAGER)
2119 karl          1.19         {
2120 karl          1.26             //handler.complete();
2121                                //PEG_METHOD_EXIT();
2122                                //return;
2123 karl          1.19         }
2124                    
2125 karl          1.26         else if (classEnum == PG_NAMESPACE)
2126 karl          1.1          {
2127 karl          1.40             instances = _getInstancesCIMNamespace(
2128 karl          1.37                                     ref,
2129                                                        includeQualifiers,
2130 karl          1.40                                     includeClassOrigin,
2131                                                        propertyList);
2132 karl          1.26         }
2133                            else
2134                            {
2135 karl          1.37             PEG_METHOD_EXIT();
2136 karl          1.26             throw CIMNotSupportedException
2137 karl          1.37                 (ref.getClassName().getString() + " not supported by Interop Provider");
2138 karl          1.1          }
2139                    
2140 karl          1.40         // Filter and deliver the resulting instances
2141                            for (Uint32 i = 0 ; i < instances.size() ; i++)
2142                            {
2143                                _finishInstance(instances[i], ref, includeQualifiers,
2144                                                    includeClassOrigin,
2145                                                    propertyList );
2146                                /*** Debug Trace of the Instances generated
2147                                Tracer::trace(TRC_CONTROLPROVIDER, Tracer::LEVEL4,
2148                                    "%s enumerateInstances return instance number %u\npath: %s\n %s",thisProvider, i,
2149                                    (instances[i].getPath().toString().getCString()),
2150                                    ( ( CIMObject) instances[i]).toString().getCString());
2151                                ****/
2152                    
2153                                handler.deliver(instances[i]);
2154                            }
2155 karl          1.1          handler.complete();
2156 david.dillard 1.32 
2157 karl          1.1          PEG_METHOD_EXIT();
2158                        }
2159                    
2160 karl          1.10 void InteropProvider::modifyObjectManagerInstance(const OperationContext & context,
2161                        const CIMObjectPath & instanceReference,
2162                        const CIMInstance& modifiedIns,
2163                        const Boolean includeQualifiers,
2164                        const CIMPropertyList& propertyList,
2165                        ResponseHandler & handler)
2166                    {
2167                        PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,
2168                                "InteropProvider::modifyInstanceManagerInstance");
2169 karl          1.37 
2170 karl          1.10     // the only allowed modification is this one property, statistical data
2171 karl          1.37 
2172 karl          1.10     if (modifiedIns.findProperty(OM_GATHERSTATISTICALDATA) != PEG_NOT_FOUND)
2173                        {
2174                            // the following is a temporary hack to set the value of the statistics
2175                            // gathering function dynamically.  We simply get the  value from input
2176                            // and call the internal method to set it each time this object is
2177                            // built.
2178 karl          1.16 #ifndef PEGASUS_DISABLE_PERFINST
2179 karl          1.40         Boolean statisticsFlag = _getPropertyValue(modifiedIns,
2180                                    OM_GATHERSTATISTICALDATA, false);
2181 karl          1.26         CIMInstance instance;
2182 karl          1.40         instance = _getInstanceCIMObjectManager(instanceReference,
2183                                    true, true, CIMPropertyList());
2184 karl          1.10 
2185 karl          1.28         if (statisticsFlag != _getPropertyValue(instance,  OM_GATHERSTATISTICALDATA, false))
2186 karl          1.10         {
2187 david.dillard 1.32             // set the changed property into the
2188 karl          1.28             _setPropertyValue(instance, OM_GATHERSTATISTICALDATA, statisticsFlag);
2189                                // Modify the object on disk
2190                                try
2191                                {
2192 karl          1.37                 _repository->modifyInstance(instanceReference.getNameSpace(),
2193 karl          1.28                                instance );
2194                                }
2195 david.dillard 1.32             catch(const CIMException&)
2196 karl          1.28             {
2197                                    // ATTN: KS generate log error if this not possible
2198                                    PEG_METHOD_EXIT();
2199 david.dillard 1.32                 throw;
2200 karl          1.28             }
2201 david.dillard 1.32             catch(const Exception&)
2202 karl          1.28             {
2203                                    // ATTN: Generate log error.
2204                                    PEG_METHOD_EXIT();
2205 david.dillard 1.32                 throw;
2206 karl          1.28             }
2207 kumpf         1.35             Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE,
2208 karl          1.28                 "Interop Provider Set Statistics gathering in CIM_ObjectManager: $0",
2209                                    (statisticsFlag? "true" : "false"));
2210                                StatisticalData* sd = StatisticalData::current();
2211                                sd->setCopyGSD(statisticsFlag);
2212 karl          1.10         }
2213                            return;
2214                    #endif
2215 karl          1.8  
2216 karl          1.10     }
2217                        PEG_METHOD_EXIT();
2218 karl          1.11     // ATTN Expand this defintion to be more precise since it allows only mod of
2219                        // one property and that property MUST be in the instance to be modifiable.
2220 karl          1.10     throw CIMNotSupportedException
2221 karl          1.40         (OM_GATHERSTATISTICALDATA.getString() + 
2222                                    " modify operation not supported by Interop Provider");
2223 karl          1.10 }
2224 karl          1.1  //***************************************************************************
2225 karl          1.10 //                modifyInstance
2226 karl          1.1  //***************************************************************************
2227 karl          1.8  void InteropProvider::modifyInstance(const OperationContext & context,
2228                        const CIMObjectPath & instanceReference,
2229                        const CIMInstance& modifiedIns,
2230                        const Boolean includeQualifiers,
2231                        const CIMPropertyList& propertyList,
2232                        ResponseHandler & handler)
2233                    {
2234                        PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,
2235 karl          1.10             "InteropProvider::modifyInstance");
2236 karl          1.8  
2237 david.dillard 1.32     Tracer::trace(TRC_CONTROLPROVIDER, Tracer::LEVEL4,
2238 karl          1.26         "%s modifyInstance. instanceReference= %s, includeQualifiers= %s, PropertyList= %s",
2239                            thisProvider,
2240                            (const char *) instanceReference.toString().getCString(),
2241                            (const char *) _showBool(includeQualifiers).getCString(),
2242                            (const char *) _showPropertyList(propertyList).getCString());
2243 karl          1.10 
2244                        // ATTN: KS 31 August 2004. This must test for privileged user.
2245 karl          1.37 
2246 karl          1.8      CIMName className =  instanceReference.getClassName();
2247 karl          1.37     targetClass classEnum  = _verifyValidClassInput(className);
2248 karl          1.8  
2249                        String userName = _validateUserID(context);
2250                        // begin processing the request
2251                        handler.processing();
2252                    
2253                        if (classEnum == CIM_OBJECTMANAGER)
2254                        {
2255 karl          1.10         modifyObjectManagerInstance(context, instanceReference,modifiedIns,
2256                                includeQualifiers, propertyList, handler);
2257 karl          1.8          // for the moment allow modification of the statistics property only
2258                        }
2259                    
2260 karl          1.10     else if (classEnum == PG_CIMXMLCOMMUNICATIONMECHANISM)
2261 karl          1.8      {
2262                    
2263                            PEG_METHOD_EXIT();
2264                            throw CIMNotSupportedException
2265                                (className.getString() + " not supported by Interop Provider");
2266                        }
2267 karl          1.10     else if (classEnum == PG_NAMESPACE)
2268 karl          1.8      {
2269 humberto      1.23 #ifdef PEGASUS_OS_OS400
2270 karl          1.40             MessageLoaderParms mparms(
2271                                    "ControlProviders.InteropProvider.MODIFY_INSTANCE_NOT_ALLOWED",
2272                                    "Modify instance operation not allowed by Interop Provider for class $0.",
2273                                    PG_NAMESPACE_CLASSNAME.getString());
2274 humberto      1.23             throw CIMNotSupportedException(mparms);
2275                    #else
2276 karl          1.10         // for the moment allow modification of the statistics property only
2277 karl          1.8          PEG_METHOD_EXIT();
2278                            throw CIMNotSupportedException
2279                                (className.getString() + " not supported by Interop Provider");
2280 humberto      1.23 #endif
2281 karl          1.8      }
2282 karl          1.10     else
2283                        {
2284 karl          1.37         PEG_METHOD_EXIT();
2285                            throw CIMNotSupportedException(
2286                                className.getString() + " not supported by Interop Provider");
2287 karl          1.10     }
2288 karl          1.8  
2289 karl          1.10     handler.complete();
2290 karl          1.8      PEG_METHOD_EXIT();
2291                        return;
2292                    }
2293                    
2294 karl          1.10 //***************************************************************************
2295                    //                enumerateInstanceNames
2296                    //***************************************************************************
2297 karl          1.1  void InteropProvider::enumerateInstanceNames(
2298                    	const OperationContext & context,
2299                    	const CIMObjectPath & classReference,
2300                            ObjectPathResponseHandler & handler)
2301                        {
2302                        	PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,
2303                                    "InteropProvider::enumerateInstanceNames()");
2304                    
2305 karl          1.37         Tracer::trace(TRC_CONTROLPROVIDER, Tracer::LEVEL4,
2306                                "%s enumerateInstanceNames. classReference= %s",
2307                                thisProvider,
2308                                (const char *) classReference.toString().getCString());
2309 karl          1.1  
2310 karl          1.40         targetClass classEnum  = 
2311                                    _verifyValidClassInput(classReference.getClassName());
2312 david.dillard 1.32 
2313 tony          1.6          String userName = _validateUserID(context);
2314 karl          1.11 
2315 karl          1.1          // begin processing the request
2316                            handler.processing();
2317 david.dillard 1.32 
2318 karl          1.11         // Deliver a single instance because there should only be one instance.
2319 karl          1.1          if (classEnum == CIM_OBJECTMANAGER)
2320                            {
2321 karl          1.37             CIMInstance instance = _getInstanceCIMObjectManager(
2322                                                classReference, true, true, CIMPropertyList());
2323                    
2324                                CIMObjectPath ref = _buildInstancePath(classReference,
2325 karl          1.1                  CIM_OBJECTMANAGER_CLASSNAME, instance);
2326 karl          1.37 
2327 karl          1.1              handler.deliver(ref);
2328                            }
2329 karl          1.11 
2330                            // Deliver all possible instances of this class
2331 karl          1.37         else if (classEnum == PG_CIMXMLCOMMUNICATIONMECHANISM)
2332 karl          1.1          {
2333 karl          1.37             Array<CIMInstance> instances = 
2334                                    _buildInstancesPGCIMXMLCommunicationMechanism(
2335                                            classReference, true,
2336                                            true, CIMPropertyList());
2337 tony          1.6  
2338                                for (Uint32 i = 0 ; i < instances.size() ; i++)
2339                                {
2340 karl          1.37                 CIMObjectPath ref = _buildInstancePath(classReference,
2341                                            PG_CIMXMLCOMMUNICATIONMECHANISM_CLASSNAME, instances[i]);
2342 tony          1.6                  handler.deliver(ref);
2343                                }
2344 karl          1.1          }
2345                    
2346 karl          1.37         else if (classEnum == CIM_NAMESPACEINMANAGER)
2347 karl          1.19         {
2348                            }
2349                    
2350 karl          1.37         else if (classEnum == PG_NAMESPACE)
2351 tony          1.6          {
2352 karl          1.37             Array<CIMInstance> instances = _getInstancesCIMNamespace(
2353                                                        classReference,
2354                                                        false,
2355 tony          1.6                                      false, CIMPropertyList());
2356                                CDEBUG("EvalNames. Found instances. Count= " << instances.size());
2357 karl          1.37 
2358 tony          1.6              for (Uint32 i = 0 ; i < instances.size() ; i++)
2359                                {
2360 karl          1.37                 CIMObjectPath ref = _buildInstancePath(classReference,
2361                                            CIM_NAMESPACE_CLASSNAME, instances[i]);
2362 tony          1.6                  handler.deliver(ref);
2363                                }
2364 karl          1.1          }
2365                    
2366 karl          1.37         else if (classEnum == CIM_COMMMECHANISMFORMANAGERINST)
2367 karl          1.11         {
2368 karl          1.40             Array<CIMInstance> instances = 
2369                                    _buildInstancesCommMechanismForManager(classReference);
2370                    
2371 karl          1.11             for (Uint32 i = 0 ; i < instances.size() ; i++ )
2372                                {
2373 karl          1.37                 CIMObjectPath ref = _buildObjectPath(classReference,
2374 karl          1.11                         CIM_COMMMECHANISMFORMANAGER_CLASSNAME, instances[i]);
2375                                    handler.deliver(ref);
2376                                }
2377                            }
2378                    
2379 karl          1.37         else if (classEnum == CIM_NAMESPACEINMANAGERINST)
2380 karl          1.11         {
2381 karl          1.37             Array<CIMInstance> instances = _buildInstancesNamespaceInManager(classReference);
2382 karl          1.11             for (Uint32 i = 0 ; i < instances.size() ; i++ )
2383                                {
2384 karl          1.37                 CIMObjectPath ref = _buildObjectPath(classReference,
2385 karl          1.11                         CIM_NAMESPACEINMANAGER_CLASSNAME, instances[i]);
2386                                    handler.deliver(ref);
2387                                }
2388                            }
2389 karl          1.37         else
2390                            {
2391                                // ERROR: Code should never get here because of Enum tests.
2392 karl          1.40             throw CIMNotSupportedException("Class not processed by Interop "
2393                                     + classReference.getClassName().getString());
2394 karl          1.37         }
2395 karl          1.11 
2396                    
2397 karl          1.8          // ATTN: Exception response because of error
2398 karl          1.37         handler.complete();
2399 karl          1.1          PEG_METHOD_EXIT();
2400                        }
2401                    
2402                    //**************************************************************
2403                    //**************************************************************
2404                    // Association Functions
2405                    //**************************************************************
2406                    //**************************************************************
2407                    
2408                    void InteropProvider::associators(
2409                    	const OperationContext & context,
2410                    	const CIMObjectPath & objectName,
2411                    	const CIMName & associationClass,
2412                    	const CIMName & resultClass,
2413                    	const String & role,
2414                    	const String & resultRole,
2415                    	const Boolean includeQualifiers,
2416                    	const Boolean includeClassOrigin,
2417                    	const CIMPropertyList & propertyList,
2418                    	ObjectResponseHandler & handler)
2419                    {
2420 tony          1.6      PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,
2421                                "InteropProvider::associatorNames()");
2422 karl          1.16 	//throw CIMNotSupportedException("AssociationProvider::associators");
2423 karl          1.1  }
2424                    
2425                    void InteropProvider::associatorNames(
2426                    	const OperationContext & context,
2427                    	const CIMObjectPath & objectName,
2428                    	const CIMName & associationClass,
2429                    	const CIMName & resultClass,
2430                    	const String & role,
2431                    	const String & resultRole,
2432                    	ObjectPathResponseHandler & handler)
2433                    {
2434 tony          1.6      PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,
2435                                "InteropProvider::associatorNames()");
2436 karl          1.16 	//throw CIMNotSupportedException("AssociationProvider::associatorNames");
2437 karl          1.1  }
2438                    
2439                    void InteropProvider::references(
2440                    	const OperationContext & context,
2441                    	const CIMObjectPath & objectName,
2442                    	const CIMName & resultClass,
2443                    	const String & role,
2444                    	const Boolean includeQualifiers,
2445                    	const Boolean includeClassOrigin,
2446                    	const CIMPropertyList & propertyList,
2447                    	ObjectResponseHandler & handler)
2448                    {
2449 tony          1.6      PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,
2450                                "InteropProvider::references()");
2451 karl          1.16 	//throw CIMNotSupportedException("AssociationProvider::references");
2452 karl          1.1  }
2453                    
2454 tony          1.6  void _filterAssocInstances(Array<CIMInstance>& instances,
2455                                          CIMName assocClassName,
2456                                          String assocRole,
2457                                          CIMName resultClassName = CIMName(),
2458                                          String resultRole = String::EMPTY)
2459                    {
2460                        return;
2461                    }
2462 karl          1.11 
2463 karl          1.1  void InteropProvider::referenceNames(
2464                    	const OperationContext & context,
2465                    	const CIMObjectPath & objectName,
2466                    	const CIMName & resultClass,
2467                    	const String & role,
2468                    	ObjectPathResponseHandler & handler)
2469                    {
2470 tony          1.6      PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,
2471                                "InteropProvider::referenceNames()");
2472                        CDEBUG("::referenceNames(): object= " << objectName.toString() << " result Class= " << resultClass.getString());
2473 david.dillard 1.32 
2474 tony          1.6      // operation namespace needed internally to get class.
2475 karl          1.37     // KS_TEMP _operationNamespace = objectName.getNameSpace();
2476 tony          1.6      String userName = _validateUserID(context);
2477                        // begin processing the request
2478                        handler.processing();
2479                    
2480                        // determine if valid class result class
2481                    
2482                        CIMName targetAssocClassName = resultClass;
2483 david.dillard 1.32 
2484 karl          1.37     // KSTEMPCIMName targetClassName = objectName.getClassName();
2485 tony          1.6  
2486                        targetAssocClass classEnum  = _verifyValidAssocClassInput(targetAssocClassName);
2487                    
2488                        Array<CIMInstance> assocInstances;
2489                    
2490 karl          1.19     if (classEnum == CIM_COMMMECHANISMFORMANAGERASSOC)
2491 karl          1.37         assocInstances = _buildInstancesCommMechanismForManager(objectName);
2492 tony          1.6  
2493 karl          1.19     if (classEnum == CIM_NAMESPACEINMANAGERASSOC)
2494 karl          1.37         assocInstances = _buildInstancesNamespaceInManager(objectName);
2495 tony          1.6  
2496                        _filterAssocInstances(assocInstances, resultClass, role);
2497                    
2498                        for (Uint32 i = 0 ; i < assocInstances.size() ; i++ )
2499                        {
2500 karl          1.37         CIMObjectPath ref = _buildObjectPath(objectName,
2501 tony          1.6                  targetAssocClassName, assocInstances[i]);
2502                            CDEBUG("referenceNames returns: " << ref.toString());
2503                            handler.deliver(ref);
2504 karl          1.11     }
2505 tony          1.6  
2506                        handler.complete();
2507                    
2508                        PEG_METHOD_EXIT();
2509                        // Convert the instances to referenceNames response
2510 karl          1.1  }
2511                    
2512                    PEGASUS_NAMESPACE_END
2513                    // END_OF_FILE

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2