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

   1 karl  1.3 //%2003////////////////////////////////////////////////////////////////////////
   2 karl  1.1 //
   3 karl  1.3 // 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           // IBM Corp.; EMC Corporation, The Open Group.
   7 karl  1.1 //
   8           // Permission is hereby granted, free of charge, to any person obtaining a copy
   9           // of this software and associated documentation files (the "Software"), to
  10           // deal in the Software without restriction, including without limitation the
  11           // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
  12           // sell copies of the Software, and to permit persons to whom the Software is
  13           // furnished to do so, subject to the following conditions:
  14 karl  1.3 // 
  15 karl  1.1 // THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
  16           // ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED
  17           // "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
  18           // LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
  19           // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
  20           // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
  21           // ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
  22           // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  23           //
  24           //==============================================================================
  25           //
  26           // Author: Karl Schopmeyer (k.schopmeyer@opengroup.org)
  27           //
  28           // Modified By: Carol Ann Krug Graves, Hewlett-Packard Company
  29           //                (carolann_graves@hp.com)
  30           //              Karl Schopmeyer - Add Cim_Namespace capabilities.
  31           //              Karl Schopmeyer - Temp added objectmanager and communication classes
  32           //
  33           //%////////////////////////////////////////////////////////////////////////////
  34           
  35           
  36 karl  1.1 ///////////////////////////////////////////////////////////////////////////////
  37 karl  1.5 //  Interop Provider - This provider services those classes from the
  38           //  DMTF Interop schema association with the CIMOM itself
  39 karl  1.1 //
  40 karl  1.5 //  This provider services the following classes:
  41           //      CIMObjectManager
  42           //      CIM_ObjectManagerCommunicationMechanism
  43           //      CIM_CIMXMLCommunicationMechanism
  44           //      CIM_ProtocolAdapter
  45           //      CIM_Namespace
  46           //      
  47           //      It also services the Interop associations tied to these classes
  48           //      including:
  49           //      CIM_NamespaceInManager
  50           //      ...
  51           
  52           //      CIM Version: Interop Provider was written for CIM 2.7 adn 2.8.
  53           //       Note: all 2.8 functions are controlled by a flag and can be
  54           //      disabled.
  55 karl  1.1 ///////////////////////////////////////////////////////////////////////////////
  56           
  57           /* STATUS: In process but running 12 August 2003 KS */
  58           
  59           #include <Pegasus/Common/Config.h>
  60           #include <Pegasus/Common/PegasusVersion.h>
  61           
  62           #include <cctype>
  63           #include <iostream>
  64           
  65           #include "InteropProvider.h"
  66           #include <Pegasus/Common/String.h>
  67           #include <Pegasus/Common/System.h>
  68           #include <Pegasus/Common/ArrayInternal.h>
  69           #include <Pegasus/Common/CIMName.h>
  70           #include <Pegasus/Common/CIMType.h>
  71           #include <Pegasus/Common/CIMInstance.h>
  72           #include <Pegasus/Common/CIMObjectPath.h>
  73           #include <Pegasus/Common/InternalException.h>
  74           #include <Pegasus/Common/CIMStatusCode.h>
  75           #include <Pegasus/Common/Tracer.h>
  76 karl  1.1 #include <Pegasus/Common/OperationContext.h>
  77           #include <Pegasus/Config/ConfigManager.h>
  78           
  79           
  80           #include <Pegasus/Common/XmlWriter.h>
  81           
  82 karl  1.5.2.1 #include <sstream>
  83               #include <string>
  84               //#include <iomanip>
  85               //#include <windows.h>
  86               
  87 karl  1.1     PEGASUS_USING_STD;
  88               
  89               PEGASUS_NAMESPACE_BEGIN
  90               
  91 karl  1.5.2.1 #define CDEBUG(X)
  92               //#define CDEBUG(X) PEGASUS_STD(cout) << "InteropProvider " << X << PEGASUS_STD(endl)
  93               //#define CDEBUG(X) Logger::put (Logger::DEBUG_LOG, "Linux_ProcessorProvider", Logger::INFORMATION, "$0", X)
  94               //#define CDEBUG(X) {std::stringstream ss; std::string r;ss << X;ss>>r; PEG_TRACE_STRING(TRC_CONTROLPROVIDER, Tracer::LEVEL4, r)}
  95                
  96 karl  1.5     static const String PegasusInstanceIDGlobalPrefix = "PEG";
  97               //    Constants representing the class names processed
  98 karl  1.1     
  99               /**
 100                   The constants representing the class names we process
 101               */
 102               static const CIMName __NAMESPACE_CLASSNAME  = CIMName ("__Namespace");
 103               static const CIMName CIM_NAMESPACE_CLASSNAME  = CIMName ("CIM_Namespace");
 104               static const CIMName CIM_OBJECTMANAGER_CLASSNAME  = CIMName ("CIM_ObjectManager");
 105               static const CIMName CIM_OBJECTMANAGERCOMMUNICATIONMECHANISM_CLASSNAME  = 
 106                       CIMName ("CIM_ObjectManagerCommunicationMechanism");
 107               static const CIMName CIM_CIMXMLCOMMUNICATIONMECHANISM_CLASSNAME  = 
 108                       CIMName ("CIM_CIMXMLCommunicationMechanism");
 109               
 110               
 111               // Property Names for __Namespace Class
 112               static const CIMName NAMESPACE_PROPERTYNAME  = CIMName ("Name");
 113               static const CIMNamespaceName ROOTNS  = CIMNamespaceName ("root");
 114               
 115               
 116               // Property names for CIM_ObjectManager Class
 117               static const CIMName OM_GATHERSTATISTICALDATA  =
 118                CIMName ("GatherStatisticalData");
 119 karl  1.1     
 120               
 121               // Property Names for ObjectManagerCommunicationMechanism Class
 122               static const CIMName OM_COMMUNICATIONMECHANISM  = 
 123                       CIMName ("CommunicationMechanism");
 124               static const CIMName OM_FUNCTIONALPROFILESSUPPORTED  =
 125                CIMName ("FunctionalProfilesSupported");
 126               static const CIMName OM_FUNCTIONALPROFILEDESCRIPTIONS  =
 127                CIMName ("FunctionalProfileDescriptions");
 128               static const CIMName OM_AUTHENTICATIONMECHANISMSSUPPORTED  =
 129                CIMName ("AuthenticationMechanismsSupported");
 130               static const CIMName OM_AUTHENTICATIONMECHANISMDESCRIPTIONS  =
 131                CIMName ("AuthenticationMechanismDescriptions");
 132               static const CIMName OM_MULTIPLEOPERATIONSSUPPORTED  =
 133                CIMName ("MultipleOperationsSupported");
 134               static const CIMName OM_VERSION  =
 135                CIMName ("Version");
 136               
 137               // Property Names for CIMXML CommunicationMechanism
 138               
 139               static const CIMName CIMVALIDATED  =
 140 karl  1.1      CIMName ("CIMValidated");
 141               
 142               static const String CIMXMLProtocolVersion = "1.0";
 143               
 144 karl  1.5     // Property names for CIM_Namespace Class
 145 karl  1.1     
 146               static const CIMName CIM_NAMESPACE_PROPERTY_SYSTEMCREATIONCLASSNAME = 
 147                       CIMName ("SystemCreationClassName");
 148               static const CIMName CIM_NAMESPACE_PROPERTY_SYSTEMNAME = 
 149                       CIMName ("SystemName");
 150               static const CIMName CIM_NAMESPACE_PROPERTY_OBJECTMANAGERCREATIONCLASSNAME = 
 151                       CIMName ("ObjectManagerCreationClassName");
 152               static const CIMName CIM_NAMESPACE_PROPERTY_OBJECTMANAGERNAME = 
 153                       CIMName ("ObjectManagerName");
 154               static const CIMName CIM_NAMESPACE_PROPERTY_CREATIONCLASSNAME = 
 155                       CIMName ("CreationClassName");
 156               static const CIMName CIM_NAMESPACE_PROPERTY_NAME  = CIMName ("Name");
 157               static const CIMName CIM_NAMESPACE_PROPERTY_CLASSINFO = 
 158                       CIMName ("ClassInfo");
 159               static const CIMName CIM_NAMESPACE_PROPERTY_DESCRIPTIONOFCLASSINFO = 
 160                       CIMName ("DescriptionOfClassInfo");
 161               
 162               
 163 karl  1.5     
 164               // Defines to serve as the ENUM for class selection for instance
 165               // operations.
 166               
 167               enum targetClass{
 168                    __NAMESPACE = 1,
 169                    CIM_NAMESPACE = 2,
 170                    CIM_OBJECTMANAGER = 3,
 171                    CIM_OBJECTMANAGERCOMMUNICATIONMECHANISM = 4,
 172                    CIM_CIMXMLCOMMUNICATIONMECHANISM = 5
 173                    };
 174               
 175 karl  1.1     //***************************************************************
 176 karl  1.5     // Provider Utility Functions
 177 karl  1.1     //***************************************************************
 178               
 179               /* Test the keys in the CIM_Namespace for valid values
 180                  This includes all of the keys above the name key.
 181                  THis is a dummy for now.
 182                  ATTN: KS Extend and finish this function.
 183               */
 184 karl  1.5     Boolean _validateProperties(const CIMObjectPath& path)
 185 karl  1.1     {
 186                   return true;
 187               }
 188 karl  1.5     Boolean _validateProperties(const CIMInstance& instance)
 189 karl  1.1     {
 190                   return true;
 191               }
 192               
 193 karl  1.5     /* validate that the property exists, is string type and
 194                  optionally the value itself. Note processes only String
 195                  properties
 196                  @param - Instance to search for property.
 197                  @param - Property Name
 198                  @value - String value. If not String::EMPTY, compare to 
 199                  value in the property
 200                  @return - ture if passes all tests
 201               */
 202               Boolean _validateRequiredProperty(const CIMInstance& instance, 
 203                                         const CIMName& propertyName,
 204                                         const String& value)
 205               {
 206 karl  1.5.2.1     PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,
 207                           "InteropProvider::_validateRequiredProperty()");
 208 karl  1.5         Uint32 pos;
 209                   if ((pos = instance.findProperty (propertyName)) == PEG_NOT_FOUND)
 210                       return(false);
 211                   //
 212                   //  Get the property
 213                   //
 214                   CIMConstProperty theProperty = instance.getProperty(pos);
 215                   const CIMValue theValue = theProperty.getValue ();
 216 karl  1.5.2.1     String valueField;
 217                   theValue.get(valueField);
 218 karl  1.5         //
 219                   //  Required property must have a non-null value
 220                   //
 221 karl  1.5.2.1     if ((theValue.getType() != CIMTYPE_STRING) || (theValue.isNull()))
 222                   {
 223                       PEG_METHOD_EXIT();
 224 karl  1.5             return(false);
 225 karl  1.5.2.1     }
 226                   if ((value == String::EMPTY) || (valueField == value))
 227 karl  1.5         {
 228 karl  1.5.2.1         PEG_METHOD_EXIT();
 229                       return(true);
 230 karl  1.5         }
 231 karl  1.5.2.1     PEG_METHOD_EXIT();
 232                   return(false);
 233 karl  1.5     }
 234               
 235               Boolean _validateRequiredProperty(const CIMInstance& instance,
 236                                         const CIMName& propertyName,
 237                                         const Uint16& value)
 238               {
 239 karl  1.5.2.1     PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,
 240                       "InteropProvider::_validateRequiredProperty()");
 241                   
 242                   PEG_TRACE_STRING(TRC_CONTROLPROVIDER, Tracer::LEVEL4, "Validate "
 243                       + propertyName.getString());
 244 karl  1.5         Uint32 pos;
 245                   if ((pos = instance.findProperty (propertyName)) == PEG_NOT_FOUND)
 246 karl  1.5.2.1     {
 247                       PEG_METHOD_EXIT();
 248 karl  1.5             return(false);
 249 karl  1.5.2.1     }
 250 karl  1.5         //
 251                   //  Get the property
 252                   //
 253                   CIMConstProperty theProperty = instance.getProperty(pos);
 254                   CIMValue theValue = theProperty.getValue ();
 255                   //
 256                   //  Required property must have a non-null value
 257                   //
 258 karl  1.5.2.1     if ((theValue.getType() != CIMTYPE_UINT16) 
 259                       || (theValue.isNull())  ) 
 260               //        || (theValue.getValue != value()) )
 261                   {
 262                       PEG_METHOD_EXIT();
 263 karl  1.5             return(false);
 264 karl  1.5.2.1     }
 265                   PEG_METHOD_EXIT();
 266 karl  1.5         return(true);
 267               }
 268               Boolean _validateRequiredProperty(const CIMObjectPath& objectPath,
 269                                         const CIMName& propertyName,
 270                                         const String value)
 271               {
 272 karl  1.5.2.1     PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,
 273                           "InteropProvider::_validateRequiedProperty()");
 274 karl  1.5         Array<CIMKeyBinding> kbArray = objectPath.getKeyBindings();
 275               
 276                   // find the correct key binding
 277                   for (Uint32 i = 0; i < kbArray.size(); i++)
 278                   {
 279                       if (kbArray[i].getName() == propertyName)
 280                       {
 281                           if (value != String::EMPTY)
 282                           {
 283                               if (value !=kbArray[i].getValue())
 284                               {
 285 karl  1.5.2.1                     PEG_METHOD_EXIT();
 286 karl  1.5                         return(true);
 287                               }
 288                           }
 289                       }
 290                   }
 291 karl  1.5.2.1     PEG_METHOD_EXIT();
 292 karl  1.5         return(true);
 293               }
 294 karl  1.1     
 295               /* Query the repository for array of all namespacenames
 296               */        
 297               Array<CIMNamespaceName> InteropProvider::_enumerateNameSpaces()
 298               {
 299                   PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,
 300                           "InteropProvider::_enumerateNameSpaces()");
 301                   Array<CIMNamespaceName> namespaceNames;
 302                   
 303                   try
 304                   {
 305                       namespaceNames = _repository->enumerateNameSpaces();
 306                   }
 307                   catch(CIMException& e)
 308                   {
 309                       PEG_METHOD_EXIT();
 310                       throw e;
 311                   }
 312                   catch(Exception& e)
 313                   {
 314                       PEG_METHOD_EXIT();
 315 karl  1.1             throw e;
 316                   }
 317               
 318                   PEG_METHOD_EXIT();
 319                   return(namespaceNames);
 320               }
 321               
 322               /* get the CIM_Namespace Class defintion from the repository or
 323                  from local static storage.
 324                  @param namespace in which to look for the class.
 325                  @param name of class to get.
 326                  @return the CIMClass object
 327                  @Exceptions any repository exceptions if class not found.
 328               */ 
 329               CIMClass InteropProvider::_getClass(const CIMNamespaceName& nameSpace,
 330 karl  1.5.2.1                                     const CIMName& className)
 331 karl  1.1     {
 332                   PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,
 333 karl  1.5.2.1             "InteropProvider::_getClass");
 334 karl  1.1         CIMClass myClass;
 335 karl  1.5.2.1     CDEBUG("_getClass: Get Class from repository. Namespace= " << nameSpace << " Class= " <<  className.getString());
 336 karl  1.1         if (myClass.isUninitialized())
 337                   {
 338                       try
 339                       {
 340 karl  1.5.2.1             myClass = _repository->getClass(nameSpace, className );
 341 karl  1.1             }
 342                       catch(CIMException& e)
 343                       {
 344 karl  1.5.2.1             CDEBUG("_getClass CIMException: " << e.getMessage());
 345 karl  1.1                 PEG_METHOD_EXIT();
 346                           throw e;
 347                       }
 348                       catch(Exception& e)
 349                       {
 350 karl  1.5.2.1             CDEBUG("_getClass CIMException: " << e.getMessage());
 351 karl  1.1                 PEG_METHOD_EXIT();
 352                           throw e;
 353                       }
 354                   }
 355 karl  1.5.2.1     CDEBUG("_getClass: Class Acquired");
 356 karl  1.1         PEG_METHOD_EXIT();
 357                   return myClass;
 358               }
 359               
 360               
 361               /* Verify that this is one of the legal classnames and
 362                  return indicator which.
 363                  @param - Classname
 364                  @return - Uint32 indicating type
 365                  @Exceptions - throws CIMNotSupportedException if invalid class.
 366               */
 367 karl  1.5     targetClass _verifyValidClassInput(const CIMName& className)
 368 karl  1.1     {
 369                   PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,
 370                           "InteropProvider::_verifyValidClassInput()");
 371                   CDEBUG("Class Name Input = " << className.getString());
 372                   
 373 karl  1.5         if (className.equal(CIM_NAMESPACE_CLASSNAME))
 374 karl  1.1         {
 375                       PEG_METHOD_EXIT();
 376 karl  1.5             return CIM_NAMESPACE;
 377 karl  1.1         }
 378               
 379                   if (className.equal(CIM_OBJECTMANAGER_CLASSNAME))
 380                   {
 381                       PEG_METHOD_EXIT();
 382                       return CIM_OBJECTMANAGER;
 383                   }
 384               
 385                   if (className.equal(CIM_OBJECTMANAGERCOMMUNICATIONMECHANISM_CLASSNAME))
 386                   {
 387                       PEG_METHOD_EXIT();
 388                       return CIM_OBJECTMANAGERCOMMUNICATIONMECHANISM;
 389                   }
 390               
 391                   if (className.equal(CIM_CIMXMLCOMMUNICATIONMECHANISM_CLASSNAME))
 392                   {
 393                       PEG_METHOD_EXIT();
 394                       return CIM_OBJECTMANAGERCOMMUNICATIONMECHANISM;
 395                   }
 396               
 397                   // Last entry, reverse test and returnOK if CIM_Namespace
 398 karl  1.1         if (!className.equal(CIM_NAMESPACE_CLASSNAME))
 399                   {
 400 karl  1.5.2.1         CDEBUG("Invalid Class received " << className.getString());
 401 karl  1.1             PEG_METHOD_EXIT();
 402                       throw CIMNotSupportedException
 403                           (className.getString() + " not supported by Interop Provider");
 404                   }
 405               
 406                   PEG_METHOD_EXIT();
 407                   return CIM_NAMESPACE;
 408               }
 409               
 410               /* validate the authorization of the user name against the namespace.
 411               */
 412               String _validateUserID(const OperationContext & context)
 413               {
 414                   //ATTN-DME-P3-20020522: ADD AUTHORIZATION CHECK TO __NAMESPACE PROVIDER
 415                   String userName;
 416                   try
 417                   {
 418                       IdentityContainer container = context.get(IdentityContainer::NAME);
 419                       userName = container.getUserName();
 420                   }
 421                   catch (...)
 422 karl  1.1         {
 423                      userName = String::EMPTY;
 424                   }
 425                   return userName;
 426               }
 427               
 428               
 429               void _buildInstanceCommonKeys(CIMInstance& instance)
 430               {
 431                   
 432                   PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,
 433                           "InteropProvider::_buildInstanceCommonKeys()");
 434                   String SystemCreationClassName = System::getSystemCreationClassName ();
 435                   if (SystemCreationClassName == String::EMPTY)
 436                   {
 437 karl  1.5             // This in place because global is often Empty
 438 karl  1.1             SystemCreationClassName = "CIM_ComputerSystem";
 439                   }
 440               
 441                   String SystemName = System::getHostName();
 442               
 443 karl  1.5         // Add property SystemCreationClassName
 444 karl  1.1         instance.addProperty(
 445                       (CIMProperty(CIM_NAMESPACE_PROPERTY_SYSTEMCREATIONCLASSNAME,
 446                                    SystemCreationClassName)));
 447 karl  1.5         // Add property SystemName
 448 karl  1.1         instance.addProperty(
 449                       (CIMProperty(CIM_NAMESPACE_PROPERTY_SYSTEMNAME,
 450                                    SystemName)));
 451                   PEG_METHOD_EXIT();
 452               }
 453               
 454               CIMInstance _buildInstancCIMXMLCommunicationMechanism()
 455               {
 456                   PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,
 457                           "InteropProvider::_buildInstanceCIMXMLCommunicationMechanism()");
 458                   
 459                   CIMInstance instance(CIM_OBJECTMANAGERCOMMUNICATIONMECHANISM_CLASSNAME);
 460               
 461                   _buildInstanceCommonKeys(instance);
 462               
 463                   //CreationClassName
 464                   instance.addProperty(
 465                       (CIMProperty(CIM_NAMESPACE_PROPERTY_CREATIONCLASSNAME,
 466                           CIM_OBJECTMANAGERCOMMUNICATIONMECHANISM_CLASSNAME.getString() )));
 467                   
 468                   String name = "PegasusCommunicationMechanism";
 469 karl  1.1     
 470                   //Name, this CommunicationMechanism.
 471                   instance.addProperty(
 472                       (CIMProperty(CIM_NAMESPACE_PROPERTY_NAME,
 473                                    name )));
 474               
 475                   // CommunicationMechanism Property
 476                   instance.addProperty(
 477                       (CIMProperty(OM_COMMUNICATIONMECHANISM,
 478                                    Uint16(2) )));
 479               
 480                   // CommunicationMechanism Property
 481                   instance.addProperty(
 482                       (CIMProperty(OM_COMMUNICATIONMECHANISM,
 483                                    Uint16(2) )));
 484               
 485                   PEG_METHOD_EXIT();
 486                   return(instance);
 487               }
 488               
 489 karl  1.5     /* build instance of the CIMObjectManagerCommunicationClass
 490               */
 491 karl  1.1     CIMInstance _buildInstancCIMObjectCommunicationMechanism()
 492               {
 493                   PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,
 494                           "InteropProvider::_buildInstanceCIMObjectCommunicationMechanism()");
 495                   
 496                   CIMInstance instance(CIM_CIMXMLCOMMUNICATIONMECHANISM_CLASSNAME);
 497               
 498                   _buildInstanceCommonKeys(instance);
 499               
 500               
 501 karl  1.5         //CreationClassName - Class this instance created from.
 502 karl  1.1         instance.addProperty(
 503                       (CIMProperty(CIM_NAMESPACE_PROPERTY_CREATIONCLASSNAME,
 504                           CIM_OBJECTMANAGERCOMMUNICATIONMECHANISM_CLASSNAME.getString() )));
 505                   
 506 karl  1.5         String name = "PegasusCIMXMLCommunicationMechanism";
 507                   //Name, this CommunicationMechanism. The use of this name is not
 508                   // clear right now
 509 karl  1.1         instance.addProperty(
 510                       (CIMProperty(CIM_NAMESPACE_PROPERTY_NAME,
 511                                    name )));
 512               
 513 karl  1.5         // CommunicationMechanism Property. Set to 2, CIMXML for now.
 514 karl  1.1         instance.addProperty(
 515                       (CIMProperty(OM_COMMUNICATIONMECHANISM,
 516                                    Uint16(2) )));
 517               
 518                   //Functional Profiles Supported Property.
 519                   Array<Uint16> profiles;
 520                   Array<String> profileDescriptions;
 521               
 522                   profiles.append(2); profileDescriptions.append("Basic Read");
 523                   profiles.append(3); profileDescriptions.append("Basic Write");
 524                   profiles.append(4); profileDescriptions.append("Schema Manipulation");
 525                   profiles.append(5); profileDescriptions.append("Instance Manipulation");
 526                   profiles.append(6); profileDescriptions.append("Association Traversal");
 527                   profiles.append(8); profileDescriptions.append("Qualifier Declaration");
 528                   profiles.append(9); profileDescriptions.append("Indications");
 529               
 530 karl  1.5         CIMValue profileValue(profiles);
 531                   CIMValue profileDescriptionsValue(profileDescriptions);
 532               
 533 karl  1.1         instance.addProperty(
 534                       (CIMProperty(OM_FUNCTIONALPROFILESSUPPORTED,
 535                                    profileValue )));
 536                   instance.addProperty(
 537                       (CIMProperty(OM_FUNCTIONALPROFILEDESCRIPTIONS,
 538                                    profileDescriptionsValue )));
 539               
 540                   // Multiple OperationsSupported Property
 541                   instance.addProperty(
 542                       (CIMProperty(OM_MULTIPLEOPERATIONSSUPPORTED,
 543                                    Boolean(false) )));
 544 karl  1.5     
 545                   // AuthenticationMechanismsSupported Property
 546 karl  1.1     
 547                   Array<Uint16> authentications;
 548                   Array<String> authenticationDescriptions;
 549 karl  1.5     
 550                   profiles.append(3); profileDescriptions.append("Basic");
 551               
 552 karl  1.1         CIMValue authenticationValue(authentications);
 553                   CIMValue authenticationDescriptionsValue(authenticationDescriptions);
 554                   
 555                   instance.addProperty(
 556                       (CIMProperty(OM_AUTHENTICATIONMECHANISMSSUPPORTED,
 557                                    authenticationValue )));
 558                   instance.addProperty(
 559                       (CIMProperty(OM_AUTHENTICATIONMECHANISMDESCRIPTIONS,
 560                                    authenticationDescriptionsValue )));
 561                   
 562                   //Version property
 563                   instance.addProperty(
 564                       (CIMProperty(OM_VERSION,
 565                                    CIMXMLProtocolVersion )));
 566               
 567                   PEG_METHOD_EXIT();
 568                   return(instance);
 569               }
 570 karl  1.5     /* Gets the value for the CIMObjectManager name.  This is a key
 571                  property with the following characteristics.
 572                  1. It is persistent. This must be persistent through CIMOM
 573                  restarts.  We will save it in the instance database to achieve this. 
 574                  2. It must be unique. We cannot create duplicate CIMOM names
 575                  3. It is based on the DMTF description of how unique InstanceIds
 576                  are defined (Trademark/etc followed by unique identification.
 577                  Temporarily we simply get
 578                  1. Prefix which is in Constants
 579                  2. Host Name
 580                  3. Current time
 581 karl  1.1     
 582 karl  1.5     */
 583 karl  1.1     String _getObjectManagerName()
 584               {
 585 karl  1.5         String objectManagerName = PegasusInstanceIDGlobalPrefix;
 586                   objectManagerName.append("_");
 587                   objectManagerName.append(System::getHostName());
 588                   objectManagerName.append(System::getCurrentASCIITime());
 589                   return (objectManagerName);
 590 karl  1.1     }
 591               
 592 karl  1.5     CIMInstance InteropProvider::_buildInstanceCIMObjectManager()
 593 karl  1.1     {
 594                   PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,
 595                           "InteropProvider::_buildInstanceCIMObjectManager()");
 596               
 597 karl  1.5     
 598                   if (!instanceOfCIMObjectManager.isUninitialized())
 599                   {
 600                       PEG_METHOD_EXIT();
 601                       return(instanceOfCIMObjectManager);
 602                   }
 603               
 604                   // Try to get persistent instance from repository
 605                   Array<CIMInstance> instances;
 606                   try
 607                   {
 608                       instances = _repository->enumerateInstances(_operationNamespace,
 609                                     CIM_OBJECTMANAGER_CLASSNAME );
 610                   }
 611                   catch(CIMException& e)
 612                   {
 613                       PEG_METHOD_EXIT();
 614                       throw e;
 615                   }
 616                   catch(Exception& e)
 617                   {
 618 karl  1.5             PEG_METHOD_EXIT();
 619                       throw e;
 620                   }
 621                   
 622                   if (instances.size() >= 1)
 623                   {
 624                       instanceOfCIMObjectManager = instances[0];
 625                       PEG_METHOD_EXIT();
 626                       return(instanceOfCIMObjectManager);
 627                   }
 628               
 629                   //
 630                   // Must build new instance and save it.
 631                   //
 632 karl  1.1         CIMInstance instance(CIM_OBJECTMANAGER_CLASSNAME);
 633 karl  1.5         instanceOfCIMObjectManager = instance;
 634 karl  1.1     
 635 karl  1.5         _buildInstanceCommonKeys(instanceOfCIMObjectManager);
 636 karl  1.1     
 637 karl  1.5         //CreationClassName -- This class.
 638                   instanceOfCIMObjectManager.addProperty(
 639 karl  1.1             (CIMProperty(CIM_NAMESPACE_PROPERTY_CREATIONCLASSNAME,
 640                                    CIM_OBJECTMANAGER_CLASSNAME.getString() )));
 641                   //Name, this CIMObject Manager.
 642 karl  1.5         instanceOfCIMObjectManager.addProperty(
 643 karl  1.1             (CIMProperty(CIM_NAMESPACE_PROPERTY_NAME,
 644                                    _getObjectManagerName() )));
 645               
 646                   //Property GatherStatisticalData. Note that today we do not
 647                   // have a dynamic activation for this value.
 648                   
 649               #ifdef PEGASUS_HAS_PERFINST
 650                   Boolean gatherStatData = true;
 651               #else
 652                   Boolean gatherStatData = false;
 653               #endif
 654 karl  1.5         instanceOfCIMObjectManager.addProperty(
 655 karl  1.1             (CIMProperty(OM_GATHERSTATISTICALDATA,
 656 karl  1.2                          Boolean(gatherStatData) )));
 657 karl  1.5         
 658                   // write the instance to the repository
 659                   CIMObjectPath instancepath;
 660                   try
 661                   {
 662                       instancepath = _repository->createInstance(_operationNamespace,
 663                                      instanceOfCIMObjectManager );
 664                   }
 665                   catch(CIMException& e)
 666                   {
 667                       PEG_METHOD_EXIT();
 668                       throw e;
 669                   }
 670                   catch(Exception& e)
 671                   {
 672 karl  1.1         PEG_METHOD_EXIT();
 673 karl  1.5             throw e;
 674                   }
 675                   
 676                   PEG_METHOD_EXIT();
 677                   return(instanceOfCIMObjectManager);
 678 karl  1.1     }
 679               
 680               /* generate one instance of the CIM_Namespace class with the
 681                  properties
 682                  @param namespace name to put into the class
 683                  @exceptions - exceptions carried forward from create instance
 684                  and addProperty.
 685               */
 686 karl  1.5     
 687               
 688               /* Create an instance of the CIM_Namespace class which is based
 689                  on the following CIM MOF Specification
 690               [Version ("2.6.0"), Description (
 691                   "Namespace provides a domain (in other words, a container), "
 692                   "in which the instances [of a class] are guaranteed to be "
 693                   "unique per the KEY qualifier definitions.  It is named "
 694                   "relative to the CIM_ObjectManager implementation that "
 695                   "provides such a domain.") ]
 696               class CIM_Namespace : CIM_ManagedElement {
 697                       
 698                   [Propagated("CIM_ObjectManager.SystemCreationClassName"), Key, 
 699                       MaxLen (256), Description (
 700                          "The scoping System's CreationClassName.") ]
 701                   string SystemCreationClassName;
 702               
 703                   [Propagated("CIM_ObjectManager.SystemName"), Key, MaxLen (256),
 704                       Description ("The scoping System's Name.") ]
 705                   string SystemName;
 706               
 707 karl  1.5         [Propagated ("CIM_ObjectManager.CreationClassName"), Key,
 708                       MaxLen (256), Description (
 709                          "The scoping ObjectManager's CreationClassName.") ]
 710                   string ObjectManagerCreationClassName;
 711               
 712                   [Propagated ("CIM_ObjectManager.Name"), Key, MaxLen (256), 
 713                       Description ("The scoping ObjectManager's Name.") ]
 714                   string ObjectManagerName;
 715               
 716                   [Key, MaxLen (256), Description (
 717                       "CreationClassName indicates the name of the class or the "
 718                       "subclass used in the creation of an instance. When used "
 719                       "with the other key properties of this class, this property "
 720                       "allows all instances of this class and its subclasses to "
 721                       "be uniquely identified.") ]
 722                   string CreationClassName;
 723                       
 724                   [Key, MaxLen (256), Description (
 725                       "A string to uniquely identify the Namespace within "
 726                       "the ObjectManager.") ]
 727                   string Name;
 728 karl  1.5     
 729                   [Required, Write, Description (
 730                       "Enumeration indicating the organization/schema of the "
 731                       "Namespace's objects. For example, they may be instances "
 732                       "of classes of a specific CIM version."),
 733                       ValueMap {"0", "1", "2", "3", "4", "5", "6", "7", "8", "9",
 734                                 "10", "200", "201", "202"},
 735                       Values {"Unknown", "Other", "CIM 1.0", "CIM 2.0",       
 736                             "CIM 2.1", "CIM 2.2", "CIM 2.3", "CIM 2.4", "CIM 2.5",
 737                             "CIM 2.6", "CIM 2.7", "DMI Recast", "SNMP Recast", 
 738                                 "CMIP Recast"},
 739                       ModelCorrespondence {"CIM_Namespace.DescriptionOfClassInfo"} ]
 740                   uint16 ClassInfo;
 741               
 742                   [Write, Description (
 743                       "A string providing more detail (beyond the general "
 744                       "classification in ClassInfo) for the object hierarchy of "
 745                       "the Namespace."),
 746                       ModelCorrespondence {"CIM_Namespace.ClassInfo"} ]
 747                   string DescriptionOfClassInfo;
 748               };
 749 karl  1.5     
 750               */
 751 karl  1.1     CIMInstance _buildInstanceCIMNamespace(const CIMNamespaceName & nameSpace)
 752               {
 753 karl  1.5.2.1     CDEBUG("_buildInstnaceCIMNamespace enter");
 754 karl  1.1         PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,
 755                           "InteropProvider::_buildInstanceCIMNamespace()");
 756 karl  1.5.2.1     
 757 karl  1.1         String ObjectManagerName = "ObjectManagerNameValue";
 758                   String ClassInfo = "ClassInfo";
 759                   String DescriptionOfClassInfo = "DescriptionOfClassInfo";
 760                   
 761 karl  1.5.2.1     CDEBUG("_buildInstnaceCIMNamespace create instance");
 762 karl  1.1         CIMInstance instance(CIM_NAMESPACE_CLASSNAME);
 763               
 764                   /*  The following moved to common create
 765                   // Add the properties
 766                   // SystemCreationClassName
 767                   instance.addProperty(
 768                       (CIMProperty(CIM_NAMESPACE_PROPERTY_SYSTEMCREATIONCLASSNAME,
 769                                    SystemCreationClassName)));
 770                   // SystemName
 771                   instance.addProperty(
 772                       (CIMProperty(CIM_NAMESPACE_PROPERTY_SYSTEMNAME,
 773                                    SystemName)));
 774                   */
 775 karl  1.5.2.1 
 776                   CDEBUG("_buildInstnaceCIMNamespace build common keys");
 777 karl  1.1         _buildInstanceCommonKeys(instance);
 778               
 779 karl  1.5.2.1     CDEBUG("_buildInstnaceCIMNamespace add properties");
 780 karl  1.1         //ObjectManagerCreationClassName
 781                   instance.addProperty(
 782                       (CIMProperty(CIM_NAMESPACE_PROPERTY_OBJECTMANAGERCREATIONCLASSNAME,
 783                                    CIM_OBJECTMANAGER_CLASSNAME.getString())));
 784                   //ObjectManagerName
 785                   // This is the one we have to sort out ATTN: TBD KS P0
 786                   instance.addProperty(
 787                       (CIMProperty(CIM_NAMESPACE_PROPERTY_OBJECTMANAGERNAME,
 788                                    ObjectManagerName)));
 789                   //CreationClassName
 790                   instance.addProperty(
 791                       (CIMProperty(CIM_NAMESPACE_PROPERTY_CREATIONCLASSNAME,
 792                                    CIM_NAMESPACE_CLASSNAME.getString() )));
 793                   //Name
 794                   instance.addProperty(
 795                       (CIMProperty(CIM_NAMESPACE_PROPERTY_NAME,
 796                                    nameSpace.getString() )));
 797               
 798                   //ClassInfo
 799                   instance.addProperty(
 800                       (CIMProperty(CIM_NAMESPACE_PROPERTY_CLASSINFO,
 801 karl  1.1                          ClassInfo)));
 802               
 803                   //DescriptionofClassInfo
 804                   instance.addProperty(
 805                       (CIMProperty(CIM_NAMESPACE_PROPERTY_DESCRIPTIONOFCLASSINFO,
 806                                    DescriptionOfClassInfo)));
 807 karl  1.5.2.1     CDEBUG("_buildInstnaceCIMNamespace properties built. returning instance");
 808 karl  1.1         PEG_METHOD_EXIT();
 809                   return(instance);
 810               }
 811 karl  1.5     void _validateCIMNamespaceKeys(const CIMObjectPath& objectPath)
 812               {
 813 karl  1.5.2.1     PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,
 814                           "InteropProvider::_validateCIMNamespaceKeys");
 815               
 816 karl  1.5         Boolean valid = true;
 817                   CIMName propertyName;
 818                   if (!_validateRequiredProperty(objectPath,
 819                               CIM_NAMESPACE_PROPERTY_SYSTEMCREATIONCLASSNAME,
 820                               System::getSystemCreationClassName ()))
 821                   {
 822                       propertyName = CIM_NAMESPACE_PROPERTY_SYSTEMCREATIONCLASSNAME;
 823                       valid = false;
 824                   }
 825                   if (!_validateRequiredProperty(objectPath,
 826                               CIM_NAMESPACE_PROPERTY_SYSTEMNAME,
 827                               System::getHostName()))
 828                   {
 829                       propertyName = CIM_NAMESPACE_PROPERTY_SYSTEMNAME;
 830                       valid = false;
 831                   }
 832                   if (!_validateRequiredProperty(objectPath,
 833                               CIM_NAMESPACE_PROPERTY_OBJECTMANAGERCREATIONCLASSNAME,
 834                               CIM_OBJECTMANAGER_CLASSNAME.getString()))
 835                   {
 836                       propertyName = CIM_NAMESPACE_PROPERTY_OBJECTMANAGERCREATIONCLASSNAME;
 837 karl  1.5             valid = false;
 838                   }
 839               
 840                   // ATTN: This one still a problem.  We have to get the name first
 841                   if (!_validateRequiredProperty(objectPath,
 842                               CIM_NAMESPACE_PROPERTY_OBJECTMANAGERNAME,
 843                               String::EMPTY))
 844                   {
 845                       propertyName = CIM_NAMESPACE_PROPERTY_OBJECTMANAGERNAME;
 846                       valid = false;
 847                   }
 848                   if (!_validateRequiredProperty(objectPath,
 849                               CIM_NAMESPACE_PROPERTY_CREATIONCLASSNAME,
 850                               System::getHostName()))
 851                   {
 852                       propertyName = CIM_NAMESPACE_PROPERTY_CREATIONCLASSNAME;
 853                       valid = false;
 854                   }
 855               
 856                   if (!_validateRequiredProperty(objectPath,
 857                               CIM_NAMESPACE_PROPERTY_NAME,
 858 karl  1.5                     String::EMPTY))
 859                   {
 860                       propertyName = CIM_NAMESPACE_PROPERTY_NAME;
 861                       valid = false;
 862                   }
 863               
 864                   if (false)
 865                   {
 866 karl  1.5.2.1         PEG_METHOD_EXIT();
 867 karl  1.5             throw CIMInvalidParameterException(
 868                           "Invalid key property: " + propertyName.getString());
 869                   }
 870 karl  1.5.2.1     PEG_METHOD_EXIT();
 871 karl  1.5     }
 872 karl  1.5.2.1 
 873 karl  1.5     void _validateCIMNamespaceKeys(const CIMInstance& instance)
 874               {
 875 karl  1.5.2.1     PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,
 876                           "InteropProvider::_validateCIMNamespaceKeys");
 877 karl  1.5         Boolean valid = true;
 878                   CIMName propertyName;
 879                   if (!_validateRequiredProperty(instance,
 880                               CIM_NAMESPACE_PROPERTY_SYSTEMCREATIONCLASSNAME,
 881                               System::getSystemCreationClassName ()))
 882                   {
 883                       propertyName = CIM_NAMESPACE_PROPERTY_SYSTEMCREATIONCLASSNAME;
 884                       valid = false;
 885                   }
 886               
 887                   if (!_validateRequiredProperty(instance,
 888                               CIM_NAMESPACE_PROPERTY_SYSTEMNAME,
 889                               System::getHostName()))
 890                   {
 891                       propertyName = CIM_NAMESPACE_PROPERTY_SYSTEMNAME;
 892                       valid = false;
 893                   }
 894               
 895                   if (!_validateRequiredProperty(instance,
 896                               CIM_NAMESPACE_PROPERTY_OBJECTMANAGERCREATIONCLASSNAME,
 897                               CIM_OBJECTMANAGER_CLASSNAME.getString()))
 898 karl  1.5         {
 899                       propertyName = CIM_NAMESPACE_PROPERTY_OBJECTMANAGERCREATIONCLASSNAME;
 900                       valid = false;
 901                   }
 902               
 903                   // ATTN: This one still a problem.  We have to get the name first
 904                   if (!_validateRequiredProperty(instance,
 905                               CIM_NAMESPACE_PROPERTY_OBJECTMANAGERNAME,
 906                               String::EMPTY))
 907                   {
 908                       propertyName = CIM_NAMESPACE_PROPERTY_OBJECTMANAGERNAME;
 909                       valid = false;
 910                   }
 911                   if (!_validateRequiredProperty(instance,
 912                               CIM_NAMESPACE_PROPERTY_CREATIONCLASSNAME,
 913                               System::getHostName()))
 914                   {
 915                       propertyName = CIM_NAMESPACE_PROPERTY_CREATIONCLASSNAME;
 916                       valid = false;
 917                   }
 918               
 919 karl  1.5         if (!_validateRequiredProperty(instance,
 920                               CIM_NAMESPACE_PROPERTY_NAME,
 921                               String::EMPTY))
 922                   {
 923                       propertyName = CIM_NAMESPACE_PROPERTY_NAME;
 924                       valid = false;
 925                   }
 926               
 927                   if (false)
 928                   {
 929 karl  1.5.2.1         PEG_TRACE_STRING(TRC_CONTROLPROVIDER, Tracer::LEVEL4,
 930                           "Invalid CIM_Namespace Key Property " +  propertyName.getString());
 931                       PEG_METHOD_EXIT();
 932 karl  1.5             throw CIMInvalidParameterException(
 933 karl  1.5.2.1             "Invalid CIM_Namespace key property: " + propertyName.getString());
 934 karl  1.5         }
 935 karl  1.5.2.1     PEG_TRACE_STRING(TRC_CONTROLPROVIDER, Tracer::LEVEL4, "CIM_Namespace Keys Valid");
 936                   PEG_METHOD_EXIT();
 937 karl  1.5     }
 938               
 939 karl  1.5.2.1 /* Given a namespace name, class and instance build the instance path for a
 940 karl  1.1        the object.  This builds all components of the path
 941                  @param namespace name to build
 942                  @return CIMObjectPath containing namespace, class and keybinding 
 943                  components of path
 944                  @exceptions - TBD
 945               */
 946               // ATTN: KS Build path from instance and instance from class.  Not sure
 947               //   we want to always do this.  Consider change to build keys directly
 948               
 949               CIMObjectPath InteropProvider::_buildInstancePath(const CIMNamespaceName& name,
 950                                                          const CIMName className, 
 951                                                          const CIMInstance& instance)
 952               {
 953                   PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,
 954 karl  1.5.2.1             "InteropProvider::_buildInstancePath");
 955 karl  1.1     
 956                   // get the class CIM_Namespace class to use in building path
 957 karl  1.5.2.1 
 958                   // Exception out if Class does not exist in this namespace
 959 karl  1.1         CIMClass thisClass = _getClass(_operationNamespace, className);
 960               
 961                   // XmlWriter::printInstanceElement(instance);
 962                   
 963                   CIMObjectPath ref = instance.buildPath(thisClass);
 964                   
 965 karl  1.5.2.1     CDEBUG("_buildInstancePath. Built path. path = " << ref.toString() );
 966 karl  1.1         PEG_METHOD_EXIT();
 967                   return(ref);
 968               }
 969               
 970               
 971               /* _isNamespace determines if the namespace in the second
 972                  parameter is in the array in the first parameter.
 973                   @param array of possible namespaces
 974                   @param canidate namespace
 975                   @return - true if found
 976               */
 977               Boolean _isNamespace(
 978                       Array<CIMNamespaceName>& namespaceNames,
 979               	CIMNamespaceName& namespaceName)
 980               
 981               {
 982                    Boolean found = false;
 983                    for(Uint32 i = 0; i < namespaceNames.size(); i++)
 984                    {
 985                       if(namespaceNames[i].equal ( namespaceName))
 986                       {
 987 karl  1.1                 return true;
 988                       }
 989                    }
 990                    return false;
 991               }
 992               
 993               Boolean _isChild(
 994                       CIMNamespaceName& parentNamespaceName,
 995               	CIMNamespaceName& namespaceName)
 996               
 997               {
 998                   String parent = parentNamespaceName.getString();
 999                   String child = namespaceName.getString();
1000                  //
1001                  //  If length of namespace name is shorter than or equal to the
1002                  //  length of parent namespace name, cannot be a child
1003                  //
1004                  if (child.size () <= parent.size ())
1005                  {
1006                     return false;
1007                  }
1008 karl  1.1     
1009                  //
1010                  //  Compare prefix substring of namespace name with parent namespace name
1011                  //
1012                  else if (String::equalNoCase (child.subString (0, parent.size ()), parent))
1013                  {
1014                     return true;
1015                  }
1016                  return false;
1017               }
1018               //**************************************************************
1019               // Overloaded functions to get key value with different params
1020               //**************************************************************
1021               
1022               /* find the name key in the keybindings and return the value.
1023                   Executes exception if the key not found
1024                   @param object path we will search
1025                   @param keyName - Name of the key to find.
1026                   @return value of name property
1027                   @exceptions CIMInvalidParameterException
1028               */
1029 karl  1.1     String _getKeyValue(const CIMObjectPath& instanceName, const CIMName& keyName)
1030               {
1031                   Array<CIMKeyBinding> kbArray = instanceName.getKeyBindings();
1032               
1033                   // find the correct key binding
1034                   for (Uint32 i = 0; i < kbArray.size(); i++)
1035                   {
1036                       if (kbArray[i].getName() == keyName)
1037                       {
1038                           return (kbArray[i].getValue());
1039                       }
1040                   }
1041                   throw CIMInvalidParameterException("Invalid key property: " + keyName.getString());
1042               }
1043               
1044               String _getKeyValue(const CIMInstance& instance, const CIMName& keyName)
1045               {
1046                   Uint32 pos;
1047                   CIMValue propertyValue;
1048               
1049                   pos = instance.findProperty(keyName);
1050 karl  1.1         if (pos == PEG_NOT_FOUND)
1051                   {
1052                      throw CIMPropertyNotFoundException
1053                          (NAMESPACE_PROPERTYNAME.getString());
1054                   }
1055                   
1056                   propertyValue = instance.getProperty(pos).getValue();
1057                   if (propertyValue.getType() != CIMTYPE_STRING)
1058                   {
1059                      throw CIMInvalidParameterException("Invalid type for property: "
1060                                            + NAMESPACE_PROPERTYNAME.getString());
1061                   }
1062                   String name;
1063                   propertyValue.get(name);
1064                   return(name);
1065                   //ATTN: KS Returns String whereas below returns CIMNamespaceName.
1066               }
1067               
1068               /* gets the key value for the __Namespace property "name"
1069                  from the instance provided. Sets childNamespaceName and
1070                  isRelativeName fields
1071 karl  1.1        This overload called if instance provided.
1072               */
1073               void _getKeyValue (
1074                   const CIMInstance& namespaceInstance,
1075               	CIMNamespaceName& childNamespaceName,
1076               	Boolean& isRelativeName)
1077               
1078               {
1079                   //Validate key property
1080                   
1081                   Uint32 pos;
1082                   CIMValue propertyValue;
1083                   
1084                   // [Key, MaxLen (256), Description (
1085                   //       "A string that uniquely identifies the Namespace "
1086                   //       "within the ObjectManager.") ]
1087                   // string Name;
1088                   
1089                   pos = namespaceInstance.findProperty(NAMESPACE_PROPERTYNAME);
1090                   if (pos == PEG_NOT_FOUND)
1091                   {
1092 karl  1.1            throw CIMPropertyNotFoundException
1093                          (NAMESPACE_PROPERTYNAME.getString());
1094                   }
1095                   
1096                   propertyValue = namespaceInstance.getProperty(pos).getValue();
1097                   if (propertyValue.getType() != CIMTYPE_STRING)
1098                   {
1099                      throw CIMInvalidParameterException("Invalid type for property: "
1100                                            + NAMESPACE_PROPERTYNAME.getString());
1101                   }
1102                   
1103                   String cnsName;
1104                   propertyValue.get(cnsName);
1105                   childNamespaceName = CIMNamespaceName (cnsName);
1106                   
1107                   isRelativeName = !(childNamespaceName.isNull());
1108               
1109               }
1110               /* gets the key value for the __Namespace property "name"
1111                  from the instance provided. Sets childNamespaceName and
1112                  isRelativeName fields
1113 karl  1.1        This overload called if object path provided.
1114               */
1115               
1116               void _getKeyValue (
1117               	const CIMObjectPath&  instanceName,
1118               	CIMNamespaceName& childNamespaceName,
1119               	Boolean& isRelativeName)
1120               {
1121               
1122                   Array<CIMKeyBinding> kbArray = instanceName.getKeyBindings();
1123                   if ((kbArray.size() == 1) &&
1124                           (kbArray[0].getName() == NAMESPACE_PROPERTYNAME))
1125                   {
1126                      childNamespaceName = CIMNamespaceName (kbArray[0].getValue());
1127                      isRelativeName = !(childNamespaceName.isNull());
1128                   }
1129                   else
1130                   {
1131                      throw CIMInvalidParameterException("Invalid key property:  ");
1132                   }
1133               }
1134 karl  1.1     
1135               /* generate the full namespace name from the parent and child
1136                  components
1137                  @param namespaceNames - List of all namespaces
1138                  @param parentNamespaceName
1139                  @param childNamespaceName
1140                  @param Boolean isrelative
1141                  @return full namespacename created from parent + child
1142                  Note that if isrelative is true, parent is tested for validty
1143               */
1144               CIMNamespaceName _generateFullNamespaceName(
1145                       Array<CIMNamespaceName>& namespaceNames,
1146               	CIMNamespaceName& parentNamespaceName,
1147               	CIMNamespaceName& childNamespaceName,
1148               	Boolean isRelativeName)
1149               
1150               {
1151                   // If isRelativeName is true, then the parentNamespace
1152                   // MUST exist
1153                   //
1154                   CIMNamespaceName fullNamespaceName;
1155 karl  1.1     
1156                   if (isRelativeName)
1157                   {
1158                     if (!_isNamespace(namespaceNames, parentNamespaceName))
1159                     {
1160                        throw CIMObjectNotFoundException("Parent namespace does not exist: "
1161                                                 + parentNamespaceName.getString());
1162                     }
1163                     // Create full namespace name by prepending parentNamespaceName
1164                     fullNamespaceName = CIMNamespaceName (parentNamespaceName.getString() 
1165                         + "/" + childNamespaceName.getString());
1166                   }
1167                   else
1168                   {
1169                     fullNamespaceName = parentNamespaceName;
1170                   }
1171                   return(fullNamespaceName);
1172               
1173               }
1174               
1175               //***************************************************************************
1176 karl  1.1     //  The following section is the Instance Operation processors
1177               //***************************************************************************
1178               //                createInstance
1179               //***************************************************************************
1180               void InteropProvider::createInstance(
1181               	const OperationContext & context,
1182               	const CIMObjectPath & instanceReference,
1183                   const CIMInstance& myInstance,
1184               	ObjectPathResponseHandler & handler)
1185                   {
1186                       PEG_METHOD_ENTER(TRC_CONTROLPROVIDER, "InteropProvider::createInstance()");
1187                       
1188                       CIMNamespaceName childNamespaceName;
1189                       CIMNamespaceName newNamespaceName;
1190                       Boolean isRelativeName;
1191                       CDEBUG("CreateInstance " << instanceReference.toString());
1192                       // operation namespace needed internally to get class.
1193                       _operationNamespace = instanceReference.getNameSpace();
1194                       
1195                       // Verify that ClassName is correct and get value
1196 karl  1.5             targetClass classEnum  = _verifyValidClassInput(instanceReference.getClassName());    
1197 karl  1.5.2.1         CDEBUG("Class Validated");
1198 karl  1.1             String userName = _validateUserID(context);
1199                       CIMObjectPath newInstanceReference;
1200 karl  1.5.2.1         CDEBUG("UserIDValidated");
1201 karl  1.5             if ((classEnum == CIM_OBJECTMANAGER) || 
1202                           (classEnum == CIM_OBJECTMANAGERCOMMUNICATIONMECHANISM)|| 
1203                           (classEnum == CIM_CIMXMLCOMMUNICATIONMECHANISM))
1204                           throw CIMNotSupportedException("InteropProvider, Create Not allowed");
1205 karl  1.1     
1206 karl  1.5.2.1         CDEBUG("CreateInstance: No test for CIM_NamepsaceClass");
1207 karl  1.1             if (classEnum == CIM_NAMESPACE)
1208                       {
1209                           CDEBUG("Create Class from CIM_Namespace");
1210 karl  1.5.2.1 
1211                           // Validate that keys are as required. Does its own exception.
1212 karl  1.5                 _validateCIMNamespaceKeys(myInstance);
1213 karl  1.5.2.1             CDEBUG("_validateCIMNamespaceKeys passed");
1214 karl  1.1                 String namespaceName;
1215                           newNamespaceName = _getKeyValue(myInstance, CIM_NAMESPACE_PROPERTY_NAME);
1216 karl  1.5.2.1             CDEBUG("CreateInstance: rtn form _getKeyValue ");
1217               
1218 karl  1.1                 CIMInstance instance = _buildInstanceCIMNamespace(namespaceName);
1219 karl  1.5.2.1             CDEBUG("CreateInstance:Rtn from _BuildInstanceCIMNamespace for namespace= " << namespaceName);
1220 karl  1.1                 newInstanceReference = _buildInstancePath(CIMNamespaceName(namespaceName),
1221                                                       CIM_NAMESPACE_CLASSNAME, instance);
1222 karl  1.5.2.1             CDEBUG("CreateInstance:Go to common create functions");
1223 karl  1.1             }
1224 karl  1.5.2.1 
1225 karl  1.1             else   // Process the __Namespace request to get namespace name value
1226                       {
1227 karl  1.5.2.1             CDEBUG("CreateInstance: Fell through to __Namespace processing");
1228 karl  1.1                 _getKeyValue(myInstance, childNamespaceName, isRelativeName);
1229                           CIMNamespaceName parentNamespaceName = instanceReference.getNameSpace();
1230                           
1231                           PEG_TRACE_STRING(TRC_CONTROLPROVIDER, Tracer::LEVEL4,
1232                              "childNamespaceName = " + childNamespaceName.getString() +
1233                              ", isRelativeName = " +
1234                              (isRelativeName?String("true"):String("false")) +
1235                              ", parentNamespaceName = " + parentNamespaceName.getString());
1236 karl  1.5.2.1             CDEBUG("__Namespace Process. parent= " << parentNamespaceName.getString() );
1237 karl  1.1                 Array<CIMNamespaceName> namespaceNames;
1238                           namespaceNames = _enumerateNameSpaces();
1239                           
1240                           newNamespaceName = _generateFullNamespaceName(
1241                               namespaceNames, parentNamespaceName,
1242                                        childNamespaceName, isRelativeName);
1243                           
1244                           // return key (i.e., CIMObjectPath) for newly created namespace
1245                           
1246                           Array<CIMKeyBinding> keyBindings;
1247                           keyBindings.append(CIMKeyBinding(NAMESPACE_PROPERTYNAME,
1248                                isRelativeName?childNamespaceName.getString():
1249                                                   parentNamespaceName.getString(),
1250                                                        CIMKeyBinding::STRING));
1251                           //Add namespace class and keybindings
1252                           newInstanceReference.set(String::EMPTY, parentNamespaceName,
1253                                                        __NAMESPACE_CLASSNAME, keyBindings);
1254                       }
1255                       // Create the new namespace
1256                       try
1257                       {
1258 karl  1.5.2.1             CDEBUG("Create namespace " << newNamespaceName.getString());
1259                           PEG_TRACE_STRING(TRC_CONTROLPROVIDER, Tracer::LEVEL4,
1260                               "Namespace = " + newNamespaceName.getString() + 
1261                                   " to be created.");
1262                           
1263 karl  1.1                 _repository->createNameSpace(newNamespaceName);
1264                       
1265                           PEG_TRACE_STRING(TRC_CONTROLPROVIDER, Tracer::LEVEL4,
1266                               "Namespace = " + newNamespaceName.getString() + 
1267                                   " successfully created.");
1268                           // ATTN: Add standardlog entry here.
1269                       }
1270                       catch(CIMException& e)
1271                       {
1272                          PEG_METHOD_EXIT();
1273                          throw e;
1274                       }
1275                       catch(Exception& e)
1276                       {
1277                          PEG_METHOD_EXIT();
1278                          throw e;
1279                       }
1280                       
1281                       // begin processing the request
1282                       handler.processing();
1283               
1284 karl  1.1     
1285                      handler.deliver(newInstanceReference);
1286               
1287                      // complete processing the request
1288                      handler.complete();
1289               
1290                      PEG_METHOD_EXIT();
1291                      return;
1292                  }
1293               
1294               //***************************************************************************
1295               //                deleteInstance
1296               //***************************************************************************
1297               void InteropProvider::deleteInstance(
1298               	const OperationContext & context,
1299               	const CIMObjectPath & instanceName,
1300               	ResponseHandler & handler)
1301                   {
1302                       PEG_METHOD_ENTER(TRC_CONTROLPROVIDER, "InteropProvider::deleteInstance");
1303                       CDEBUG("deleteInstance" << instanceName.toString());
1304                       CIMNamespaceName childNamespaceName;
1305 karl  1.1             CIMNamespaceName deleteNamespaceName;
1306                       Boolean isRelativeName;
1307                       
1308                       // Verify that ClassName is correct and get value
1309 karl  1.5             targetClass classEnum  = _verifyValidClassInput(instanceName.getClassName());    
1310 karl  1.1             
1311                       String userName = _validateUserID(context);
1312               
1313                       Array<CIMNamespaceName> namespaceNames;
1314                       namespaceNames = _enumerateNameSpaces();
1315               
1316 karl  1.5             if ((classEnum == CIM_OBJECTMANAGER) || 
1317                           (classEnum == CIM_OBJECTMANAGERCOMMUNICATIONMECHANISM)|| 
1318                           (classEnum == CIM_CIMXMLCOMMUNICATIONMECHANISM))
1319                           throw CIMNotSupportedException("Delete Not allowed");
1320 karl  1.1     
1321                       if (classEnum == CIM_NAMESPACE)
1322                       {
1323 karl  1.5                 // validate requred keys.  Exception out if not valid
1324                           _validateCIMNamespaceKeys(instanceName);
1325                           
1326 karl  1.1                 deleteNamespaceName = _getKeyValue(instanceName, CIM_NAMESPACE_PROPERTY_NAME);
1327                           CDEBUG("Delete namespace = " << deleteNamespaceName );
1328                       }
1329                       else  // Procesing for __namespace
1330                       {
1331                   
1332                          _getKeyValue(instanceName, childNamespaceName, isRelativeName);
1333                          CIMNamespaceName parentNamespaceName = instanceName.getNameSpace();
1334                   
1335                          PEG_TRACE_STRING(TRC_CONTROLPROVIDER, Tracer::LEVEL4,
1336                   	       "childNamespaceName = " + childNamespaceName.getString() +
1337                   	       (isRelativeName?String("true"):String("false")) +
1338                   	       ", parentNamespaceName = " + parentNamespaceName.getString());
1339                   
1340                          // begin processing the request
1341                   
1342                          deleteNamespaceName = _generateFullNamespaceName(
1343                              namespaceNames, parentNamespaceName,
1344                                        childNamespaceName, isRelativeName);
1345                       }
1346               
1347 karl  1.1     	    // ATTN: KS Why THis??? 
1348                       if (deleteNamespaceName.equal (ROOTNS))
1349                      {
1350                          throw CIMNotSupportedException("root namespace cannot be deleted.");
1351                      }
1352               
1353               	   _repository->deleteNameSpace(deleteNamespaceName);
1354               
1355               	   PEG_TRACE_STRING(TRC_CONTROLPROVIDER, Tracer::LEVEL4,
1356               	       "Namespace = " + deleteNamespaceName.getString() + 
1357                              " successfully deleted.");
1358 karl  1.5     
1359                      Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::INFORMATION,
1360                          "Interop Provider Delete Namespace: $0",
1361                          deleteNamespaceName.getString());
1362               
1363 karl  1.1            handler.processing();
1364               
1365                      // complete processing the request
1366                      handler.complete();
1367               
1368                      PEG_METHOD_EXIT();
1369                      return ;
1370                   }
1371               
1372               //***************************************************************************
1373               //                getInstance
1374               //***************************************************************************
1375               void InteropProvider::getInstance(
1376                   const OperationContext & context,
1377                   const CIMObjectPath & instanceName,
1378                   const Boolean includeQualifiers,
1379                   const Boolean includeClassOrigin,
1380                   const CIMPropertyList & properatyList,
1381                   InstanceResponseHandler & handler)
1382                   {
1383                       PEG_METHOD_ENTER(TRC_CONTROLPROVIDER, "InteropProvider::getInstance");
1384 karl  1.1             
1385                       // Verify that ClassName is correct and get value
1386 karl  1.5             targetClass classEnum  = _verifyValidClassInput(instanceName.getClassName());    
1387 karl  1.1             
1388                       String userName = _validateUserID(context);
1389                       
1390                       // begin processing the request
1391                       handler.processing();
1392                       if (classEnum == CIM_OBJECTMANAGER)
1393                       {
1394                           CIMInstance instance = _buildInstanceCIMObjectManager();
1395                           handler.deliver(instance);
1396                           handler.complete();
1397                           PEG_METHOD_EXIT();
1398                           return;
1399                       }
1400                       
1401                       if (classEnum == CIM_OBJECTMANAGERCOMMUNICATIONMECHANISM)
1402                       {
1403                           CIMInstance instance = _buildInstancCIMObjectCommunicationMechanism();
1404                           handler.deliver(instance);
1405                           handler.complete();
1406                           PEG_METHOD_EXIT();
1407                           return;
1408 karl  1.1             }
1409               
1410               
1411                       if (classEnum == CIM_CIMXMLCOMMUNICATIONMECHANISM)
1412                       {
1413                           CIMInstance instance = _buildInstancCIMXMLCommunicationMechanism();
1414                           handler.deliver(instance);
1415                           handler.complete();
1416                           PEG_METHOD_EXIT();
1417                           return;
1418               
1419                       }
1420                       
1421                       // Get List of namespaces
1422                       Array<CIMNamespaceName> namespaceNames;
1423                       namespaceNames = _enumerateNameSpaces();
1424                       CIMInstance instance;
1425               
1426                       
1427                       if (classEnum == CIM_NAMESPACE)
1428                       {
1429 karl  1.1                 // Not clear what we have to take into account here.
1430                           // get the namespace from the name value.
1431                           // should check the other keys to see if valid.
1432                           CIMNamespaceName namespaceName;
1433                           namespaceName = _getKeyValue(instanceName, CIM_NAMESPACE_PROPERTY_NAME);
1434                           // ATTN: Why this CIMNamespaceName parentNamespaceName = instanceName.getNameSpace();
1435                           
1436                           if (!_isNamespace(namespaceNames, namespaceName))
1437                           {
1438                               throw CIMObjectNotFoundException("Namespace does not exist: "
1439                                                    + namespaceName.getString());
1440                           }
1441                           PEG_TRACE_STRING(TRC_CONTROLPROVIDER, Tracer::LEVEL4,
1442                              "Namespace = " + namespaceName.getString() + " successfully found.");
1443                           instance = _buildInstanceCIMNamespace(namespaceName);
1444                       }
1445                       else  // processing for __Namespace
1446                       {
1447                           CIMNamespaceName childNamespaceName;
1448                           CIMNamespaceName getNamespaceName;
1449                           Boolean isRelativeName;
1450 karl  1.1                 
1451                           _getKeyValue(instanceName, childNamespaceName, isRelativeName);
1452                           CIMNamespaceName parentNamespaceName = instanceName.getNameSpace();
1453                           
1454                           PEG_TRACE_STRING(TRC_CONTROLPROVIDER, Tracer::LEVEL4,
1455                              "childNamespaceName = " + childNamespaceName.getString() +
1456                              (isRelativeName?String("true"):String("false")) +
1457                              ", parentNamespaceName = " + parentNamespaceName.getString());
1458                           
1459                           
1460                           getNamespaceName = _generateFullNamespaceName(
1461                               namespaceNames, parentNamespaceName,
1462                                        childNamespaceName, isRelativeName);
1463                           
1464                           // exception if not valid namespace
1465                           if (!_isNamespace(namespaceNames, getNamespaceName))
1466                           {
1467                             throw CIMObjectNotFoundException("Namespace deos not exist: "
1468                                                    + getNamespaceName.getString());
1469                           }
1470                           PEG_TRACE_STRING(TRC_CONTROLPROVIDER, Tracer::LEVEL4,
1471 karl  1.1                    "Namespace = " + getNamespaceName.getString() + 
1472                                  " successfully found.");
1473                           
1474                           //Set name of class
1475                           CIMInstance instance(__NAMESPACE_CLASSNAME);
1476                           
1477                           //
1478                           // construct the instance
1479                           //
1480                           instance.addProperty(CIMProperty(NAMESPACE_PROPERTYNAME,
1481                           isRelativeName?childNamespaceName.getString():
1482                                             parentNamespaceName.getString()));
1483                           //instance.setPath(instanceName);
1484                      }
1485               
1486                      handler.deliver(instance);
1487               
1488                      // complete processing the request
1489                      handler.complete();
1490               
1491                      PEG_METHOD_EXIT();
1492 karl  1.1            return ;
1493                   }
1494               
1495               //***************************************************************************
1496               //                enumerateInstances
1497               //***************************************************************************
1498               void InteropProvider::enumerateInstances(
1499                   const OperationContext & context,
1500                   const CIMObjectPath & ref,
1501                   const Boolean includeQualifiers,
1502                   const Boolean includeClassOrigin,
1503                   const CIMPropertyList& propertyList,
1504                   InstanceResponseHandler & handler)
1505                   {
1506                       PEG_METHOD_ENTER(TRC_CONTROLPROVIDER, "InteropProvider::enumerateInstances()");
1507                       CDEBUG("EnumerateInstances");
1508                       // Verify that ClassName is correct and get value
1509 karl  1.5             targetClass classEnum  = _verifyValidClassInput(ref.getClassName());    
1510 karl  1.1             
1511                       String userName = _validateUserID(context);
1512                       
1513                       // The following 3 classes deliver a single instance because
1514                       // that is all there is today.
1515                       if (classEnum == CIM_OBJECTMANAGER)
1516                       {
1517                           CIMInstance instance = _buildInstanceCIMObjectManager();
1518                           handler.deliver(instance);
1519                           handler.complete();
1520                           PEG_METHOD_EXIT();
1521                           return;
1522                       }
1523                       
1524                       if (classEnum == CIM_OBJECTMANAGERCOMMUNICATIONMECHANISM)
1525                       {
1526                           CIMInstance instance = _buildInstancCIMObjectCommunicationMechanism();
1527                           handler.deliver(instance);
1528                           handler.complete();
1529                           PEG_METHOD_EXIT();
1530                           return;
1531 karl  1.1             }
1532               
1533               
1534                       if (classEnum == CIM_CIMXMLCOMMUNICATIONMECHANISM)
1535                       {
1536                           CIMInstance instance = _buildInstancCIMXMLCommunicationMechanism();
1537                           handler.deliver(instance);
1538                           handler.complete();
1539                           PEG_METHOD_EXIT();
1540                           return;
1541               
1542                       }
1543                       
1544                       // ATTN: Fix this up.  should not be here.
1545                       CIMNamespaceName parentNamespaceName = ref.getNameSpace();
1546               
1547                       // ATTN KS Fix this so references both types of namespace
1548                       PEG_TRACE_STRING(TRC_CONTROLPROVIDER, Tracer::LEVEL4,
1549                          "parentNamespaceName = " + parentNamespaceName.getString());
1550                       
1551                       // begin processing the request
1552 karl  1.1             handler.processing();
1553                       
1554                       Array<CIMNamespaceName> namespaceNames = _enumerateNameSpaces();
1555                       
1556                       Array<CIMInstance> instanceArray;
1557                       CDEBUG("Found " << namespaceNames.size() << " namespaces.");
1558                       // Build response objects based on class requested
1559                       for (Uint32 i = 0; i < namespaceNames.size(); i++)
1560                       {
1561                           CDEBUG("For namespace' " << namespaceNames[i].getString());
1562                           CDEBUG("Evaluate ClassEnum" << classEnum);
1563                           if (classEnum == CIM_NAMESPACE)
1564                           {
1565                               CDEBUG("Evaluate CIM_Namespace" << classEnum);
1566                               // Create a valid CIM_Namespace Instance
1567                               CIMInstance instance = _buildInstanceCIMNamespace(namespaceNames[i]);
1568                               instanceArray.append(instance);
1569                               
1570                               PEG_TRACE_STRING(TRC_CONTROLPROVIDER, Tracer::LEVEL4,
1571                               "Namespace = " + namespaceNames[i].getString());
1572                           
1573 karl  1.1                 }
1574                           else // the else covers __NAMESPACE
1575                           {
1576                               // Build the instances. For now simply build the __Namespace instances
1577                               // the only property is name.
1578                               if (_isChild(parentNamespaceName, namespaceNames[i]))
1579                               {
1580                                   CIMInstance instance(__NAMESPACE_CLASSNAME);
1581                                   instance.addProperty(
1582                                       (CIMProperty(NAMESPACE_PROPERTYNAME,
1583                                       namespaceNames[i].getString().subString
1584                                           (parentNamespaceName.getString().size()+1,
1585                                           namespaceNames[i].getString().size()-
1586                                       parentNamespaceName.getString().size()-1))));
1587               
1588                                   instanceArray.append(instance);
1589               
1590                                   //instance.setPath(instanceName);
1591                                   PEG_TRACE_STRING(TRC_CONTROLPROVIDER, Tracer::LEVEL4,
1592                                   "childNamespace = " + namespaceNames[i].getString());
1593                               }
1594 karl  1.1                 }
1595                       }
1596                       handler.deliver(instanceArray);
1597                       
1598                       // complete processing the request
1599                       handler.complete();
1600                       
1601                       PEG_METHOD_EXIT();
1602                   }
1603               
1604               //***************************************************************************
1605               //                enumerateInstanceNames
1606               //***************************************************************************
1607               
1608               void InteropProvider::enumerateInstanceNames(
1609               	const OperationContext & context,
1610               	const CIMObjectPath & classReference,
1611                       ObjectPathResponseHandler & handler)
1612                   {
1613                   	PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,
1614                               "InteropProvider::enumerateInstanceNames()");
1615 karl  1.1     
1616                       // operation namespace needed internally to get class.
1617                       _operationNamespace = classReference.getNameSpace();
1618               
1619 karl  1.5             targetClass classEnum  = _verifyValidClassInput(classReference.getClassName());    
1620 karl  1.1         
1621                       // begin processing the request
1622                       handler.processing();
1623                       
1624                       // The following 3 classes deliver a single instance because
1625                       // that is all there is today.
1626                       if (classEnum == CIM_OBJECTMANAGER)
1627                       {
1628                           CIMInstance instance = _buildInstanceCIMObjectManager();
1629                           CIMObjectPath ref = _buildInstancePath(CIMNamespaceName(),
1630                               CIM_OBJECTMANAGER_CLASSNAME, instance);
1631                           handler.deliver(ref);
1632                           handler.complete();
1633                           PEG_METHOD_EXIT();
1634                           return;
1635                       }
1636                       
1637                       if (classEnum == CIM_OBJECTMANAGERCOMMUNICATIONMECHANISM)
1638                       {
1639                           CIMInstance instance = _buildInstancCIMObjectCommunicationMechanism();
1640                           CIMObjectPath ref = _buildInstancePath(CIMNamespaceName(),
1641 karl  1.1                     CIM_OBJECTMANAGERCOMMUNICATIONMECHANISM_CLASSNAME, instance);
1642                           handler.deliver(ref);
1643                           handler.complete();
1644                           PEG_METHOD_EXIT();
1645                           return;
1646                       }
1647               
1648               
1649                       if (classEnum == CIM_CIMXMLCOMMUNICATIONMECHANISM)
1650                       {
1651                           CIMInstance instance = _buildInstancCIMXMLCommunicationMechanism();
1652                           CIMObjectPath ref = _buildInstancePath(CIMNamespaceName(),
1653                               CIM_CIMXMLCOMMUNICATIONMECHANISM_CLASSNAME, instance);
1654                           handler.deliver(ref);
1655                           handler.complete();
1656                           PEG_METHOD_EXIT();
1657                           return;
1658               
1659                       }
1660                   	
1661                       String userName = _validateUserID(context);
1662 karl  1.1     
1663                       // ATTN: Move this trace
1664                       CIMNamespaceName parentNamespaceName = classReference.getNameSpace();
1665                       PEG_TRACE_STRING(TRC_CONTROLPROVIDER, Tracer::LEVEL4,
1666                          "parentNamespaceName = " + parentNamespaceName.getString());
1667                       CDEBUG("Enumerate Instance Names. ns = " << parentNamespaceName.getString());
1668                       
1669                       // Get list of all namespaces
1670                       Array<CIMNamespaceName> namespaceNames = _enumerateNameSpaces();
1671                       CDEBUG("Found " << namespaceNames.size() << " namespaces.");
1672               
1673                       // Build the cimObjectPath for each namespace found
1674                       for (Uint32 i = 0; i < namespaceNames.size(); i++)
1675                       {
1676                           if (classEnum == CIM_NAMESPACE)
1677                           {
1678                               
1679                               CDEBUG("Calling BuildInstancePath for "<< namespaceNames[i].getString() );
1680                               CIMInstance instance = _buildInstanceCIMNamespace(namespaceNames[i]);
1681                               CIMObjectPath ref = _buildInstancePath(CIMNamespaceName(namespaceNames[i]),
1682                                                           CIM_NAMESPACE_CLASSNAME, instance);
1683 karl  1.1         
1684                               handler.deliver(ref);
1685                   
1686                               PEG_TRACE_STRING(TRC_CONTROLPROVIDER, Tracer::LEVEL4,
1687                                   "namespace = " + namespaceNames[i].getString());
1688                           }
1689                           else
1690                           {
1691                               Array<CIMKeyBinding> keyBindings;
1692                               // Build the __Namespace objectpath
1693                               // Note that for the moment, the only property is name.
1694                               if (_isChild(parentNamespaceName, namespaceNames[i]))
1695                               {
1696                                   keyBindings.clear();
1697                                     keyBindings.append(CIMKeyBinding(NAMESPACE_PROPERTYNAME,
1698                                         namespaceNames[i].getString().subString
1699                                         (parentNamespaceName.getString().size()+1,
1700                                         namespaceNames[i].getString().size()-
1701                                         parentNamespaceName.getString().size()-1),
1702                                         CIMKeyBinding::STRING));
1703                       
1704 karl  1.1                           CIMObjectPath ref(String::EMPTY, parentNamespaceName,
1705                                     __NAMESPACE_CLASSNAME, keyBindings);
1706                       
1707                                     handler.deliver(ref);
1708                                     PEG_TRACE_STRING(TRC_CONTROLPROVIDER, Tracer::LEVEL4,
1709                                         "childNamespace = " + namespaceNames[i].getString());
1710                               }
1711                           }
1712                       }
1713                   
1714                   	handler.complete();
1715                   
1716                       PEG_METHOD_EXIT();
1717                   }
1718               
1719               
1720               //**************************************************************
1721               //**************************************************************
1722               // Association Functions
1723               //**************************************************************
1724               //**************************************************************
1725 karl  1.1     
1726               void InteropProvider::associators(
1727               	const OperationContext & context,
1728               	const CIMObjectPath & objectName,
1729               	const CIMName & associationClass,
1730               	const CIMName & resultClass,
1731               	const String & role,
1732               	const String & resultRole,
1733               	const Boolean includeQualifiers,
1734               	const Boolean includeClassOrigin,
1735               	const CIMPropertyList & propertyList,
1736               	ObjectResponseHandler & handler)
1737               {
1738               	throw CIMNotSupportedException("AssociationProvider::associators");
1739               }
1740               
1741               void InteropProvider::associatorNames(
1742               	const OperationContext & context,
1743               	const CIMObjectPath & objectName,
1744               	const CIMName & associationClass,
1745               	const CIMName & resultClass,
1746 karl  1.1     	const String & role,
1747               	const String & resultRole,
1748               	ObjectPathResponseHandler & handler)
1749               {
1750               	throw CIMNotSupportedException("AssociationProvider::associatorNames");
1751               }
1752               
1753               void InteropProvider::references(
1754               	const OperationContext & context,
1755               	const CIMObjectPath & objectName,
1756               	const CIMName & resultClass,
1757               	const String & role,
1758               	const Boolean includeQualifiers,
1759               	const Boolean includeClassOrigin,
1760               	const CIMPropertyList & propertyList,
1761               	ObjectResponseHandler & handler)
1762               {
1763               	throw CIMNotSupportedException("AssociationProvider::references");
1764               }
1765               
1766               void InteropProvider::referenceNames(
1767 karl  1.1     	const OperationContext & context,
1768               	const CIMObjectPath & objectName,
1769               	const CIMName & resultClass,
1770               	const String & role,
1771               	ObjectPathResponseHandler & handler)
1772               {
1773               	throw CIMNotSupportedException("AssociationProvider::referenceNames");
1774               }
1775               
1776               PEGASUS_NAMESPACE_END
1777               // END_OF_FILE

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2