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

   1 karl  1.245 //%2006////////////////////////////////////////////////////////////////////////
   2 brian.campbell 1.189 //
   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                      // Copyright (c) 2004 BMC Software; Hewlett-Packard Development Company, L.P.;
   8                      // IBM Corp.; EMC Corporation; VERITAS Software Corporation; The Open Group.
   9 karl           1.204 // Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.;
  10                      // EMC Corporation; VERITAS Software Corporation; The Open Group.
  11 karl           1.245 // Copyright (c) 2006 Hewlett-Packard Development Company, L.P.; IBM Corp.;
  12                      // EMC Corporation; Symantec Corporation; The Open Group.
  13 brian.campbell 1.189 //
  14                      // Permission is hereby granted, free of charge, to any person obtaining a copy
  15                      // of this software and associated documentation files (the "Software"), to
  16                      // deal in the Software without restriction, including without limitation the
  17                      // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
  18                      // sell copies of the Software, and to permit persons to whom the Software is
  19                      // furnished to do so, subject to the following conditions:
  20 karl           1.245 // 
  21 brian.campbell 1.189 // THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
  22                      // ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED
  23                      // "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
  24                      // LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
  25                      // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
  26                      // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
  27                      // ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
  28                      // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  29                      //
  30                      //==============================================================================
  31                      //
  32                      //%/////////////////////////////////////////////////////////////////////////////
  33                      
  34                      #include "CIMOperationRequestDispatcher.h"
  35 chip           1.207 
  36 brian.campbell 1.189 #include <Pegasus/Common/Constants.h>
  37                      #include <Pegasus/Common/XmlReader.h> // stringToValue(), stringArrayToValue()
  38 kumpf          1.243 #include <Pegasus/Common/ContentLanguageList.h>
  39 brian.campbell 1.189 #include <Pegasus/Common/StatisticalData.h>
  40 kumpf          1.259 #include <Pegasus/Common/MessageLoader.h>
  41                      #include <Pegasus/Common/AuditLogger.h>
  42 brian.campbell 1.189 #include <Pegasus/Common/Tracer.h>
  43                      #include <Pegasus/Server/reg_table.h>
  44                      
  45                      #include <Pegasus/Server/QuerySupportRouter.h>
  46                      
  47                      PEGASUS_NAMESPACE_BEGIN
  48                      
  49 kumpf          1.263 //PEGASUS_USING_STD;
  50                      //#define CDEBUG(X) cout << "CIMOpReqDsptchr " << X << endl
  51 brian.campbell 1.189 #define CDEBUG(X)
  52                      
  53 kumpf          1.262 // Test tool to limit enumerations to a single level.  This is not
  54                      // production and is used only to debug special problems in the requests
  55                      // that issue multiple provider operations.
  56 brian.campbell 1.189 //#define LIMIT_ENUM_TO_ONE_LEVEL
  57                      
  58                      static DynamicRoutingTable _routing_table;
  59                      
  60 kumpf          1.262 // Variable to control whether we do search or simply single provider for
  61                      // reference and associatior lookups.
  62 brian.campbell 1.189 // ATTN: KS 5 April 2003 This is to be removed ATTN:
  63                      // static bool singleProviderType = true;
  64                      
  65 kumpf          1.262 // Local save for host name. save host name here.  NOTE: Problem if hostname
  66                      // changes.
  67 brian.campbell 1.189 // Set by object init. Used by aggregator.
  68                      String cimAggregationLocalHost;
  69                      
  70 a.dunfey       1.231 // A helper function that resets the Propagated and ClassOrigin attributes on
  71                      // properties of CIMInstance and CIMClass objects. This is used during
  72                      // Create/Modify Instance and Create/Modify Class operations, where the
  73                      // Propagated and ClassOrigin attributes must be ignored.
  74                      template <class ObjectClass>
  75 kumpf          1.262 void removePropagatedAndOriginAttributes(ObjectClass& newObject);
  76 a.dunfey       1.231 
  77 brian.campbell 1.189 // static counter for aggretation serial numbers.
  78                      // can be used to determine lost aggregations.
  79 kumpf          1.262 Uint64 CIMOperationRequestDispatcher::cimOperationAggregationSN = 0;
  80 brian.campbell 1.189 
  81 chip           1.207 OperationAggregate::OperationAggregate(
  82                          CIMRequestMessage* request,
  83                          Uint32 msgRequestType,
  84                          String messageId,
  85                          Uint32 dest,
  86                          CIMName className,
  87                          CIMNamespaceName nameSpace,
  88 kumpf          1.262     QueryExpressionRep* query,
  89 chip           1.207     String queryLanguage)
  90 kumpf          1.262     : _messageId(messageId),
  91                            _msgRequestType(msgRequestType),
  92                            _dest(dest),
  93                            _nameSpace(nameSpace),
  94                            _className(className),
  95                            _query(query),
  96                            _queryLanguage(queryLanguage),
  97                            _request(request)
  98 kumpf          1.226 {
  99                          _totalIssued = 0;
 100                          _totalReceived = 0;
 101                          _totalReceivedComplete = 0;
 102                          _totalReceivedExpected = 0;
 103                          _totalReceivedErrors = 0;
 104 a.dunfey       1.234     _totalReceivedNotSupported = 0;
 105 kumpf          1.226     _magicNumber = 12345;
 106                          _aggregationSN = 0;
 107 brian.campbell 1.189 }
 108                      
 109                      OperationAggregate::~OperationAggregate()
 110                      {
 111 kumpf          1.226     _magicNumber = 0;
 112 kumpf          1.248     delete _request;
 113                          delete _query;
 114 brian.campbell 1.189 }
 115                      
 116                      Boolean OperationAggregate::valid() const
 117                      {
 118 kumpf          1.262     return (_magicNumber == 12345) ? true : false;
 119 brian.campbell 1.189 }
 120                      
 121                      void OperationAggregate::setTotalIssued(Uint32 i)
 122                      {
 123 kumpf          1.226     _totalIssued = i;
 124 brian.campbell 1.189 }
 125                      
 126                      Boolean OperationAggregate::appendResponse(CIMResponseMessage* response)
 127                      {
 128 kumpf          1.226     AutoMutex autoMut(_appendResponseMutex);
 129                          _responseList.append(response);
 130                          Boolean returnValue = (_totalIssued == numberResponses());
 131                          return returnValue;
 132 brian.campbell 1.189 }
 133                      
 134                      Uint32 OperationAggregate::numberResponses() const
 135                      {
 136 kumpf          1.226     //AutoMutex autoMut(_appendResponseMutex);
 137                          Uint32 size =  _responseList.size();
 138                          return size;
 139 brian.campbell 1.189 }
 140                      
 141                      CIMRequestMessage* OperationAggregate::getRequest()
 142                      {
 143 kumpf          1.262     return _request;
 144 brian.campbell 1.189 }
 145                      
 146                      CIMResponseMessage* OperationAggregate::getResponse(const Uint32& pos)
 147                      {
 148 kumpf          1.226     AutoMutex autoMut(_appendResponseMutex);
 149 kumpf          1.262     CIMResponseMessage* tmp = _responseList[pos];
 150 kumpf          1.226     return tmp;
 151 brian.campbell 1.189 }
 152                      
 153                      CIMResponseMessage* OperationAggregate::removeResponse(const Uint32& pos)
 154                      {
 155 kumpf          1.226     AutoMutex autoMut(_appendResponseMutex);
 156                          CIMResponseMessage* tmp = _responseList[pos];
 157                          _responseList.remove(pos);
 158                          return tmp;
 159 brian.campbell 1.189 }
 160                      
 161                      void OperationAggregate::deleteResponse(const Uint32&pos)
 162                      {
 163 kumpf          1.226     AutoMutex autoMut(_appendResponseMutex);
 164                          delete _responseList[pos];
 165                          _responseList.remove(pos);
 166 brian.campbell 1.189 }
 167                      
 168                      Uint32 OperationAggregate::getRequestType() const
 169 r.kieninger    1.197 {
 170 kumpf          1.226     return _msgRequestType;
 171 brian.campbell 1.189 }
 172                      
 173                      
 174                      // There are many response pieces (chunks) from potentially many
 175 r.kieninger    1.197 // threads funneling through this function in random order. This isolates a
 176 brian.campbell 1.189 // single response (by locking) from a given thread and "resequences" the
 177                      // response as part of one large response. It is crucial that the first
 178                      // response to come through here be sequenced (or indexed) as 0 and the last
 179                      // response from the last thread be marked as "isComplete"
 180                      
 181                      // NOTE: for now this assumes no chunks can come AFTER a "isComplete" message
 182                      // of the LAST thread.
 183                      
 184                      void OperationAggregate::resequenceResponse(CIMResponseMessage& response)
 185                      {
 186 kumpf          1.266     static const char* func = "OperationAggregate::resequenceResponse";
 187 kumpf          1.226     CIMStatusCode error = response.cimException.getCode();
 188 a.dunfey       1.234     bool notSupportedReceived = false;
 189 kumpf          1.226     if (error != CIM_ERR_SUCCESS)
 190                          {
 191 kumpf          1.262         if (error == CIM_ERR_NOT_SUPPORTED)
 192 a.dunfey       1.234         {
 193                                  notSupportedReceived = true;
 194                                  _totalReceivedNotSupported++;
 195                              }
 196 kumpf          1.226         _totalReceivedErrors++;
 197 chip           1.241         PEG_LOGGER_TRACE((Logger::STANDARD_LOG, System::CIMSERVER,
 198 kumpf          1.262             Logger::TRACE,
 199 kumpf          1.266             "$0: Response has error.  Namespace: $1, Class name: $2, "
 200                                      "Response Sequence: $3",
 201                                  func,
 202 kumpf          1.226             _nameSpace.getString(),
 203                                  _className.getString(),
 204 mike           1.240             _totalReceived));
 205 kumpf          1.226     }
 206                      
 207                          Boolean isComplete = response.isComplete();
 208                      
 209                          if (isComplete == true)
 210                          {
 211                              _totalReceivedComplete++;
 212                              _totalReceivedExpected += response.getIndex() + 1;
 213                          }
 214                      
 215                          response.setIndex(_totalReceived++);
 216                      
 217                          // set to incomplete until ALL completed messages have come in
 218 brian.campbell 1.189 
 219 kumpf          1.226     isComplete = false;
 220 brian.campbell 1.189 
 221 kumpf          1.226     // NOTE:
 222                          // _totalReceivedExpected is calculated by adding up every response index
 223                          // count WHEN the message is marked complete. This may differ from the
 224                          // following reasons:
 225                          // 1. An exception occurred in which the correct index could not be set.
 226                          // 2. Somehow the completed response arrived before the other
 227                          //    (non-completed) responses ? (shouldnt happen with the current
 228                          //    synchronous code).
 229                          // In either case, a message will be logged and attempt to continue
 230                      
 231                          if (_totalReceivedComplete == _totalIssued)
 232                          {
 233                              if (_totalReceivedExpected == _totalReceived)
 234                              {
 235 kumpf          1.266             PEG_TRACE((TRC_DISPATCHER, Tracer::LEVEL4,
 236                                      "%s: Message is complete.  Total responses: %u, "
 237                                          "total chunks: %u, total errors: %u",
 238                                      func,
 239                                      _totalReceivedComplete,
 240                                      _totalReceived,
 241                                      _totalReceivedErrors));
 242 kumpf          1.226         }
 243                              else
 244                              {
 245 mike           1.240             PEG_LOGGER_TRACE((
 246 kumpf          1.236                 Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE,
 247 kumpf          1.266                 "$0: All completed responses ($1) for current request "
 248                                          "have been accounted for but expected count ($2) does "
 249                                          "not match the received count ($3). error count ($4).  "
 250 kumpf          1.236                     "Attempting to continue ...",
 251 kumpf          1.266                 func,
 252 kumpf          1.236                 _totalReceivedComplete,
 253                                      _totalReceivedExpected,
 254                                      _totalReceived,
 255 mike           1.240                 _totalReceivedErrors));
 256 marek          1.264             PEG_TRACE((
 257 kumpf          1.236                 __FILE__, __LINE__, TRC_DISCARDED_DATA, Tracer::LEVEL2,
 258                                      "All completed responses (%u) for current request "
 259                                          "have been accounted for but expected count (%u) does "
 260                                          "not match the received count (%u). error count (%u).",
 261 kumpf          1.226                 _totalReceivedComplete,
 262                                      _totalReceivedExpected,
 263                                      _totalReceived,
 264 marek          1.264                 _totalReceivedErrors));
 265 kumpf          1.226         }
 266                      
 267 a.dunfey       1.234         // If all of the errors received were NOT_SUPPORTED and
 268                              // all of the responses were errors, then keep the last
 269                              // NOT_SUPPORTED error.
 270                              // The condition below is the oposite of that. If there was an error
 271                              // besides NOT_SUPPORTED, or a non-error response was received, and
 272                              // the last response was a NOT_SUPPORTED error, then clear the error
 273 kumpf          1.262         if ((_totalReceivedErrors != _totalReceivedNotSupported ||
 274                                       _totalReceivedErrors != _totalReceived) &&
 275                                  notSupportedReceived)
 276 a.dunfey       1.234         {
 277 kumpf          1.262             response.cimException = CIMException();
 278 a.dunfey       1.234         }
 279                      
 280 kumpf          1.226         isComplete = true;
 281                              _totalReceivedComplete = 0;
 282                              _totalReceivedExpected = 0;
 283                              _totalReceivedErrors = 0;
 284 a.dunfey       1.234         _totalReceivedNotSupported = 0;
 285 kumpf          1.226         _totalReceived = 0;
 286                          }
 287 kumpf          1.262     else if (notSupportedReceived)
 288 a.dunfey       1.234     {
 289 kumpf          1.262         // Clear the NOT_SUPPORTED exception
 290                              // We ignore it unless it's the only response received
 291 a.dunfey       1.234         response.cimException = CIMException();
 292                          }
 293 kumpf          1.226 
 294                          response.setComplete(isComplete);
 295 brian.campbell 1.189 }
 296                      
 297                      CIMOperationRequestDispatcher::CIMOperationRequestDispatcher(
 298                          CIMRepository* repository,
 299                          ProviderRegistrationManager* providerRegistrationManager)
 300 kumpf          1.262     : Base(PEGASUS_QUEUENAME_OPREQDISPATCHER),
 301 brian.campbell 1.189       _repository(repository),
 302 chip           1.202       _providerRegistrationManager(providerRegistrationManager)
 303 brian.campbell 1.189 {
 304 kumpf          1.262     PEG_METHOD_ENTER(TRC_DISPATCHER,
 305                              "CIMOperationRequestDispatcher::CIMOperationRequestDispatcher");
 306 brian.campbell 1.189 
 307 kumpf          1.262     //
 308                          // Check whether AssociationTraversal is supported.
 309                          //
 310                          ConfigManager* configManager = ConfigManager::getInstance();
 311 chip           1.207 
 312 kumpf          1.262     _enableAssociationTraversal = ConfigManager::parseBooleanValue(
 313 kumpf          1.255         configManager->getCurrentValue("enableAssociationTraversal"));
 314 brian.campbell 1.189 
 315 kumpf          1.262     _enableIndicationService = ConfigManager::parseBooleanValue(
 316 kumpf          1.255         configManager->getCurrentValue("enableIndicationService"));
 317 brian.campbell 1.189 
 318 kumpf          1.262     //
 319                          //  Get the maximum breadth of enum parameter from config if it exists.
 320                          //
 321                          // ATTN: KS 20030602 Bypass param acquistion until we get it into the
 322                          // config manager
 323                          // Config param removed for Pegasus 2.2 and until PEP 66 resolved.
 324                          // In place, we simply allow anything through by setting the breadth too
 325                          // large number.
 326 brian.campbell 1.189 // #define  MAXENUMBREADTHTESTENABLED
 327                      #ifdef MAXENUMBREADTHTESTENABLED
 328 kumpf          1.262     String maxEnumBreadthOption;
 329                          try
 330                          {
 331                              maxEnumBreadthOption =
 332                                  configManager->getCurrentValue("maximumEnumerationBreadth");
 333                              if (maxEnumBreadthOption != String::EMPTY)
 334                                  _maximumEnumerateBreadth =
 335                                      atol(maxEnumBreadthOption.getCString());
 336                          }
 337                          catch (...)
 338                          {
 339                              _maximumEnumerateBreadth = 50;
 340                          }
 341 brian.campbell 1.189 #else
 342 kumpf          1.262     // As part of disabling the test for now, we set to very large number.
 343                          _maximumEnumerateBreadth = 1000;
 344 brian.campbell 1.189 #endif
 345                      
 346 kumpf          1.226 #ifdef PEGASUS_ENABLE_OBJECT_NORMALIZATION
 347 kumpf          1.262     _enableNormalization = ConfigManager::parseBooleanValue(
 348                              configManager->getCurrentValue("enableNormalization"));
 349 chip           1.207 
 350 kumpf          1.262     if (_enableNormalization)
 351                          {
 352                              String moduleList =
 353                                  configManager->getCurrentValue("excludeModulesFromNormalization");
 354 chip           1.216 
 355 kumpf          1.262         for (Uint32 pos = moduleList.find(','); moduleList.size() != 0;
 356                                   pos = moduleList.find(','))
 357                              {
 358                                  String moduleName = moduleList.subString(0, pos);
 359 chip           1.216 
 360 kumpf          1.262             _excludeModulesFromNormalization.append(moduleName);
 361 chip           1.216 
 362 kumpf          1.262             moduleList.remove(0, (pos == PEG_NOT_FOUND ? pos : pos + 1));
 363                              }
 364                          }
 365 kumpf          1.226 #endif
 366 chip           1.207 
 367 kumpf          1.262     _routing_table = DynamicRoutingTable::get_rw_routing_table();
 368 brian.campbell 1.189 
 369 kumpf          1.262     cimAggregationLocalHost = System::getHostName();
 370 brian.campbell 1.189 
 371 kumpf          1.262     PEG_METHOD_EXIT();
 372 brian.campbell 1.189 }
 373                      
 374 kumpf          1.262 CIMOperationRequestDispatcher::~CIMOperationRequestDispatcher()
 375 brian.campbell 1.189 {
 376 kumpf          1.262     PEG_METHOD_ENTER(TRC_DISPATCHER,
 377                              "CIMOperationRequestDispatcher::~CIMOperationRequestDispatcher");
 378                          PEG_METHOD_EXIT();
 379 brian.campbell 1.189 }
 380                      
 381 kumpf          1.259 void CIMOperationRequestDispatcher::_getProviderName(
 382                          const OperationContext& context,
 383                          String& moduleName,
 384                          String& providerName)
 385                      {
 386                          moduleName.clear();
 387                          providerName.clear();
 388                      
 389                          if (context.contains(ProviderIdContainer::NAME))
 390                          {
 391                              const ProviderIdContainer pidc =
 392                                  (const ProviderIdContainer) context.get(ProviderIdContainer::NAME);
 393                      
 394                              CIMConstInstance module = pidc.getModule();
 395                              Uint32 pos = module.findProperty(_PROPERTY_PROVIDERMODULE_NAME);
 396                              if (pos != PEG_NOT_FOUND)
 397                              {
 398                                  module.getProperty(pos).getValue().get(moduleName);
 399                              }
 400                      
 401                              CIMConstInstance provider = pidc.getProvider();
 402 kumpf          1.259         pos = provider.findProperty("Name");
 403                              if (pos != PEG_NOT_FOUND)
 404                              {
 405                                  provider.getProperty(pos).getValue().get(providerName);
 406                              }
 407                          }
 408                      }
 409                      
 410                      void CIMOperationRequestDispatcher::_logOperation(
 411                          const CIMRequestMessage* request,
 412                          const CIMResponseMessage* response)
 413                      {
 414                      #ifndef PEGASUS_DISABLE_AUDIT_LOGGER
 415                      
 416                          PEG_METHOD_ENTER(TRC_DISPATCHER,
 417                              "CIMOperationRequestDispatcher::_logOperation");
 418                      
 419                          String moduleName;
 420                          String providerName;
 421                      
 422                          if (AuditLogger::isEnabled())
 423 kumpf          1.259     {
 424                              switch (request->getType())
 425                              {
 426                                  case CIM_CREATE_CLASS_REQUEST_MESSAGE:
 427                                  {
 428                                      const CIMCreateClassRequestMessage* req =
 429                                          reinterpret_cast<const CIMCreateClassRequestMessage*>(
 430                                              request);
 431                                      AuditLogger::logUpdateClassOperation(
 432                                          "CreateClass",
 433                                          AuditLogger::EVENT_CREATE,
 434                                          req->userName,
 435 kumpf          1.262                     req->ipAddress,
 436 kumpf          1.259                     req->nameSpace,
 437                                          req->className,
 438                                          response->cimException.getCode());
 439                                      break;
 440                                  }
 441                      
 442                                  case CIM_MODIFY_CLASS_REQUEST_MESSAGE:
 443                                  {
 444                                      const CIMModifyClassRequestMessage* req =
 445                                          reinterpret_cast<const CIMModifyClassRequestMessage*>(
 446                                              request);
 447                                      AuditLogger::logUpdateClassOperation(
 448                                          "ModifyClass",
 449                                          AuditLogger::EVENT_UPDATE,
 450                                          req->userName,
 451 kumpf          1.262                     req->ipAddress,
 452 kumpf          1.259                     req->nameSpace,
 453                                          req->className,
 454                                          response->cimException.getCode());
 455                                      break;
 456                                  }
 457                      
 458                                  case CIM_DELETE_CLASS_REQUEST_MESSAGE:
 459                                  {
 460                                      const CIMDeleteClassRequestMessage* req =
 461                                          reinterpret_cast<const CIMDeleteClassRequestMessage*>(
 462                                              request);
 463                                      AuditLogger::logUpdateClassOperation(
 464                                          "DeleteClass",
 465                                          AuditLogger::EVENT_DELETE,
 466                                          req->userName,
 467 kumpf          1.262                     req->ipAddress,
 468 kumpf          1.259                     req->nameSpace,
 469                                          req->className,
 470                                          response->cimException.getCode());
 471                                      break;
 472                                  }
 473                      
 474                                  case CIM_SET_QUALIFIER_REQUEST_MESSAGE:
 475                                  {
 476                                      const CIMSetQualifierRequestMessage* req =
 477                                          reinterpret_cast<const CIMSetQualifierRequestMessage*>(
 478                                              request);
 479                                      AuditLogger::logUpdateQualifierOperation(
 480                                          "SetQualifier",
 481                                          AuditLogger::EVENT_UPDATE,
 482                                          req->userName,
 483 kumpf          1.262                     req->ipAddress,
 484 kumpf          1.259                     req->nameSpace,
 485                                          req->qualifierDeclaration.getName(),
 486                                          response->cimException.getCode());
 487                                      break;
 488                                  }
 489                      
 490                                  case CIM_DELETE_QUALIFIER_REQUEST_MESSAGE:
 491                                  {
 492                                      const CIMDeleteQualifierRequestMessage* req =
 493                                          reinterpret_cast<const CIMDeleteQualifierRequestMessage*>(
 494                                              request);
 495                                      AuditLogger::logUpdateQualifierOperation(
 496                                          "DeleteQualifier",
 497                                          AuditLogger::EVENT_DELETE,
 498                                          req->userName,
 499 kumpf          1.262                     req->ipAddress,
 500 kumpf          1.259                     req->nameSpace,
 501                                          req->qualifierName,
 502                                          response->cimException.getCode());
 503                                      break;
 504                                  }
 505                      
 506                                  case CIM_CREATE_INSTANCE_REQUEST_MESSAGE:
 507                                  {
 508                                      const CIMCreateInstanceRequestMessage* req =
 509                                          reinterpret_cast<const CIMCreateInstanceRequestMessage*>(
 510                                              request);
 511                      
 512 kumpf          1.260                 const CIMCreateInstanceResponseMessage* resp =
 513                                          reinterpret_cast<const CIMCreateInstanceResponseMessage*>(
 514                                              response);
 515                      
 516 kumpf          1.259                 _getProviderName(
 517                                          req->operationContext, moduleName, providerName);
 518                      
 519                                      AuditLogger::logUpdateInstanceOperation(
 520                                          "CreateInstance",
 521                                          AuditLogger::EVENT_CREATE,
 522                                          req->userName,
 523 kumpf          1.262                     req->ipAddress,
 524 kumpf          1.259                     req->nameSpace,
 525 kumpf          1.260                     (response->cimException.getCode() == CIM_ERR_SUCCESS) ?
 526                                              resp->instanceName :
 527                                              CIMObjectPath(req->className.getString()),
 528 kumpf          1.259                     moduleName,
 529                                          providerName,
 530                                          response->cimException.getCode());
 531                                      break;
 532                                  }
 533                      
 534                                  case CIM_MODIFY_INSTANCE_REQUEST_MESSAGE:
 535                                  {
 536                                      const CIMModifyInstanceRequestMessage* req =
 537                                          reinterpret_cast<const CIMModifyInstanceRequestMessage*>(
 538                                              request);
 539                      
 540                                      _getProviderName(
 541                                          req->operationContext, moduleName, providerName);
 542                      
 543                                      AuditLogger::logUpdateInstanceOperation(
 544                                          "ModifyInstance",
 545                                          AuditLogger::EVENT_UPDATE,
 546                                          req->userName,
 547 kumpf          1.262                     req->ipAddress,
 548 kumpf          1.259                     req->nameSpace,
 549 kumpf          1.260                     req->modifiedInstance.getPath(),
 550 kumpf          1.259                     moduleName,
 551                                          providerName,
 552                                          response->cimException.getCode());
 553                                      break;
 554                                  }
 555                      
 556                                  case CIM_DELETE_INSTANCE_REQUEST_MESSAGE:
 557                                  {
 558                                      const CIMDeleteInstanceRequestMessage* req =
 559                                          reinterpret_cast<const CIMDeleteInstanceRequestMessage*>(
 560                                              request);
 561                      
 562                                      _getProviderName(
 563                                          req->operationContext, moduleName, providerName);
 564                      
 565                                      AuditLogger::logUpdateInstanceOperation(
 566                                          "DeleteInstance",
 567                                          AuditLogger::EVENT_DELETE,
 568                                          req->userName,
 569 kumpf          1.262                     req->ipAddress,
 570 kumpf          1.259                     req->nameSpace,
 571 kumpf          1.260                     req->instanceName,
 572 kumpf          1.259                     moduleName,
 573                                          providerName,
 574                                          response->cimException.getCode());
 575                                      break;
 576                                  }
 577                      
 578                                  case CIM_SET_PROPERTY_REQUEST_MESSAGE:
 579                                  {
 580                                      const CIMSetPropertyRequestMessage* req =
 581                                          reinterpret_cast<const CIMSetPropertyRequestMessage*>(
 582                                              request);
 583                      
 584                                      _getProviderName(
 585                                          req->operationContext, moduleName, providerName);
 586                      
 587                                      AuditLogger::logUpdateInstanceOperation(
 588                                          "SetProperty",
 589                                          AuditLogger::EVENT_UPDATE,
 590                                          req->userName,
 591 kumpf          1.262                     req->ipAddress,
 592 kumpf          1.259                     req->nameSpace,
 593 kumpf          1.260                     req->instanceName,
 594 kumpf          1.259                     moduleName,
 595                                          providerName,
 596                                          response->cimException.getCode());
 597                                      break;
 598                                  }
 599                      
 600                                  case CIM_INVOKE_METHOD_REQUEST_MESSAGE:
 601                                  {
 602                                      const CIMInvokeMethodRequestMessage* req =
 603                                          reinterpret_cast<const CIMInvokeMethodRequestMessage*>(
 604                                              request);
 605                      
 606                                      _getProviderName(
 607                                          req->operationContext, moduleName, providerName);
 608                      
 609                                      AuditLogger::logInvokeMethodOperation(
 610                                          req->userName,
 611 kumpf          1.262                     req->ipAddress,
 612 kumpf          1.259                     req->nameSpace,
 613 kumpf          1.260                     req->instanceName,
 614 kumpf          1.259                     req->methodName,
 615                                          moduleName,
 616                                          providerName,
 617                                          response->cimException.getCode());
 618                                      break;
 619                                  }
 620                      
 621                                  default:
 622                                      // Other operations are not logged.
 623                                      break;
 624                              }
 625                          }
 626                      
 627                          PEG_METHOD_EXIT();
 628                      
 629                      #endif
 630                      }
 631                      
 632 brian.campbell 1.189 /*
 633 kumpf          1.262     send the given response synchronously using the given aggregation object.
 634                          return whether the sent message was complete or not. The parameters are
 635                          pointer references because they can be come invalid from external deletes
 636                          if the message is complete after queueing. They can be zeroed in this
 637                          function preventing the caller from referencing deleted pointers.
 638                      */
 639                      Boolean CIMOperationRequestDispatcher::_enqueueResponse(
 640                          OperationAggregate*& poA,
 641                          CIMResponseMessage*& response)
 642 brian.campbell 1.189 {
 643 kumpf          1.262     static const char func[] =
 644                              "CIMOperationRequestDispatcher::_enqueueResponse";
 645 dave.sudlik    1.249     // Obtain the _enqueueResponseMutex mutex for this chunked request.
 646                          // This mutex is used to serialize chunked responses from all incoming
 647                          // provider threads. It is imperative that the sequencing done by the
 648                          // resequenceResponse() method and the writing of the chunked response
 649                          // to the connection socket (done as a synchronous enqueue at the end
 650                          // of this method) are atomic to ensure that the chunk that is marked
 651                          // as isComplete for the overall response is indeed the last chunk
 652                          // returned to the client. See PEP 140 for details.
 653                          // This mutex was moved into the OperationAggregate class as part of
 654                          // bug 5157 because we only need to serialize on a per-request basis.
 655                          // This prevents serializing independent requests on separate connections.
 656                          AutoMutex autoMut(poA->_enqueueResponseMutex);
 657 kumpf          1.226     Boolean isComplete = false;
 658                      
 659                          try
 660                          {
 661                              // get the completion status of the incoming response on this thread.
 662                              isComplete = response->isComplete();
 663                      
 664 brian.campbell 1.225         poA->appendResponse(response);
 665 kumpf          1.226         Uint32 type = poA->getRequestType();
 666                      
 667 kumpf          1.262         // there should never be more than one object in the list for async
 668                              // queues these functions are called for their jobs other than
 669                              // aggregating.
 670 kumpf          1.226 
 671                              switch(type)
 672                              {
 673                                  case CIM_ENUMERATE_INSTANCE_NAMES_REQUEST_MESSAGE :
 674                                      handleEnumerateInstanceNamesResponseAggregation(poA);
 675                                      break;
 676                      
 677                                  case CIM_ENUMERATE_INSTANCES_REQUEST_MESSAGE :
 678                                      handleEnumerateInstancesResponseAggregation(poA);
 679                                      break;
 680 brian.campbell 1.189 
 681 kumpf          1.226             case CIM_ASSOCIATORS_REQUEST_MESSAGE :
 682                                      handleAssociatorsResponseAggregation(poA);
 683                                      break;
 684                      
 685                                  case CIM_ASSOCIATOR_NAMES_REQUEST_MESSAGE :
 686                                      handleAssociatorNamesResponseAggregation(poA);
 687                                      break;
 688                      
 689                                  case CIM_REFERENCES_REQUEST_MESSAGE :
 690                                      handleReferencesResponseAggregation(poA);
 691                                      break;
 692                      
 693                                  case CIM_REFERENCE_NAMES_REQUEST_MESSAGE :
 694                                      handleReferenceNamesResponseAggregation(poA);
 695                                      break;
 696                      
 697                                  case CIM_EXEC_QUERY_REQUEST_MESSAGE :
 698                                      handleExecQueryResponseAggregation(poA);
 699                                      break;
 700                      
 701 kumpf          1.262             default:
 702                                      static const char failMsg[] =
 703                                          "Invalid response type to aggregate: ";
 704 kumpf          1.226                 char typeP[11];
 705                                      sprintf(typeP,"%u", type);
 706 chip           1.241                 PEG_LOGGER_TRACE((Logger::STANDARD_LOG, System::CIMSERVER,
 707 kumpf          1.262                     Logger::TRACE,
 708 mike           1.240                     String(func) + String(failMsg) + String(typeP)));
 709 kumpf          1.226                 PEGASUS_ASSERT(0);
 710                                      break;
 711                              } // switch
 712 brian.campbell 1.189 
 713 kumpf          1.262         // now take the aggregated response. This is now the one we will
 714                              // work with
 715 kumpf          1.226         response = poA->removeResponse(Uint32(0));
 716 brian.campbell 1.189 
 717 kumpf          1.226         // reset the completion flag of the last response added to the list.
 718                              // This only makes a difference when there was at least two on the list
 719                              // to begin with before aggregation methods (above) were called.
 720                              // Typically, there will be more than two on the list when a non-async
 721                              // destination queue keeps appending the responses until the completion
 722                              // of all threads/responses has occurred.
 723                      
 724                              response->setComplete(isComplete);
 725                      
 726                              Uint32 dest = poA->_dest;
 727                              response->dest = dest;
 728                              poA->resequenceResponse(*response);
 729                      
 730                              // now get the completion status of the response after it has been
 731                              // resequenced. This will reset the completion status of the entire
 732                              // message, not just this one thread coming through here.
 733                      
 734                              isComplete = response->isComplete();
 735                      
 736                              // can the destination service queue handle async responses ?
 737                              // (i.e multiple responses from one request). Certain known ones
 738 kumpf          1.226         // cannot handle it. Most notably, the internal client.
 739                      
 740 kumpf          1.262         MessageQueue* q = lookup(dest);
 741                              const char* name = q ? q->getQueueName() : 0;
 742                              Boolean isDestinationQueueAsync = !(name &&
 743 kumpf          1.226             (strcmp(name, PEGASUS_QUEUENAME_BINARY_HANDLER) == 0 ||
 744 kumpf          1.262              strcmp(name, PEGASUS_QUEUENAME_INTERNALCLIENT) == 0));
 745 kumpf          1.226 
 746                              // for non-async queues, we'll just keep appending until all responses
 747                              // have come in
 748                      
 749                              if (isDestinationQueueAsync == false)
 750                              {
 751                                  if (isComplete == false)
 752                                  {
 753                                      poA->appendResponse(response);
 754                                      return isComplete;
 755                                  }
 756 r.kieninger    1.197 
 757 kumpf          1.226             // need to reset the first response to complete if the
 758                                  // last one that came in was complete
 759 r.kieninger    1.197 
 760 kumpf          1.226             response->setComplete(true);
 761                                  response->setIndex(0);
 762                              }
 763                      
 764 kumpf          1.259         if (isComplete)
 765                              {
 766                                  _logOperation(poA->getRequest(), response);
 767                              }
 768                      
 769 kumpf          1.226         // send it syncronously so that multiple responses will show up in the
 770                              // receiving queue according to the order that we have set the response
 771                              // index. If this was a single complete response, we could in theory
 772                              // send it async (i.e SendForget), however, there is no need to make a
 773                              // condition point based off this.
 774                      
 775                              if (q)
 776                                  q->enqueue(response);
 777                              else throw UninitializedObjectException();
 778 kumpf          1.262     }
 779                          catch (...)
 780 kumpf          1.226     {
 781                              static const char failMsg[] =
 782                                  "Failed to resequence/aggregate/forward response";
 783 chip           1.241         PEG_LOGGER_TRACE((Logger::STANDARD_LOG, System::CIMSERVER,
 784 kumpf          1.262             Logger::TRACE, String(func) + String(failMsg)));
 785 kumpf          1.226 
 786                              if (response->cimException.getCode() != CIM_ERR_SUCCESS)
 787                                  response->cimException =
 788                                      CIMException(CIM_ERR_FAILED, String(failMsg));
 789                          }
 790                      
 791                          // after sending, the response has been deleted externally
 792                          response = 0;
 793                      
 794                          return isComplete;
 795 brian.campbell 1.189 }
 796                      
 797 kumpf          1.262 void CIMOperationRequestDispatcher::_handle_async_request(AsyncRequest* req)
 798 brian.campbell 1.189 {
 799 kumpf          1.226     PEG_METHOD_ENTER(TRC_DISPATCHER,
 800                              "CIMOperationRequestDispatcher::_handle_async_request");
 801 brian.campbell 1.189 
 802 kumpf          1.226     // pass legacy operations to handleEnqueue
 803 kumpf          1.262     if (req->getType() == async_messages::ASYNC_LEGACY_OP_START)
 804 kumpf          1.226     {
 805 kumpf          1.262         req->op->processing();
 806 brian.campbell 1.189 
 807 kumpf          1.262         Message* message =
 808                                  static_cast<AsyncLegacyOperationStart*>(req)->get_action();
 809 brian.campbell 1.189 
 810 kumpf          1.262         handleEnqueue(message);
 811 brian.campbell 1.189 
 812 kumpf          1.262         PEG_METHOD_EXIT();
 813                              return;
 814 kumpf          1.226     }
 815 brian.campbell 1.189 
 816 kumpf          1.226     // pass all other operations to the default handler
 817                          Base::_handle_async_request(req);
 818                          PEG_METHOD_EXIT();
 819 brian.campbell 1.189 }
 820                      
 821                      Boolean CIMOperationRequestDispatcher::_lookupInternalProvider(
 822 kumpf          1.262     const CIMNamespaceName& nameSpace,
 823                          const CIMName& className,
 824                          String& service,
 825                          String& provider)
 826 brian.campbell 1.189 {
 827 kumpf          1.262     static AtomicInt _initialized(0);
 828                          static Mutex _monitor;
 829 brian.campbell 1.189 
 830 kumpf          1.262     PEG_METHOD_ENTER(TRC_DISPATCHER,
 831                              "CIMOperationRequestDispatcher::_lookupInternalProvider");
 832                          // Clear the strings since used as test later. Poor code but true now
 833 brian.campbell 1.189 
 834 kumpf          1.262     service = String::EMPTY;
 835                          provider = String::EMPTY;
 836                          CIMNamespaceName _wild;
 837                          if (_initialized.get() == 0)
 838                          {
 839                              AutoMutex autoMut(_monitor);
 840                              if (_initialized.get() == 0)
 841                              {
 842                                  _routing_table.insert_record(
 843                                      PEGASUS_CLASSNAME_CONFIGSETTING,
 844                                      PEGASUS_NAMESPACENAME_CONFIG,
 845                                      DynamicRoutingTable::INTERNAL,
 846                                      0,
 847                                      static_cast<MessageQueueService*>(
 848                                          MessageQueue::lookup(PEGASUS_QUEUENAME_CONTROLSERVICE)),
 849                                      PEGASUS_MODULENAME_CONFIGPROVIDER,
 850                                      PEGASUS_QUEUENAME_CONTROLSERVICE);
 851                      
 852                                  _routing_table.insert_record(
 853                                      PEGASUS_CLASSNAME_AUTHORIZATION,
 854                                      PEGASUS_NAMESPACENAME_AUTHORIZATION,
 855 kumpf          1.262                 DynamicRoutingTable::INTERNAL,
 856                                      0,
 857                                      static_cast<MessageQueueService*>(
 858                                          MessageQueue::lookup(PEGASUS_QUEUENAME_CONTROLSERVICE)),
 859                                      PEGASUS_MODULENAME_USERAUTHPROVIDER,
 860                                      PEGASUS_QUEUENAME_CONTROLSERVICE);
 861                      
 862                                  _routing_table.insert_record(
 863                                      PEGASUS_CLASSNAME_USER,
 864                                      PEGASUS_NAMESPACENAME_USER,
 865                                      DynamicRoutingTable::INTERNAL,
 866                                      0,
 867                                      static_cast<MessageQueueService*>(
 868                                          MessageQueue::lookup(PEGASUS_QUEUENAME_CONTROLSERVICE)),
 869                                      PEGASUS_MODULENAME_USERAUTHPROVIDER,
 870                                      PEGASUS_QUEUENAME_CONTROLSERVICE);
 871                      
 872                                  _routing_table.insert_record(
 873                                      PEGASUS_CLASSNAME_SHUTDOWN,
 874                                      PEGASUS_NAMESPACENAME_SHUTDOWN,
 875                                      DynamicRoutingTable::INTERNAL,
 876 kumpf          1.262                 0,
 877                                      static_cast<MessageQueueService*>(
 878                                          MessageQueue::lookup(PEGASUS_QUEUENAME_CONTROLSERVICE)),
 879                                      PEGASUS_MODULENAME_SHUTDOWNPROVIDER,
 880                                      PEGASUS_QUEUENAME_CONTROLSERVICE);
 881                      
 882                                  _routing_table.insert_record(
 883                                      PEGASUS_CLASSNAME___NAMESPACE,
 884                                      _wild,
 885                                      DynamicRoutingTable::INTERNAL,
 886                                      0,
 887                                      static_cast<MessageQueueService*>(
 888                                          MessageQueue::lookup(PEGASUS_QUEUENAME_CONTROLSERVICE)),
 889                                      PEGASUS_MODULENAME_NAMESPACEPROVIDER,
 890                                      PEGASUS_QUEUENAME_CONTROLSERVICE);
 891 brian.campbell 1.189 
 892 h.sterling     1.195 #ifdef PEGASUS_HAS_SSL
 893 kumpf          1.262             _routing_table.insert_record(
 894                                      PEGASUS_CLASSNAME_CERTIFICATE,
 895                                      PEGASUS_NAMESPACENAME_CERTIFICATE,
 896                                      DynamicRoutingTable::INTERNAL,
 897                                      0,
 898                                      static_cast<MessageQueueService*>(
 899                                          MessageQueue::lookup(PEGASUS_QUEUENAME_CONTROLSERVICE)),
 900                                      PEGASUS_MODULENAME_CERTIFICATEPROVIDER,
 901                                      PEGASUS_QUEUENAME_CONTROLSERVICE);
 902                      
 903                                  _routing_table.insert_record(
 904                                      PEGASUS_CLASSNAME_CRL,
 905                                      PEGASUS_NAMESPACENAME_CERTIFICATE,
 906                                      DynamicRoutingTable::INTERNAL,
 907                                      0,
 908                                      static_cast<MessageQueueService*>(
 909                                          MessageQueue::lookup(PEGASUS_QUEUENAME_CONTROLSERVICE)),
 910                                      PEGASUS_MODULENAME_CERTIFICATEPROVIDER,
 911                                      PEGASUS_QUEUENAME_CONTROLSERVICE);
 912 h.sterling     1.195 #endif
 913 brian.campbell 1.189 
 914 karl           1.203 #ifndef PEGASUS_DISABLE_PERFINST
 915 kumpf          1.262             _routing_table.insert_record(
 916                                      PEGASUS_CLASSNAME_CIMOMSTATDATA,
 917                                      PEGASUS_NAMESPACENAME_CIMOMSTATDATA,
 918                                      DynamicRoutingTable::INTERNAL,
 919                                      0,
 920                                      static_cast<MessageQueueService*>(
 921                                          MessageQueue::lookup(PEGASUS_QUEUENAME_CONTROLSERVICE)),
 922                                      PEGASUS_MODULENAME_CIMOMSTATDATAPROVIDER,
 923                                      PEGASUS_QUEUENAME_CONTROLSERVICE);
 924 brian.campbell 1.189 #endif
 925                      
 926 a.arora        1.199 #ifndef PEGASUS_DISABLE_CQL
 927 kumpf          1.262             _routing_table.insert_record(
 928                                      PEGASUS_CLASSNAME_CIMQUERYCAPABILITIES,
 929                                      //PEGASUS_NAMESPACENAME_CIMQUERYCAPABILITIES,
 930                                      _wild,
 931                                      DynamicRoutingTable::INTERNAL,
 932                                      0,
 933                                      static_cast<MessageQueueService*>(
 934                                          MessageQueue::lookup(PEGASUS_QUEUENAME_CONTROLSERVICE)),
 935                                      PEGASUS_MODULENAME_CIMQUERYCAPPROVIDER,
 936                                      PEGASUS_QUEUENAME_CONTROLSERVICE);
 937 a.arora        1.199 #endif
 938                      
 939 karl           1.203 #if !defined(PEGASUS_DISABLE_PERFINST) || defined(PEGASUS_ENABLE_SLP)
 940 kumpf          1.262             // InteropProvider ObjectManager Class
 941                                  _routing_table.insert_record(
 942                                      PEGASUS_CLASSNAME_PG_OBJECTMANAGER,
 943                                      PEGASUS_NAMESPACENAME_INTEROP,
 944                                      DynamicRoutingTable::INTERNAL,
 945                                      0,
 946                                      static_cast<MessageQueueService*>(
 947                                          MessageQueue::lookup(PEGASUS_QUEUENAME_CONTROLSERVICE)),
 948                                      PEGASUS_MODULENAME_INTEROPPROVIDER,
 949                                      PEGASUS_QUEUENAME_CONTROLSERVICE);
 950                      
 951                                  // CIM_Namespace - Implemented to assure that it does not
 952                                  // access the repository and to allow  access to
 953                                  // common class CIM_Namespace for namespace creation.
 954                                  _routing_table.insert_record(
 955                                      PEGASUS_CLASSNAME_CIMNAMESPACE,
 956                                      _wild,
 957                                      DynamicRoutingTable::INTERNAL,
 958                                      0,
 959                                      static_cast<MessageQueueService*>(
 960                                          MessageQueue::lookup(PEGASUS_QUEUENAME_CONTROLSERVICE)),
 961 kumpf          1.262                 PEGASUS_MODULENAME_INTEROPPROVIDER,
 962                                      PEGASUS_QUEUENAME_CONTROLSERVICE);
 963                      
 964                                  // PG_NAMESPACE - Implements subclass of CIM_Namespace managed by
 965                                  // InteropProvider.
 966                                  _routing_table.insert_record(
 967                                      PEGASUS_CLASSNAME_PGNAMESPACE,
 968                                      _wild,
 969                                      DynamicRoutingTable::INTERNAL,
 970                                      0,
 971                                      static_cast<MessageQueueService*>(
 972                                          MessageQueue::lookup(PEGASUS_QUEUENAME_CONTROLSERVICE)),
 973                                      PEGASUS_MODULENAME_INTEROPPROVIDER,
 974                                      PEGASUS_QUEUENAME_CONTROLSERVICE);
 975 w.white        1.193 #endif
 976 r.kieninger    1.197 
 977 w.white        1.193 #ifdef PEGASUS_ENABLE_SLP
 978 kumpf          1.262             _routing_table.insert_record(
 979                                      PEGASUS_CLASSNAME_PG_CIMXMLCOMMUNICATIONMECHANISM,
 980                                      PEGASUS_NAMESPACENAME_INTEROP,
 981                                      DynamicRoutingTable::INTERNAL,
 982                                      0,
 983                                      static_cast<MessageQueueService*>(
 984                                          MessageQueue::lookup(PEGASUS_QUEUENAME_CONTROLSERVICE)),
 985                                      PEGASUS_MODULENAME_INTEROPPROVIDER,
 986                                      PEGASUS_QUEUENAME_CONTROLSERVICE);
 987                      
 988                                  _routing_table.insert_record(
 989                                      PEGASUS_CLASSNAME_PG_COMMMECHANISMFORMANAGER,
 990                                      PEGASUS_NAMESPACENAME_INTEROP,
 991                                      DynamicRoutingTable::INTERNAL,
 992                                      0,
 993                                      static_cast<MessageQueueService*>(
 994                                          MessageQueue::lookup(PEGASUS_QUEUENAME_CONTROLSERVICE)),
 995                                      PEGASUS_MODULENAME_INTEROPPROVIDER,
 996                                      PEGASUS_QUEUENAME_CONTROLSERVICE);
 997                      
 998                                  _routing_table.insert_record(
 999 kumpf          1.262                 PEGASUS_CLASSNAME_PG_COMPUTERSYSTEM,
1000                                      PEGASUS_NAMESPACENAME_INTEROP,
1001                                      DynamicRoutingTable::INTERNAL,
1002                                      0,
1003                                      static_cast<MessageQueueService*>(
1004                                          MessageQueue::lookup(PEGASUS_QUEUENAME_CONTROLSERVICE)),
1005                                      PEGASUS_MODULENAME_INTEROPPROVIDER,
1006                                      PEGASUS_QUEUENAME_CONTROLSERVICE);
1007                      
1008                                  _routing_table.insert_record(
1009                                      PEGASUS_CLASSNAME_PG_HOSTEDOBJECTMANAGER,
1010                                      PEGASUS_NAMESPACENAME_INTEROP,
1011                                      DynamicRoutingTable::INTERNAL,
1012                                      0,
1013                                      static_cast<MessageQueueService*>(
1014                                          MessageQueue::lookup(PEGASUS_QUEUENAME_CONTROLSERVICE)),
1015                                      PEGASUS_MODULENAME_INTEROPPROVIDER,
1016                                      PEGASUS_QUEUENAME_CONTROLSERVICE);
1017                      
1018                                  _routing_table.insert_record(
1019                                      PEGASUS_CLASSNAME_PG_HOSTEDACCESSPOINT,
1020 kumpf          1.262                 PEGASUS_NAMESPACENAME_INTEROP,
1021                                      DynamicRoutingTable::INTERNAL,
1022                                      0,
1023                                      static_cast<MessageQueueService*>(
1024                                          MessageQueue::lookup(PEGASUS_QUEUENAME_CONTROLSERVICE)),
1025                                      PEGASUS_MODULENAME_INTEROPPROVIDER,
1026                                      PEGASUS_QUEUENAME_CONTROLSERVICE);
1027                      
1028                                  _routing_table.insert_record(
1029                                      PEGASUS_CLASSNAME_PG_NAMESPACEINMANAGER,
1030                                      PEGASUS_NAMESPACENAME_INTEROP,
1031                                      DynamicRoutingTable::INTERNAL,
1032                                      0,
1033                                      static_cast<MessageQueueService*>(
1034                                          MessageQueue::lookup(PEGASUS_QUEUENAME_CONTROLSERVICE)),
1035                                      PEGASUS_MODULENAME_INTEROPPROVIDER,
1036                                      PEGASUS_QUEUENAME_CONTROLSERVICE);
1037                      
1038                                  _routing_table.insert_record(
1039                                      PEGASUS_CLASSNAME_PG_REGISTEREDPROFILE,
1040                                      PEGASUS_NAMESPACENAME_INTEROP,
1041 kumpf          1.262                 DynamicRoutingTable::INTERNAL,
1042                                      0,
1043                                      static_cast<MessageQueueService*>(
1044                                          MessageQueue::lookup(PEGASUS_QUEUENAME_CONTROLSERVICE)),
1045                                      PEGASUS_MODULENAME_INTEROPPROVIDER,
1046                                      PEGASUS_QUEUENAME_CONTROLSERVICE);
1047                      
1048                                  _routing_table.insert_record(
1049                                      PEGASUS_CLASSNAME_PG_REGISTEREDSUBPROFILE,
1050                                      PEGASUS_NAMESPACENAME_INTEROP,
1051                                      DynamicRoutingTable::INTERNAL,
1052                                      0,
1053                                      static_cast<MessageQueueService*>(
1054                                          MessageQueue::lookup(PEGASUS_QUEUENAME_CONTROLSERVICE)),
1055                                      PEGASUS_MODULENAME_INTEROPPROVIDER,
1056                                      PEGASUS_QUEUENAME_CONTROLSERVICE);
1057                      
1058                                  _routing_table.insert_record(
1059                                      PEGASUS_CLASSNAME_PG_REFERENCEDPROFILE,
1060                                      PEGASUS_NAMESPACENAME_INTEROP,
1061                                      DynamicRoutingTable::INTERNAL,
1062 kumpf          1.262                 0,
1063                                      static_cast<MessageQueueService*>(
1064                                          MessageQueue::lookup(PEGASUS_QUEUENAME_CONTROLSERVICE)),
1065                                      PEGASUS_MODULENAME_INTEROPPROVIDER,
1066                                      PEGASUS_QUEUENAME_CONTROLSERVICE);
1067                      
1068                                  _routing_table.insert_record(
1069                                      PEGASUS_CLASSNAME_PG_REGISTEREDSUBPROFILE,
1070                                      PEGASUS_NAMESPACENAME_INTEROP,
1071                                      DynamicRoutingTable::INTERNAL,
1072                                      0,
1073                                      static_cast<MessageQueueService*>(
1074                                          MessageQueue::lookup(PEGASUS_QUEUENAME_CONTROLSERVICE)),
1075                                      PEGASUS_MODULENAME_INTEROPPROVIDER,
1076                                      PEGASUS_QUEUENAME_CONTROLSERVICE);
1077                      
1078                                  _routing_table.insert_record(
1079                                       PEGASUS_CLASSNAME_PG_ELEMENTCONFORMSTOPROFILE,
1080                                      _wild,
1081                                      DynamicRoutingTable::INTERNAL,
1082                                      0,
1083 kumpf          1.262                 static_cast<MessageQueueService*>(
1084                                          MessageQueue::lookup(PEGASUS_QUEUENAME_CONTROLSERVICE)),
1085                                      PEGASUS_MODULENAME_INTEROPPROVIDER,
1086                                      PEGASUS_QUEUENAME_CONTROLSERVICE);
1087                      
1088                                  _routing_table.insert_record(
1089                                       PEGASUS_CLASSNAME_PG_SUBPROFILEREQUIRESPROFILE,
1090                                      PEGASUS_NAMESPACENAME_INTEROP,
1091                                      DynamicRoutingTable::INTERNAL,
1092                                      0,
1093                                      static_cast<MessageQueueService*>(
1094                                          MessageQueue::lookup(PEGASUS_QUEUENAME_CONTROLSERVICE)),
1095                                      PEGASUS_MODULENAME_INTEROPPROVIDER,
1096                                      PEGASUS_QUEUENAME_CONTROLSERVICE);
1097                      
1098                                  _routing_table.insert_record(
1099                                      PEGASUS_CLASSNAME_PG_SOFTWAREIDENTITY,
1100                                      PEGASUS_NAMESPACENAME_INTEROP,
1101                                      DynamicRoutingTable::INTERNAL,
1102                                      0,
1103                                      static_cast<MessageQueueService*>(
1104 kumpf          1.262                     MessageQueue::lookup(PEGASUS_QUEUENAME_CONTROLSERVICE)),
1105                                      PEGASUS_MODULENAME_INTEROPPROVIDER,
1106                                      PEGASUS_QUEUENAME_CONTROLSERVICE);
1107                      
1108                                  _routing_table.insert_record(
1109                                      PEGASUS_CLASSNAME_PG_ELEMENTSOFTWAREIDENTITY,
1110                                      PEGASUS_NAMESPACENAME_INTEROP,
1111                                      DynamicRoutingTable::INTERNAL,
1112                                      0,
1113                                      static_cast<MessageQueueService*>(
1114                                          MessageQueue::lookup(PEGASUS_QUEUENAME_CONTROLSERVICE)),
1115                                      PEGASUS_MODULENAME_INTEROPPROVIDER,
1116                                      PEGASUS_QUEUENAME_CONTROLSERVICE);
1117                      
1118                                  _routing_table.insert_record(
1119                                      PEGASUS_CLASSNAME_PG_INSTALLEDSOFTWAREIDENTITY,
1120                                      PEGASUS_NAMESPACENAME_INTEROP,
1121                                      DynamicRoutingTable::INTERNAL,
1122                                      0,
1123                                      static_cast<MessageQueueService*>(
1124                                          MessageQueue::lookup(PEGASUS_QUEUENAME_CONTROLSERVICE)),
1125 kumpf          1.262                 PEGASUS_MODULENAME_INTEROPPROVIDER,
1126                                      PEGASUS_QUEUENAME_CONTROLSERVICE);
1127 brian.campbell 1.189 #endif // PEGASUS_ENABLE_SLP
1128                      
1129 kumpf          1.262             _routing_table.insert_record(
1130                                      PEGASUS_CLASSNAME_PROVIDERMODULE,
1131                                      PEGASUS_NAMESPACENAME_PROVIDERREG,
1132                                      DynamicRoutingTable::INTERNAL,
1133                                      0,
1134                                      static_cast<MessageQueueService*>(
1135                                          MessageQueue::lookup(PEGASUS_QUEUENAME_CONTROLSERVICE)),
1136                                      PEGASUS_MODULENAME_PROVREGPROVIDER,
1137                                      PEGASUS_QUEUENAME_CONTROLSERVICE);
1138                      
1139                                  _routing_table.insert_record(
1140                                      PEGASUS_CLASSNAME_PROVIDER,
1141                                      PEGASUS_NAMESPACENAME_PROVIDERREG,
1142                                      DynamicRoutingTable::INTERNAL,
1143                                      0,
1144                                      static_cast<MessageQueueService*>(
1145                                          MessageQueue::lookup(PEGASUS_QUEUENAME_CONTROLSERVICE)),
1146                                      PEGASUS_MODULENAME_PROVREGPROVIDER,
1147                                      PEGASUS_QUEUENAME_CONTROLSERVICE);
1148                      
1149                                  _routing_table.insert_record(
1150 kumpf          1.262                 PEGASUS_CLASSNAME_PROVIDERCAPABILITIES,
1151                                      PEGASUS_NAMESPACENAME_PROVIDERREG,
1152                                      DynamicRoutingTable::INTERNAL,
1153                                      0,
1154                                      static_cast<MessageQueueService*>(
1155                                          MessageQueue::lookup(PEGASUS_QUEUENAME_CONTROLSERVICE)),
1156                                      PEGASUS_MODULENAME_PROVREGPROVIDER,
1157                                      PEGASUS_QUEUENAME_CONTROLSERVICE);
1158                      
1159                                  _routing_table.insert_record(
1160                                      PEGASUS_CLASSNAME_CONSUMERCAPABILITIES,
1161                                      PEGASUS_NAMESPACENAME_PROVIDERREG,
1162                                      DynamicRoutingTable::INTERNAL,
1163                                      0,
1164                                      static_cast<MessageQueueService*>(
1165                                          MessageQueue::lookup(PEGASUS_QUEUENAME_CONTROLSERVICE)),
1166                                      PEGASUS_MODULENAME_PROVREGPROVIDER,
1167                                      PEGASUS_QUEUENAME_CONTROLSERVICE);
1168                      
1169                                  if (_enableIndicationService)
1170                                  {
1171 kumpf          1.262                 _routing_table.insert_record(
1172                                          PEGASUS_CLASSNAME_INDSUBSCRIPTION,
1173                                          _wild,
1174                                          DynamicRoutingTable::INTERNAL,
1175                                          0,
1176                                          static_cast<MessageQueueService*>(MessageQueue::lookup(
1177                                              PEGASUS_QUEUENAME_INDICATIONSERVICE)),
1178                                          String::EMPTY,
1179                                          PEGASUS_QUEUENAME_INDICATIONSERVICE);
1180                      
1181                                      _routing_table.insert_record(
1182                                          PEGASUS_CLASSNAME_FORMATTEDINDSUBSCRIPTION,
1183                                          _wild,
1184                                          DynamicRoutingTable::INTERNAL,
1185                                          0,
1186                                          static_cast<MessageQueueService*>(MessageQueue::lookup(
1187                                              PEGASUS_QUEUENAME_INDICATIONSERVICE)),
1188                                          String::EMPTY,
1189                                          PEGASUS_QUEUENAME_INDICATIONSERVICE);
1190                      
1191                                      _routing_table.insert_record(
1192 kumpf          1.262                     PEGASUS_CLASSNAME_INDHANDLER,
1193                                          _wild,
1194                                          DynamicRoutingTable::INTERNAL,
1195                                          0,
1196                                          static_cast<MessageQueueService*>(MessageQueue::lookup(
1197                                              PEGASUS_QUEUENAME_INDICATIONSERVICE)),
1198                                          String::EMPTY,
1199                                          PEGASUS_QUEUENAME_INDICATIONSERVICE);
1200                      
1201                                              _routing_table.insert_record(
1202                                          PEGASUS_CLASSNAME_LSTNRDST_CIMXML,
1203                                          _wild,
1204                                          DynamicRoutingTable::INTERNAL,
1205                                          0,
1206                                          static_cast<MessageQueueService*>(MessageQueue::lookup(
1207                                              PEGASUS_QUEUENAME_INDICATIONSERVICE)),
1208                                          String::EMPTY,
1209                                          PEGASUS_QUEUENAME_INDICATIONSERVICE);
1210                      
1211                                      _routing_table.insert_record(
1212                                          PEGASUS_CLASSNAME_INDHANDLER_CIMXML,
1213 kumpf          1.262                     _wild,
1214                                          DynamicRoutingTable::INTERNAL,
1215                                          0,
1216                                          static_cast<MessageQueueService*>(MessageQueue::lookup(
1217                                              PEGASUS_QUEUENAME_INDICATIONSERVICE)),
1218                                          String::EMPTY,
1219                                          PEGASUS_QUEUENAME_INDICATIONSERVICE);
1220                      
1221                                      _routing_table.insert_record(
1222                                          PEGASUS_CLASSNAME_INDHANDLER_SNMP,
1223                                          _wild,
1224                                          DynamicRoutingTable::INTERNAL,
1225                                          0,
1226                                          static_cast<MessageQueueService*>(MessageQueue::lookup(
1227                                              PEGASUS_QUEUENAME_INDICATIONSERVICE)),
1228                                          String::EMPTY,
1229                                          PEGASUS_QUEUENAME_INDICATIONSERVICE);
1230                      
1231                                      _routing_table.insert_record(
1232                                          PEGASUS_CLASSNAME_LSTNRDST_SYSTEM_LOG,
1233                                          _wild,
1234 kumpf          1.262                     DynamicRoutingTable::INTERNAL,
1235                                          0,
1236                                          static_cast<MessageQueueService*>(MessageQueue::lookup(
1237                                              PEGASUS_QUEUENAME_INDICATIONSERVICE)),
1238                                          String::EMPTY,
1239                                          PEGASUS_QUEUENAME_INDICATIONSERVICE);
1240                      
1241                                      _routing_table.insert_record(
1242                                          PEGASUS_CLASSNAME_LSTNRDST_EMAIL,
1243                                          _wild,
1244                                          DynamicRoutingTable::INTERNAL,
1245                                          0,
1246                                          static_cast<MessageQueueService*>(MessageQueue::lookup(
1247                                              PEGASUS_QUEUENAME_INDICATIONSERVICE)),
1248                                          String::EMPTY,
1249                                          PEGASUS_QUEUENAME_INDICATIONSERVICE);
1250                      
1251                                      _routing_table.insert_record(
1252                                          PEGASUS_CLASSNAME_INDFILTER,
1253                                          _wild,
1254                                          DynamicRoutingTable::INTERNAL,
1255 kumpf          1.262                     0,
1256                                          static_cast<MessageQueueService*>(MessageQueue::lookup(
1257                                              PEGASUS_QUEUENAME_INDICATIONSERVICE)),
1258                                          String::EMPTY,
1259                                          PEGASUS_QUEUENAME_INDICATIONSERVICE);
1260                                  }
1261                                  _initialized = 1;
1262                              }
1263                          }
1264 brian.campbell 1.189 
1265 kumpf          1.262     MessageQueueService* router =
1266                              _routing_table.get_routing(
1267                                  className,
1268                                  nameSpace,
1269                                  DynamicRoutingTable::INTERNAL,
1270                                  0,
1271                                  provider,
1272                                  service);
1273                          PEG_TRACE_STRING(TRC_DISPATCHER, Tracer::LEVEL4,
1274                              "Internal provider  Service = " + service + " provider " + provider +
1275                                  " found.");
1276 brian.campbell 1.189 
1277 kumpf          1.262     PEG_METHOD_EXIT();
1278                          return (router != 0);
1279 brian.campbell 1.189 }
1280                      
1281 kumpf          1.262 /**
1282                          _getSubClassNames - Gets the names of all subclasses of the defined
1283                          class (including the class) and returns it in an array of strings. Uses a
1284                          similar function in the repository class to get the names.  Note that
1285                          this prepends the result with the input classname.
1286 brian.campbell 1.189     @param namespace
1287                          @param className
1288 kumpf          1.262     @return Array of strings with class names.  Note that there should be at
1289                          least one classname in the array (the input name)
1290                          Note that there is a special exception to this function, the __namespace
1291                          class which does not have any representation in the class repository.
1292 brian.campbell 1.189     @exception CIMException(CIM_ERR_INVALID_CLASS)
1293                      */
1294                      Array<CIMName> CIMOperationRequestDispatcher::_getSubClassNames(
1295 kumpf          1.226     const CIMNamespaceName& nameSpace,
1296 david.dillard  1.229     const CIMName& className)
1297 brian.campbell 1.189 {
1298                          PEG_METHOD_ENTER(TRC_DISPATCHER,
1299 kumpf          1.226         "CIMOperationRequestDispatcher::_getSubClassNames");
1300 brian.campbell 1.189 
1301                          Array<CIMName> subClassNames;
1302                          //
1303                          // Get names of descendent classes:
1304                          //
1305 kumpf          1.262     if (!className.equal (PEGASUS_CLASSNAME___NAMESPACE))
1306 brian.campbell 1.189     {
1307 kumpf          1.226         try
1308                              {
1309                                  // Get the complete list of subclass names
1310                                  _repository->getSubClassNames(nameSpace,
1311                                       className, true, subClassNames);
1312 chip           1.241             PEG_LOGGER_TRACE((Logger::STANDARD_LOG, System::CIMSERVER,
1313 kumpf          1.262                 Logger::TRACE,
1314 mike           1.240                 "CIMOperationRequestDispatcher::_getSubClassNames - "
1315 kumpf          1.262                     "Namespace: $0  Class name: $1",
1316 mike           1.240                 nameSpace.getString(),
1317                                      className.getString()));
1318 kumpf          1.226         }
1319 kumpf          1.262         catch (...)
1320 brian.campbell 1.189         {
1321                                  // getSubClassNames throws an exception if the class does not exist
1322                                  PEG_METHOD_EXIT();
1323                                  throw;
1324                              }
1325                          }
1326                          // Prepend the array with the classname that formed the array.
1327                          subClassNames.prepend(className);
1328                          return subClassNames;
1329                      }
1330                      
1331                      ///////////////////////////////////////////////////////////////////////////
1332 kumpf          1.228 //  PropertyList management functions
1333 brian.campbell 1.189 //////////////////////////////////////////////////////////////////////////
1334                      
1335                      /* _showPropertyList is local support for displaying the propertylist
1336                         For display only. Generates String with property list names
1337                         or "empty" or "NULL" if that is the case.
1338                         @param pl CIMPropertyList to convert
1339                         @return String containing the list of properties comma separated
1340 kumpf          1.228    or the keywords NULL or EMPTY.
1341 brian.campbell 1.189  */
1342 carson.hovey   1.223 static String _showPropertyList(const CIMPropertyList& pl)
1343 brian.campbell 1.189 {
1344 kumpf          1.228     String returnString;
1345                      
1346 brian.campbell 1.189     if (pl.isNull())
1347                          {
1348 kumpf          1.228         returnString = "NULL";
1349                          }
1350                          else if (pl.size() == 0)
1351                          {
1352                              returnString = "EMPTY";
1353 brian.campbell 1.189     }
1354 kumpf          1.228     else
1355 brian.campbell 1.189     {
1356 kumpf          1.228         for (Uint32 i = 0; i < pl.size(); i++)
1357 brian.campbell 1.189         {
1358 kumpf          1.228             if (i > 0)
1359                                  {
1360                                      returnString.append(", ");
1361                                  }
1362                                  returnString.append(pl[i].getString());
1363 brian.campbell 1.189         }
1364                          }
1365                      
1366 kumpf          1.228     return returnString;
1367 brian.campbell 1.189 }
1368                      
1369                      ///////////////////////////////////////////////////////////////////////////
1370                      // Provider Lookup Functions
1371                      ///////////////////////////////////////////////////////////
1372                      /* _lookupAllInstanceProviders - Returns the list of all subclasses of this
1373                         class along with information about whether it is an instance provider.
1374                         @param nameSpace - Namespace for the lookup.
1375                         @param className - className for which we are finding providers
1376                         @param providerCount - Returns count of providers in the response array.
1377                         This is because the array returned is all subclasses, not simply those
1378                         with providers.
1379                         @return Returns an array of ProviderInfo, one entry for each subclass.
1380                         Each ProviderInfo instance defines whether a provider exists and the
1381                         information on the provider so that the operation can be forwarded to the
1382                         provider.
1383 david.dillard  1.229    @exception - Throws one exception if the className is in error.  Note that
1384 brian.campbell 1.189    this should NEVER occur since the className should have already been
1385                         validated in the operation code.
1386                      */
1387                      Array<ProviderInfo> CIMOperationRequestDispatcher::_lookupAllInstanceProviders(
1388 kumpf          1.262     const CIMNamespaceName& nameSpace,
1389                          const CIMName& className,
1390                          Uint32& providerCount)
1391 chip           1.217 {
1392                          PEG_METHOD_ENTER(
1393                              TRC_DISPATCHER,
1394                              "CIMOperationRequestDispatcher::_lookupAllInstanceProviders");
1395                      
1396                          providerCount = 0;
1397 brian.campbell 1.189 
1398                          // NOTE: This function can generate an exception.
1399 chip           1.219     Array<CIMName> classNames = _getSubClassNames(nameSpace, className);
1400 brian.campbell 1.189 
1401                          Array<ProviderInfo> providerInfoList;
1402                      
1403                          // Loop for all classNames found
1404 kumpf          1.262     for (Uint32 i = 0, n = classNames.size(); i < n; i++)
1405 chip           1.217     {
1406                              // Lookup any instance providers and add to send list
1407 chip           1.219         ProviderInfo providerInfo =
1408 chip           1.217             _lookupNewInstanceProvider(
1409                                      nameSpace,
1410 chip           1.219                 classNames[i]);
1411 chip           1.217 
1412 kumpf          1.262         if (providerInfo.hasProvider)
1413 kumpf          1.226         {
1414 chip           1.217             providerCount++;
1415                      
1416                                  CDEBUG("Found provider for class = " << classNames[i].getString());
1417                      
1418                                  PEG_TRACE_STRING(
1419                                      TRC_DISPATCHER,
1420                                      Tracer::LEVEL4,
1421 kumpf          1.262                 "Provider found for class = " +
1422                                          providerInfo.className.getString() +
1423 chip           1.219                     " servicename = " + providerInfo.serviceName +
1424 kumpf          1.262                     " controlProviderName = " +
1425                                          providerInfo.controlProviderName);
1426 chip           1.217         }
1427                              else
1428                              {
1429                                  CDEBUG("No provider for class = " << classNames[i].getString());
1430                              }
1431                      
1432 chip           1.219         providerInfoList.append(providerInfo);
1433 brian.campbell 1.189    }
1434 chip           1.217 
1435 brian.campbell 1.189    PEG_METHOD_EXIT();
1436 chip           1.217 
1437 kumpf          1.262    return providerInfoList;
1438 brian.campbell 1.189 }
1439                      
1440                      /* _lookupInstanceProvider - Looks up the instance provider for the
1441                          classname and namespace.
1442                          Returns the name of the provider.
1443                          NOTE: This is the low level lookup for compatibility with
1444                          the external lookup in provider registration manager.
1445                          Added value is simply to get the name property from the returned
1446                          Instance.
1447                      
1448                      */
1449 chip           1.219 ProviderInfo CIMOperationRequestDispatcher::_lookupInstanceProvider(
1450 kumpf          1.262    const CIMNamespaceName& nameSpace,
1451                         const CIMName& className)
1452 chip           1.217 {
1453                          PEG_METHOD_ENTER(
1454                              TRC_DISPATCHER,
1455                              "CIMOperationRequestDispatcher::_lookupInstanceProvider");
1456                      
1457 chip           1.219     ProviderInfo providerInfo(className);
1458                      
1459 brian.campbell 1.189     String providerName;
1460                          String serviceName;
1461                      
1462 kumpf          1.262     MessageQueueService* router =
1463 chip           1.217        _routing_table.get_routing(
1464                                 className,
1465                                 nameSpace,
1466                                 DynamicRoutingTable::INSTANCE,
1467                                 0,
1468                                 providerName,
1469                                 serviceName);
1470 brian.campbell 1.189 
1471 kumpf          1.262     if (router)
1472 brian.campbell 1.189     {
1473 chip           1.217        PEG_TRACE_STRING(
1474                                 TRC_DISPATCHER,
1475                                 Tracer::LEVEL4,
1476 kumpf          1.226            "providerName = " + providerName + " found.");
1477 brian.campbell 1.189 
1478 chip           1.219        providerInfo.serviceName = serviceName;
1479                             providerInfo.controlProviderName = providerName;
1480                      
1481 brian.campbell 1.189        PEG_METHOD_EXIT();
1482 chip           1.217 
1483 kumpf          1.262        return providerInfo;
1484 brian.campbell 1.189     }
1485                      
1486 chip           1.219     CIMInstance pInstance;
1487                          CIMInstance pmInstance;
1488                          Boolean hasNoQuery = true;
1489                      
1490 chip           1.217     Boolean hasProvider =
1491                              _providerRegistrationManager->lookupInstanceProvider(
1492                                  nameSpace,
1493                                  className,
1494                                  pInstance,
1495                                  pmInstance,
1496                                  false,
1497 chip           1.219             &hasNoQuery);
1498 brian.campbell 1.189 
1499 kumpf          1.262     if (hasProvider)
1500 brian.campbell 1.189     {
1501 chip           1.219         providerInfo.serviceName = PEGASUS_QUEUENAME_PROVIDERMANAGER_CPP;
1502                      
1503                              providerInfo.hasProvider = true;
1504                              providerInfo.hasNoQuery = hasNoQuery;
1505 chip           1.217 
1506 kumpf          1.226 #ifdef PEGASUS_ENABLE_REMOTE_CMPI
1507                              String remoteInformation;
1508 kumpf          1.262         Boolean isRemote =
1509                                  _repository->isRemoteNameSpace(nameSpace, remoteInformation);
1510 chip           1.217 
1511 kumpf          1.262         if (isRemote)
1512 chip           1.217         {
1513 kumpf          1.262             providerInfo.providerIdContainer.reset(new ProviderIdContainer(
1514                                      pmInstance, pInstance, isRemote, remoteInformation));
1515 chip           1.217         }
1516 kumpf          1.226         else
1517 chip           1.217         {
1518 chip           1.219             providerInfo.providerIdContainer.reset(
1519                                      new ProviderIdContainer(pmInstance, pInstance));
1520 chip           1.217         }
1521 kumpf          1.226 #else
1522 chip           1.219         providerInfo.providerIdContainer.reset(
1523                                  new ProviderIdContainer(pmInstance, pInstance));
1524 kumpf          1.226 #endif
1525 chip           1.217 
1526 chip           1.219         Uint32 pos = PEG_NOT_FOUND;
1527 chip           1.217 
1528 kumpf          1.226 #ifdef PEGASUS_ENABLE_OBJECT_NORMALIZATION
1529 kumpf          1.262         if (_enableNormalization)
1530 chip           1.217         {
1531 chip           1.241             // normalization is enabled for all providers unless they
1532                                  // have an old interface version or are explicity excluded by
1533                                  // the excludeModulesFromNormalization configuration option.
1534 chip           1.217 
1535 chip           1.241             // check interface type and version
1536                      
1537                                  String interfaceType;
1538                                  String interfaceVersion;
1539                      
1540                                  // get the provder interface type
1541 kumpf          1.262             if ((pos = pmInstance.findProperty("InterfaceType")) !=
1542                                          PEG_NOT_FOUND)
1543 chip           1.241             {
1544                                      pmInstance.getProperty(pos).getValue().get(interfaceType);
1545                                  }
1546                      
1547                                  // get the provder interface version
1548 kumpf          1.262             if ((pos = pmInstance.findProperty("InterfaceVersion")) !=
1549                                          PEG_NOT_FOUND)
1550 chip           1.217             {
1551                                      pmInstance.getProperty(pos).getValue().get(interfaceVersion);
1552 chip           1.241             }
1553 chip           1.217 
1554 chip           1.241             // compare the interface type and vesion
1555 kumpf          1.262             if (String::equalNoCase(interfaceType, "C++Default"))
1556 chip           1.241             {
1557                                      // version must be greater than 2.5.0
1558 kumpf          1.262                 if (String::compare(interfaceVersion, "2.5.0") >= 0)
1559 chip           1.217                 {
1560 chip           1.241                     providerInfo.hasProviderNormalization = true;
1561                                      }
1562                                  }
1563 kumpf          1.262             else if (String::equalNoCase(interfaceType, "CMPI"))
1564 chip           1.241             {
1565                                      // version must be greater than 2.0.0
1566 kumpf          1.262                 if (String::compare(interfaceVersion, "2.0.0") >= 0)
1567 chip           1.241                 {
1568                                          providerInfo.hasProviderNormalization = true;
1569                                      }
1570                                  }
1571 kumpf          1.262             else if (String::equalNoCase(interfaceType, "JMPI"))
1572 chip           1.241             {
1573                                      // version must be greater than 1.0.0
1574 kumpf          1.262                 if (String::compare(interfaceVersion, "1.0.0") >= 0)
1575 chip           1.241                 {
1576                                          providerInfo.hasProviderNormalization = true;
1577 chip           1.217                 }
1578                                  }
1579 chip           1.241 
1580                                  // check for module exclusion
1581                      
1582                                  String moduleName;
1583 chip           1.217 
1584 chip           1.220             // get the provder module name
1585 kumpf          1.262             if ((pos = pmInstance.findProperty("Name")) != PEG_NOT_FOUND)
1586 chip           1.217             {
1587 chip           1.220                 pmInstance.getProperty(pos).getValue().get(moduleName);
1588 chip           1.241             }
1589 chip           1.217 
1590 kumpf          1.262             // check if module name is on the excludeModulesFromNormalization
1591                                  // list
1592                                  for (Uint32 i = 0, n = _excludeModulesFromNormalization.size();
1593                                       i < n; i++)
1594 chip           1.241             {
1595 kumpf          1.262                 if (String::equalNoCase(
1596                                              moduleName, _excludeModulesFromNormalization[i]))
1597 chip           1.220                 {
1598 chip           1.241                     providerInfo.hasProviderNormalization = false;
1599                                          break;
1600 chip           1.217                 }
1601                                  }
1602 chip           1.241 
1603                                  PEG_TRACE_STRING(
1604                                      TRC_DISPATCHER,
1605                                      Tracer::LEVEL4,
1606 kumpf          1.262                 "Normalization for provider module " + moduleName + " is " +
1607                                          (providerInfo.hasProviderNormalization ?
1608                                              "enabled" : "disabled") +
1609 chip           1.241                     ".");
1610 chip           1.217         }
1611 kumpf          1.226 #endif
1612 brian.campbell 1.189 
1613 chip           1.219         /*
1614 chip           1.217         // get the provder name
1615 kumpf          1.262         if ((pos = pInstance.findProperty("Name")) != PEG_NOT_FOUND)
1616 kumpf          1.226         {
1617                                  pInstance.getProperty(pos).getValue().get(providerName);
1618 brian.campbell 1.189 
1619 chip           1.217             PEG_TRACE_STRING(
1620                                      TRC_DISPATCHER,
1621                                      Tracer::LEVEL4,
1622 kumpf          1.262                 "Provider for class " + className.getString() + " provider " +
1623                                          providerName + " found.");
1624 chip           1.219 
1625 brian.campbell 1.189             PEG_METHOD_EXIT();
1626 chip           1.217 
1627 kumpf          1.262             return providerInfo;
1628 kumpf          1.226         }
1629 chip           1.219         */
1630                      
1631 kumpf          1.262         return providerInfo;
1632 brian.campbell 1.189     }
1633 chip           1.217 
1634                          PEG_TRACE_STRING(
1635                              TRC_DISPATCHER,
1636                              Tracer::LEVEL4,
1637                              "Provider for " + className.getString() + " not found.");
1638                      
1639 brian.campbell 1.189     PEG_METHOD_EXIT();
1640 chip           1.217 
1641 kumpf          1.262     return providerInfo;
1642 brian.campbell 1.189 }
1643                      
1644                      /* _lookupNewInstanceProvider - Looks up the internal and/or instance provider
1645                          for the defined namespace and class and returns the serviceName and
1646                          control provider name if a provider is found.
1647                          @return true if a service, control provider, or instance provider is found
1648                          for the defined class and namespace.
1649                          This should be combined with the lookupInstanceProvider code eventually but
1650                          the goal now was to simplify the handlers.
1651                      */
1652 chip           1.219 ProviderInfo CIMOperationRequestDispatcher::_lookupNewInstanceProvider(
1653 kumpf          1.262     const CIMNamespaceName& nameSpace,
1654                          const CIMName& className)
1655 chip           1.217 {
1656                          PEG_METHOD_ENTER(
1657                              TRC_DISPATCHER,
1658                              "CIMOperationRequestDispatcher::_lookupNewInstanceProvider");
1659 brian.campbell 1.189 
1660 chip           1.219     ProviderInfo providerInfo(className);
1661                      
1662                          String serviceName;
1663                          String controlProviderName;
1664 brian.campbell 1.189 
1665 chip           1.217     // Check for class provided by an internal provider
1666 chip           1.219     Boolean hasControlProvider =
1667 chip           1.217         _lookupInternalProvider(
1668                                  nameSpace,
1669                                  className,
1670                                  serviceName,
1671                                  controlProviderName);
1672 brian.campbell 1.189 
1673 kumpf          1.262     if (hasControlProvider)
1674 chip           1.217     {
1675 chip           1.219         providerInfo.serviceName = serviceName;
1676                              providerInfo.controlProviderName = controlProviderName;
1677                              providerInfo.hasProvider = true;
1678 chip           1.217     }
1679                          else
1680                          {
1681                              // get provider for class
1682 chip           1.219         providerInfo =
1683                                  _lookupInstanceProvider(
1684                                      nameSpace,
1685                                      className);
1686 chip           1.217     }
1687 brian.campbell 1.189 
1688 chip           1.217     PEG_TRACE_STRING(
1689                              TRC_DISPATCHER,
1690                              Tracer::LEVEL4,
1691 chip           1.219         "Lookup Provider = " + providerInfo.serviceName +
1692                                  " provider " + providerInfo.controlProviderName + " found."
1693                                  + " return = " + (providerInfo.hasProvider ? "true" : "false"));
1694 brian.campbell 1.189 
1695 mike           1.240     PEG_LOGGER_TRACE((
1696 chip           1.217         Logger::STANDARD_LOG,
1697                              System::CIMSERVER,
1698                              Logger::TRACE,
1699 kumpf          1.262         "CIMOperationRequestDispatcher::_lookupNewInstanceProvider - "
1700                                  "Namespace: $0  Class Name: $1  Service Name: $2  "
1701                                  "Provider Name: $3",
1702 chip           1.217         nameSpace.getString(),
1703                              className.getString(),
1704 chip           1.219         providerInfo.serviceName,
1705 mike           1.240         providerInfo.controlProviderName));
1706 brian.campbell 1.189 
1707 chip           1.217     PEG_METHOD_EXIT();
1708 brian.campbell 1.189 
1709 kumpf          1.262     return providerInfo;
1710 chip           1.217 }
1711 brian.campbell 1.189 
1712                      String CIMOperationRequestDispatcher::_lookupMethodProvider(
1713 kumpf          1.262     const CIMNamespaceName& nameSpace,
1714                          const CIMName& className,
1715                          const CIMName& methodName,
1716                          ProviderIdContainer** providerIdContainer)
1717 brian.campbell 1.189 {
1718                          PEG_METHOD_ENTER(TRC_DISPATCHER,
1719                              "CIMOperationRequestDispatcher::_lookupMethodProvider");
1720                      
1721                          CIMInstance pInstance;
1722                          CIMInstance pmInstance;
1723                          String providerName;
1724                          String serviceName;
1725                      
1726 kumpf          1.262     MessageQueueService* router =
1727                              _routing_table.get_routing(className,
1728                                  nameSpace,
1729                                  DynamicRoutingTable::METHOD,
1730                                  0,
1731                                  providerName,
1732                                  serviceName);
1733                          if (router)
1734 brian.campbell 1.189     {
1735 kumpf          1.262         PEG_TRACE_STRING(TRC_DISPATCHER, Tracer::LEVEL4,
1736                                  "providerName = " + providerName + " found.");
1737                              PEG_METHOD_EXIT();
1738                              return providerName;
1739 brian.campbell 1.189     }
1740                      
1741                      
1742                          if (_providerRegistrationManager->lookupMethodProvider(
1743 kumpf          1.262             nameSpace, className, methodName, pInstance, pmInstance))
1744 brian.campbell 1.189     {
1745 kumpf          1.262         ProviderIdContainer* providercontainer;
1746 r.kieninger    1.197 #ifdef PEGASUS_ENABLE_REMOTE_CMPI
1747 kumpf          1.262         String remoteInformation;
1748                              Boolean isRemote = false;
1749 kumpf          1.226         isRemote = _repository->isRemoteNameSpace(nameSpace, remoteInformation);
1750                              if (isRemote)
1751 kumpf          1.262              providercontainer = new ProviderIdContainer(
1752                                      pmInstance, pInstance, isRemote, remoteInformation);
1753                              else
1754                                  providercontainer = new ProviderIdContainer(pmInstance, pInstance);
1755 r.kieninger    1.197 #else
1756 kumpf          1.262         providercontainer = new ProviderIdContainer(pmInstance, pInstance);
1757 r.kieninger    1.197 #endif
1758 kumpf          1.262         (*providerIdContainer) = providercontainer;
1759 kumpf          1.226         // get the provder name
1760                              Uint32 pos = pInstance.findProperty(CIMName ("Name"));
1761 brian.campbell 1.189 
1762 kumpf          1.262         if (pos != PEG_NOT_FOUND)
1763 kumpf          1.226         {
1764                                  pInstance.getProperty(pos).getValue().get(providerName);
1765                      
1766                                  PEG_METHOD_EXIT();
1767 kumpf          1.262             return providerName;
1768 kumpf          1.226         }
1769                              else
1770                              {
1771                                  PEG_METHOD_EXIT();
1772 kumpf          1.262             return String::EMPTY;
1773 kumpf          1.226         }
1774 brian.campbell 1.189     }
1775                          else
1776                          {
1777 kumpf          1.226         PEG_METHOD_EXIT();
1778 kumpf          1.262         return String::EMPTY;
1779 brian.campbell 1.189     }
1780                      }
1781                      
1782                      /* _lookupAllAssociation Providers for Class
1783                          Returns all of the association providers that exist
1784                          for the defined class name.  Used the referencenames
1785                          function to get list of classes for which providers
1786                          required and then looks up the providers for each
1787                          class
1788                          @param nameSpace
1789                          @param objectName
1790 kumpf          1.262     @param - referenced parameter that is modified in this funciton.  This
1791                          is the count of actual providers found, not the count of classes.  This
1792                          differs from the count of classes in that the providerInfo list is all
1793                          classes including those that would go to the repository.
1794 brian.campbell 1.189     @returns List of ProviderInfo
1795                          @exception - Exceptions From the Repository
1796 kumpf          1.262 */
1797                      Array<ProviderInfo>
1798                          CIMOperationRequestDispatcher::_lookupAllAssociationProviders(
1799                              const CIMNamespaceName& nameSpace,
1800                              const CIMObjectPath& objectName,
1801                              const CIMName& assocClass,
1802                              const String& role,
1803                              Uint32& providerCount)
1804 brian.campbell 1.189 {
1805                          PEG_METHOD_ENTER(TRC_DISPATCHER,
1806 kumpf          1.262         "CIMOperationRequestDispatcher::_lookupAllAssociationProviders");
1807 brian.campbell 1.189 
1808                          providerCount = 0;
1809                          Array<ProviderInfo> providerInfoList;
1810                      
1811                          Array<CIMName> classNames;
1812                          CIMName className = objectName.getClassName();
1813                          PEG_TRACE_STRING(TRC_DISPATCHER, Tracer::LEVEL4,
1814                              "Association Class Lookup for Class " + className.getString());
1815                      
1816 kumpf          1.262     // The association class is the basis for association registration.
1817                          // When an association class request is received by the CIMOM the target
1818                          // class is the endpoint class or instance.  Prevously we also called
1819                          // providers registered against this class.  Thus, typically this would
1820                          // be the same class as the instance class.  For example ClassA with
1821                          // Assoc1.  We would register an instance and Association provider
1822                          // against Class A.  With this change, we register the Instance class
1823                          // as before, but register the association class with the association
1824                          // itself, i.e. register it against the class Assoc1.
1825                          // In this case, the list of potential classes for providers is the same
1826                          // as the reference names, i.e the association classes that have
1827                          // associations pointing back to the target class.
1828                      
1829                          // ATTN: KS 20030515. After we test and complete the move to using this
1830                          // option, lets go back and change the call to avoid the double
1831                          // conversion to and from CIM Object path.
1832                      
1833                          CDEBUG("_LookupALLAssocProvider Calling referenceNames. class " <<
1834                              className);
1835 brian.campbell 1.189 
1836                          Array<CIMObjectPath> tmp;
1837                          CIMException cimException;
1838                      
1839                          try
1840                          {
1841                              // Note:  We use assocClass because this is the association function.
1842                              // The Reference(Name)s calls must put the resultClass here.
1843                              tmp = _repository->referenceNames(
1844                                  nameSpace,
1845                                  CIMObjectPath(String::EMPTY, CIMNamespaceName(), className),
1846                                  assocClass,
1847                                  role);
1848                          }
1849 kumpf          1.262     catch (const CIMException& exception)
1850 brian.campbell 1.189     {
1851                              cimException = exception;
1852                          }
1853 kumpf          1.262     catch (const Exception& exception)
1854 brian.campbell 1.189     {
1855                              cimException =
1856                                  PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED, exception.getMessage());
1857                          }
1858 kumpf          1.262     catch (...)
1859 brian.campbell 1.189     {
1860                              cimException = PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED, String::EMPTY);
1861                          }
1862                      
1863                          // If exception from repository, write log message and throw the exception
1864                          if (cimException.getCode() != CIM_ERR_SUCCESS)
1865                          {
1866                              Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::WARNING,
1867                                  "CIMOperationRequestDispatcher::lookupAllAssociationProvider "
1868                                      "exception.  Namespace: $0  Object Name: $1  Assoc Class: $2",
1869                                  nameSpace.getString(),
1870                                  objectName.toString(),
1871                                  assocClass.getString());
1872                              throw cimException;
1873                          }
1874                      
1875                      
1876 kumpf          1.262     // returns the list of possible association classes for this target.
1877 brian.campbell 1.189     // Convert to classnames
1878 kumpf          1.262     for (Uint32 i = 0; i < tmp.size(); i++)
1879                          {
1880                              classNames.append(tmp[i].getClassName());
1881                              CDEBUG("Reference Lookup returnsclass " << tmp[i].getClassName());
1882                          }
1883 brian.campbell 1.189 
1884 kumpf          1.262     CDEBUG("_lookup all assoc Classes Returned class list of size " <<
1885                              classNames.size() << " className= " << className.getString() <<
1886                              " assocClass= " << assocClass);
1887 chip           1.207 
1888                          // CV 20050211 Commented out debug loops
1889                          //for (Uint32 i = 0; i < classNames.size(); i++)
1890                          //{
1891 kumpf          1.262     //    CDEBUG(" Count i " << i << "Class rtned " <<
1892                          //        classNames[i].getString());
1893 chip           1.207     //}
1894                      
1895 kumpf          1.266     PEG_TRACE((TRC_DISPATCHER, Tracer::LEVEL4,
1896                              "Association Lookup: %u classes found",
1897                              classNames.size()));
1898 brian.campbell 1.189 
1899 kumpf          1.262     // ATTN: KS P2 20030420  What should we do with remote associations if
1900                          // there are any
1901 brian.campbell 1.189     for (Uint32 i = 0; i < classNames.size(); i++)
1902                          {
1903 kumpf          1.265         String serviceName;
1904                              String controlProviderName;
1905 brian.campbell 1.189         ProviderInfo pi(classNames[i]);
1906 kumpf          1.262         ProviderIdContainer* container=NULL;
1907 brian.campbell 1.189 
1908                              // We use the returned classname for the association classname
1909                              // under the assumption that the registration is for the
1910                              // association class, not the target class
1911 kumpf          1.262         if (_lookupNewAssociationProvider(nameSpace, classNames[i],
1912 brian.campbell 1.189             serviceName, controlProviderName,&container))
1913                              {
1914                                  //CDEBUG("LookupNew return. Class = " <<   classNames[i]);
1915                                  pi.serviceName = serviceName;
1916                                  pi.controlProviderName = controlProviderName;
1917                                  pi.hasProvider = true;
1918 kumpf          1.226             pi.providerIdContainer.reset(container);
1919 brian.campbell 1.189             providerCount++;
1920 kumpf          1.262             CDEBUG("Found Association Provider for class = " <<
1921                                      classNames[i].getString());
1922 brian.campbell 1.189 
1923 kumpf          1.262             // ATTN: Do not need this trace.  The _LookupNewAssoc Function
1924                                  // should handle it.
1925 brian.campbell 1.189             PEG_TRACE_STRING(TRC_DISPATCHER, Tracer::LEVEL4,
1926                                      "Provider found for Class = " + classNames[i].getString() +
1927                                          " servicename = " + serviceName +
1928                                          " controlProviderName = " +
1929                                          ((controlProviderName.size()) ? controlProviderName
1930                                                                        : String("None")));
1931 kumpf          1.262             CDEBUG("Found Assoc wo Provider for class= " <<
1932                                      classNames[i].getString());
1933 brian.campbell 1.189         }
1934                              else
1935                              {
1936                                  pi.hasProvider = false;
1937                                  pi.providerIdContainer.reset();
1938                              }
1939                              providerInfoList.append(pi);
1940                          }
1941 kumpf          1.262     CDEBUG("_lookupAllAssocProvider rtns count = " <<
1942                              providerInfoList.size() << " providerCount= " << providerCount);
1943 brian.campbell 1.189     PEG_METHOD_EXIT();
1944 kumpf          1.262     return providerInfoList;
1945 brian.campbell 1.189 }
1946                      
1947 kumpf          1.262 /* _lookupNewAssociationProvider - Looks up the internal and/or instance
1948                          provider for the defined namespace and class and returns the serviceName
1949                          and control provider name if a provider is found.
1950 brian.campbell 1.189     @param nameSpace
1951                          @param assocClass
1952                          @param serviceName
1953                          @param controlProviderName
1954                          @return true if an service, control provider, or instance provider is found
1955                          for the defined class and namespace.
1956                          This should be combined with the lookupInstanceProvider code eventually but
1957                          the goal now was to simplify the handlers.
1958                      */
1959                      Boolean CIMOperationRequestDispatcher::_lookupNewAssociationProvider(
1960 kumpf          1.226     const CIMNamespaceName& nameSpace,
1961                          const CIMName& assocClass,
1962                          String& serviceName,
1963                          String& controlProviderName,
1964 kumpf          1.262     ProviderIdContainer** providerIdContainer)
1965 brian.campbell 1.189 {
1966                          PEG_METHOD_ENTER(TRC_DISPATCHER,
1967                              "CIMOperationRequestDispatcher::_lookupNewAssociationProvider");
1968 kumpf          1.262     PEG_TRACE_STRING(TRC_DISPATCHER, Tracer::LEVEL4,
1969                              "assocClass = " + assocClass.getString());
1970 brian.campbell 1.189 
1971 kumpf          1.262     Boolean hasProvider = false;
1972 kumpf          1.265     String providerName;
1973 kumpf          1.262     // Check for class provided by an internal provider
1974                          if (_lookupInternalProvider(
1975                                  nameSpace, assocClass, serviceName, controlProviderName))
1976                              hasProvider = true;
1977                          else
1978                          {
1979                              // get provider for class. Note that we reduce it from
1980                              // Multiple possible class names to a single one here.
1981                              // This is a hack.  Clean up later
1982                              Array<String> tmp;
1983                              CIMException cimException;
1984                              try
1985                              {
1986                                  tmp = _lookupAssociationProvider(
1987                                      nameSpace, assocClass,providerIdContainer);
1988                              }
1989                              catch (const CIMException&)
1990                              {
1991                                  PEG_METHOD_EXIT();
1992                                  throw;
1993                              }
1994 kumpf          1.262         catch (const Exception& exception)
1995                              {
1996                                  cimException =
1997                                      PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED, exception.getMessage());
1998                              }
1999                              catch (...)
2000                              {
2001                                  cimException = PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED, String::EMPTY);
2002                              }
2003 brian.campbell 1.189 
2004 kumpf          1.262         if (tmp.size() > 0)
2005                              {
2006                                  providerName = tmp[0];
2007                              }
2008                          }
2009 brian.campbell 1.189 
2010 kumpf          1.262     if (providerName != String::EMPTY)
2011                          {
2012                              serviceName = PEGASUS_QUEUENAME_PROVIDERMANAGER_CPP;
2013                              hasProvider = true;
2014                          }
2015                          PEG_TRACE_STRING(TRC_DISPATCHER, Tracer::LEVEL4,
2016                              "Lookup Provider = " + serviceName + " provider " + providerName +
2017                                  " found." + " return = " + (hasProvider? "true" : "false"));
2018 brian.campbell 1.189 
2019 kumpf          1.262     PEG_METHOD_EXIT();
2020                          return hasProvider;
2021 brian.campbell 1.189 }
2022                      
2023                      // Lookup the Association provider(s) for this class and convert the
2024                      // result to an array of providernames.
2025                      // NOTE: The code allows for multiple providers but there is no reason
2026                      // to have this until we really support multiple providers per class.
2027                      // The multiple provider code was here because there was some code in to
2028                      // do the lookup in provider registration which was removed. Some day we
2029                      // will support multiple providers per class so it was logical to just leave
2030                      // the multiple provider code in place.
2031                      // NOTE: assocClass and resultClass are optional
2032                      //
2033                      Array<String> CIMOperationRequestDispatcher::_lookupAssociationProvider(
2034                         const CIMNamespaceName& nameSpace,
2035 kumpf          1.262    const CIMName& assocClass,
2036                         ProviderIdContainer** providerIdContainer)
2037 brian.campbell 1.189 {
2038 kumpf          1.262     // instances of the provider class and provider module class for the
2039                          // response
2040 brian.campbell 1.189     Array<CIMInstance> pInstances; // Providers
2041                          Array<CIMInstance> pmInstances; // ProviderModules
2042                      
2043                          Array<String> providerNames;
2044                          String providerName;
2045                      
2046                          PEG_METHOD_ENTER(TRC_DISPATCHER,
2047                              "CIMOperationRequestDispatcher::_lookupAssociationProvider");
2048                          // Isolate the provider names from the response and return list of providers
2049                          Boolean returnValue = false;
2050                          CIMException cimException;
2051                          try
2052                          {
2053 kumpf          1.262         CDEBUG("_lookupAssociationProvider. assocClass= " <<
2054                                  assocClass.getString());
2055 brian.campbell 1.189         returnValue = _providerRegistrationManager->lookupAssociationProvider(
2056                                      nameSpace, assocClass, pInstances, pmInstances);
2057                          }
2058 kumpf          1.262     catch (const CIMException& exception)
2059 brian.campbell 1.189     {
2060 kumpf          1.262         cimException = exception;
2061 brian.campbell 1.189     }
2062 kumpf          1.262     catch (const Exception& exception)
2063 brian.campbell 1.189     {
2064 kumpf          1.262         cimException =
2065                                  PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED, exception.getMessage());
2066 brian.campbell 1.189     }
2067 kumpf          1.262     catch (...)
2068 brian.campbell 1.189     {
2069 kumpf          1.262         cimException = PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED, String::EMPTY);
2070 brian.campbell 1.189     }
2071                          if (returnValue)
2072                          {
2073 kumpf          1.262         for (Uint32 i = 0, n = pInstances.size(); i < n; i++)
2074 brian.campbell 1.189         {
2075 kumpf          1.262             // At present only one provider per class or per association is
2076                                  // supported and the same provider is stored in the
2077                                  // providerIdContainer. So the array will actually have only one
2078                                  // item. And hence with the same element providerIdContainer will
2079                                  // be created. When we start supporting multiple providers per
2080                                  // class or assoc, we need to change the code to make
2081                                  // providerIdContainer accordingly.
2082                                  if (i == 0)
2083 kumpf          1.226             {
2084 kumpf          1.262                 ProviderIdContainer* providercontainer;
2085 r.kieninger    1.197 #ifdef PEGASUS_ENABLE_REMOTE_CMPI
2086 kumpf          1.265                 String remoteInformation;
2087 kumpf          1.226                 Boolean isRemote=false;
2088 kumpf          1.262                 isRemote = _repository->isRemoteNameSpace(
2089                                          nameSpace, remoteInformation);
2090 kumpf          1.226                 if (isRemote)
2091 kumpf          1.262                     providercontainer = new ProviderIdContainer(
2092                                              pmInstances[i],
2093                                              pInstances[i],
2094                                              isRemote,
2095                                              remoteInformation);
2096                                      else
2097                                          providercontainer = new ProviderIdContainer(
2098                                              pmInstances[i],
2099                                              pInstances[i]);
2100 r.kieninger    1.197 #else
2101 kumpf          1.262                 providercontainer = new ProviderIdContainer(
2102                                          pmInstances[i],
2103                                          pInstances[i]);
2104 r.kieninger    1.197 #endif
2105 kumpf          1.262                 (*providerIdContainer) = providercontainer;
2106 kumpf          1.226             }
2107 brian.campbell 1.189             // get the provider name
2108                                  Uint32 pos = pInstances[i].findProperty(CIMName ("Name"));
2109                      
2110                                  if ( pos != PEG_NOT_FOUND )
2111                                  {
2112                                      pInstances[i].getProperty(pos).getValue().get(providerName);
2113                      
2114                                      PEG_TRACE_STRING(TRC_DISPATCHER, Tracer::LEVEL4,
2115 kumpf          1.262                     "Association providerName = " + providerName + " found." +
2116                                              " for Class " + assocClass.getString());
2117 brian.campbell 1.189                 providerNames.append(providerName);
2118                                  }
2119                              }
2120                          }
2121                      
2122                          if (providerNames.size() == 0)
2123                          {
2124                              PEG_TRACE_STRING(TRC_DISPATCHER, Tracer::LEVEL4,
2125                                  "Association Provider NOT found for Class " + assocClass.getString()
2126                                   + " in nameSpace " + nameSpace.getString());
2127                          }
2128                          PEG_METHOD_EXIT();
2129                          return providerNames;
2130                      }
2131                      
2132                      /*  Common Dispatcher callback for response aggregation.
2133                      */
2134                      void CIMOperationRequestDispatcher::_forwardForAggregationCallback(
2135 kumpf          1.262     AsyncOpNode* op,
2136                          MessageQueue* q,
2137                          void* userParameter)
2138 brian.campbell 1.189 {
2139                          PEG_METHOD_ENTER(TRC_DISPATCHER,
2140                              "CIMOperationRequestDispatcher::_forwardForAggregationCallback");
2141                      
2142 kumpf          1.262     CIMOperationRequestDispatcher* service =
2143                              static_cast<CIMOperationRequestDispatcher*>(q);
2144 brian.campbell 1.189 
2145 kumpf          1.262     AsyncRequest* asyncRequest = static_cast<AsyncRequest*>(op->getRequest());
2146                          AsyncReply* asyncReply = static_cast<AsyncReply*>(op->removeResponse());
2147 brian.campbell 1.189 
2148 kumpf          1.262     OperationAggregate* poA =
2149                              reinterpret_cast<OperationAggregate*>(userParameter);
2150 brian.campbell 1.189     PEGASUS_ASSERT(asyncRequest != 0);
2151                          PEGASUS_ASSERT(asyncReply != 0);
2152                          PEGASUS_ASSERT(poA != 0);
2153                      
2154                          // Verify that the aggregator is valid.
2155                          PEGASUS_ASSERT(poA->valid());
2156                          //CDEBUG("_ForwardForAggregationCallback ");
2157 kumpf          1.262     CIMResponseMessage* response = 0;
2158 brian.campbell 1.189 
2159                          Uint32 msgType = asyncReply->getType();
2160                      
2161                          if (msgType == async_messages::ASYNC_LEGACY_OP_RESULT)
2162                          {
2163 kumpf          1.262         response = reinterpret_cast<CIMResponseMessage*>(
2164                                  (static_cast<AsyncLegacyOperationResult*>(asyncReply))->
2165                                      get_result());
2166 brian.campbell 1.189     }
2167                          else if (msgType == async_messages::ASYNC_MODULE_OP_RESULT)
2168                          {
2169 kumpf          1.262         response = reinterpret_cast<CIMResponseMessage*>(
2170                                  (static_cast<AsyncModuleOperationResult*>(asyncReply))->
2171                                      get_result());
2172 brian.campbell 1.189     }
2173                          else
2174                          {
2175                              // Error
2176                          }
2177                      
2178                          PEGASUS_ASSERT(response != 0);
2179                          PEGASUS_ASSERT(response->messageId == poA->_messageId);
2180 kumpf          1.257     delete asyncReply;
2181 brian.campbell 1.189 
2182 kumpf          1.257     // Before resequencing, the isComplete() flag represents the completion
2183                          // status of one provider's response, not the entire response
2184 brian.campbell 1.189 
2185 kumpf          1.257     if (response->isComplete())
2186 kumpf          1.226     {
2187 kumpf          1.257         // these are per provider instantiations
2188                              op->removeRequest();
2189 kumpf          1.226         delete asyncRequest;
2190                              op->release();
2191                              service->return_op(op);
2192                          }
2193 brian.campbell 1.189 
2194 kumpf          1.226     // After resequencing, this flag represents the completion status of
2195                          // the ENTIRE response to the request.
2196 brian.campbell 1.189 
2197 kumpf          1.257     Boolean isComplete = service->_enqueueResponse(poA, response);
2198                      
2199 kumpf          1.262     if (isComplete)
2200 a.dunfey       1.250     {
2201                              // also deletes the copied request attached to it
2202                              delete poA;
2203                              poA = 0;
2204                          }
2205 brian.campbell 1.189 
2206                          PEG_METHOD_EXIT();
2207                      }
2208                      
2209                      
2210                      /*  Common Dispatcher callback.
2211                      */
2212                      void CIMOperationRequestDispatcher::_forwardRequestCallback(
2213 kumpf          1.262     AsyncOpNode* op,
2214                          MessageQueue* q,
2215                          void* userParameter)
2216 brian.campbell 1.189 {
2217                          PEG_METHOD_ENTER(TRC_DISPATCHER,
2218                              "CIMOperationRequestDispatcher::_forwardRequestCallback");
2219                      
2220 kumpf          1.262     CIMOperationRequestDispatcher* service =
2221                              static_cast<CIMOperationRequestDispatcher*>(q);
2222 brian.campbell 1.189 
2223 kumpf          1.262     AsyncRequest* asyncRequest =
2224                              static_cast<AsyncRequest*>(op->removeRequest());
2225                          AsyncReply* asyncReply = static_cast<AsyncReply*>(op->removeResponse());
2226 brian.campbell 1.189 
2227 kumpf          1.262     CIMRequestMessage* request =
2228 kumpf          1.259         reinterpret_cast<CIMRequestMessage*>(userParameter);
2229                          PEGASUS_ASSERT(request != 0);
2230                      
2231 kumpf          1.262     CIMResponseMessage* response = 0;
2232 brian.campbell 1.189 
2233                          Uint32 msgType = asyncReply->getType();
2234                      
2235 kumpf          1.262     if (msgType == async_messages::ASYNC_LEGACY_OP_RESULT)
2236 brian.campbell 1.189     {
2237 kumpf          1.262         response = reinterpret_cast<CIMResponseMessage*>(
2238                                  (static_cast<AsyncLegacyOperationResult*>(asyncReply))->
2239                                      get_result());
2240 brian.campbell 1.189     }
2241 kumpf          1.262     else if (msgType == async_messages::ASYNC_MODULE_OP_RESULT)
2242 brian.campbell 1.189     {
2243 kumpf          1.262         response = reinterpret_cast<CIMResponseMessage*>(
2244                                  (static_cast<AsyncModuleOperationResult*>(asyncReply))->
2245                                      get_result());
2246 brian.campbell 1.189     }
2247                          else
2248                          {
2249                              // Error
2250                          }
2251                      
2252                          PEGASUS_ASSERT(response != 0);
2253                      
2254 kumpf          1.226     Boolean isComplete = response->isComplete();
2255 brian.campbell 1.189 
2256 kumpf          1.259     service->_enqueueResponse(request, response);
2257 brian.campbell 1.189 
2258 kumpf          1.226     if (isComplete == true)
2259                          {
2260 kumpf          1.259         delete request;
2261 kumpf          1.226         delete asyncRequest;
2262                              delete asyncReply;
2263                              op->release();
2264                              service->return_op(op);
2265                          }
2266 brian.campbell 1.189 
2267                          PEG_METHOD_EXIT();
2268                      }
2269                      
2270                      
2271                      void CIMOperationRequestDispatcher::_forwardRequestToService(
2272                          const String& serviceName,
2273                          CIMRequestMessage* request,
2274 kumpf          1.259     CIMRequestMessage* requestCopy)
2275 brian.campbell 1.189 {
2276                          PEG_METHOD_ENTER(TRC_DISPATCHER,
2277                              "CIMOperationRequestDispatcher::_forwardRequestToService");
2278                      
2279                          Array<Uint32> serviceIds;
2280                          find_services(serviceName, 0, 0, &serviceIds);
2281                          PEGASUS_ASSERT(serviceIds.size() != 0);
2282                      
2283 kumpf          1.262     AsyncOpNode* op = this->get_op();
2284 brian.campbell 1.189 
2285 kumpf          1.262     AsyncLegacyOperationStart* asyncRequest =
2286 brian.campbell 1.189         new AsyncLegacyOperationStart(
2287 kumpf          1.226             op,
2288                                  serviceIds[0],
2289                                  request,
2290                                  this->getQueueId());
2291 brian.campbell 1.189 
2292                          asyncRequest->dest = serviceIds[0];
2293                      
2294                          PEG_TRACE_STRING(TRC_DISPATCHER, Tracer::LEVEL3,
2295                              "Forwarding " + String(MessageTypeToString(request->getType())) +
2296 kumpf          1.262             " to service " + serviceName + ". Response should go to queue " +
2297                                  ((MessageQueue::lookup(request->queueIds.top())) ?
2298                                      String(((MessageQueue::lookup(
2299                                          request->queueIds.top()))->getQueueName()) ) :
2300                                      String("BAD queue name")));
2301                      
2302                          SendAsync(
2303                              op,
2304                              serviceIds[0],
2305                              CIMOperationRequestDispatcher::_forwardRequestCallback,
2306                              this,
2307                              requestCopy);
2308 brian.campbell 1.189 
2309                          PEG_METHOD_EXIT();
2310                      }
2311                      
2312                      /* This function simply decides based on the controlProviderNameField
2313                          whether to forward to Service or ControlProvider.
2314                          If controlProviderName String empty, ToService, else toControlProvider.
2315                          This function specifically forwards requests for response aggregation.
2316                      */
2317                      void CIMOperationRequestDispatcher::_forwardRequestForAggregation(
2318                          const String& serviceName,
2319                          const String& controlProviderName,
2320                          CIMRequestMessage* request,
2321 kumpf          1.262     OperationAggregate* poA,
2322                          CIMResponseMessage* response)
2323 brian.campbell 1.189 {
2324 chip           1.219     PEG_METHOD_ENTER(
2325                              TRC_DISPATCHER,
2326 brian.campbell 1.189         "CIMOperationRequestDispatcher::_forwardRequestForAggregation");
2327 chip           1.219 
2328 brian.campbell 1.189     Array<Uint32> serviceIds;
2329                          find_services(serviceName, 0, 0, &serviceIds);
2330                          PEGASUS_ASSERT(serviceIds.size() != 0);
2331 chip           1.219 
2332 brian.campbell 1.189     //CDEBUG("ForwardRequestForAggregation");
2333 kumpf          1.262     AsyncOpNode* op = this->get_op();
2334 brian.campbell 1.189 
2335 kumpf          1.226     // if a response is given, this means the caller wants to run only the
2336                          // callback asynchronously
2337                          if (response)
2338                          {
2339 kumpf          1.262         AsyncLegacyOperationResult* asyncResponse =
2340 kumpf          1.251             new AsyncLegacyOperationResult(
2341 kumpf          1.253                 op, response);
2342 kumpf          1.226 
2343                              // By setting this to complete, this allows ONLY the callback to run
2344                              // without going through the typical async request apparatus
2345                              op->complete();
2346                          }
2347 brian.campbell 1.189 
2348                          // If ControlProviderName empty, forward to service.
2349                          if (controlProviderName == String::EMPTY)
2350                          {
2351 kumpf          1.262         AsyncLegacyOperationStart* asyncRequest =
2352 kumpf          1.226             new AsyncLegacyOperationStart(
2353                                      op,
2354                                      serviceIds[0],
2355                                      request,
2356                                      this->getQueueId());
2357 brian.campbell 1.189 
2358                              PEG_TRACE_STRING(TRC_DISPATCHER, Tracer::LEVEL3,
2359                                  "Forwarding " + String(MessageTypeToString(request->getType())) +
2360 kumpf          1.262                 " to service " + serviceName +
2361                                      ". Response should go to queue " +
2362                                      ((MessageQueue::lookup(request->queueIds.top())) ?
2363                                          String(((MessageQueue::lookup(
2364                                              request->queueIds.top()))->getQueueName())) :
2365                                          String("BAD queue name")));
2366 brian.campbell 1.189 
2367 kumpf          1.262         SendAsync(
2368                                  op,
2369                                  serviceIds[0],
2370                                  CIMOperationRequestDispatcher::_forwardForAggregationCallback,
2371                                  this,
2372                                  poA);
2373 brian.campbell 1.189     }
2374                          else
2375                          {
2376 kumpf          1.262        AsyncModuleOperationStart* moduleControllerRequest =
2377 kumpf          1.226            new AsyncModuleOperationStart(
2378                                     op,
2379                                     serviceIds[0],
2380                                     this->getQueueId(),
2381                                     true,
2382                                     controlProviderName,
2383                                     request);
2384 brian.campbell 1.189 
2385                              PEG_TRACE_STRING(TRC_DISPATCHER, Tracer::LEVEL3,
2386                                  "Forwarding " + String(MessageTypeToString(request->getType())) +
2387 kumpf          1.262                 " to service " + serviceName + ", control provider " +
2388                                      controlProviderName + ". Response should go to queue " +
2389                                      ((MessageQueue::lookup(request->queueIds.top())) ?
2390                                          String(((MessageQueue::lookup(
2391                                              request->queueIds.top()))->getQueueName())) :
2392                                      String("BAD queue name")));
2393                      
2394                             SendAsync(
2395                                 op,
2396                                 serviceIds[0],
2397                                 CIMOperationRequestDispatcher::_forwardForAggregationCallback,
2398                                 this,
2399                                 poA);
2400 brian.campbell 1.189     }
2401                      
2402                          PEG_METHOD_EXIT();
2403                      }
2404                      
2405                      /** _forwardRequestToProviderManager
2406                          This function decides based on the controlProviderNameField
2407                          whether to forward to Service or ControlProvider.
2408                          If controlProviderName String empty,
2409                                 ForwardToService,
2410                             else
2411                                 ForwardtoControlProvider
2412                          Convience coding to simplify other functions.
2413                      */
2414                      void CIMOperationRequestDispatcher::_forwardRequestToProviderManager(
2415                          const CIMName& className,        // only for diagnostic
2416                          const String& serviceName,
2417                          const String& controlProviderName,
2418 kumpf          1.259     CIMRequestMessage* request,
2419                          CIMRequestMessage* requestCopy)
2420 brian.campbell 1.189 {
2421                          PEG_METHOD_ENTER(TRC_DISPATCHER,
2422                              "CIMOperationRequestDispatcher::_forwardRequestToProviderManager");
2423                      
2424                          Array<Uint32> serviceIds;
2425                          find_services(serviceName, 0, 0, &serviceIds);
2426                          PEGASUS_ASSERT(serviceIds.size() != 0);
2427                      
2428 kumpf          1.262     AsyncOpNode* op = this->get_op();
2429 brian.campbell 1.189 
2430                          // If ControlProviderName empty, forward to service.
2431                          if (controlProviderName == String::EMPTY)
2432                          {
2433 kumpf          1.262         AsyncLegacyOperationStart* asyncRequest =
2434 kumpf          1.226             new AsyncLegacyOperationStart(
2435                                      op,
2436                                      serviceIds[0],
2437                                      request,
2438                                      this->getQueueId());
2439 brian.campbell 1.189 
2440 kumpf          1.226         asyncRequest->dest = serviceIds[0];
2441 brian.campbell 1.189 
2442                              PEG_TRACE_STRING(TRC_DISPATCHER, Tracer::LEVEL3,
2443                                  "Forwarding " + String(MessageTypeToString(request->getType())) +
2444 kumpf          1.262                 " on class " + className.getString() + " to service " +
2445                                      serviceName + ". Response should go to queue " +
2446                                      ((MessageQueue::lookup(request->queueIds.top())) ?
2447                                          String(((MessageQueue::lookup(
2448                                              request->queueIds.top()))->getQueueName())) :
2449                                          String("BAD queue name")));
2450 brian.campbell 1.189 
2451 kumpf          1.262         SendAsync(
2452                                  op,
2453                                  serviceIds[0],
2454                                  CIMOperationRequestDispatcher::_forwardRequestCallback,
2455                                  this,
2456                                  requestCopy);
2457 brian.campbell 1.189     }
2458                          else
2459                          {
2460 kumpf          1.262         AsyncModuleOperationStart* moduleControllerRequest =
2461                                  new AsyncModuleOperationStart(
2462                                      op,
2463                                      serviceIds[0],
2464                                      this->getQueueId(),
2465                                      true,
2466                                      controlProviderName,
2467                                      request);
2468 brian.campbell 1.189 
2469                              PEG_TRACE_STRING(TRC_DISPATCHER, Tracer::LEVEL3,
2470                                  "Forwarding " + String(MessageTypeToString(request->getType())) +
2471 kumpf          1.262                 " on class " + className.getString() + " to service " +
2472                                      serviceName + ", control provider " + controlProviderName +
2473                                      ". Response should go to queue " +
2474                                          ((MessageQueue::lookup(request->queueIds.top())) ?
2475                                              String(((MessageQueue::lookup(
2476                                                  request->queueIds.top()))->getQueueName())) :
2477                                              String("BAD queue name")));
2478 brian.campbell 1.189 
2479                             // Send to the Control provider
2480 kumpf          1.262        SendAsync(
2481                                 op,
2482                                 serviceIds[0],
2483                                 CIMOperationRequestDispatcher::_forwardRequestCallback,
2484                                 this,
2485                                 requestCopy);
2486 brian.campbell 1.189     }
2487                      
2488                          PEG_METHOD_EXIT();
2489                      }
2490                      
2491                      void CIMOperationRequestDispatcher::_enqueueResponse(
2492                         CIMRequestMessage* request,
2493                         CIMResponseMessage* response)
2494                      {
2495 kumpf          1.262     PEG_METHOD_ENTER(TRC_DISPATCHER,
2496                              "CIMOperationRequestDispatcher::_enqueueResponse");
2497 brian.campbell 1.189 
2498 kumpf          1.262     response->dest = request->queueIds.top();
2499                          // Use the same key,setHTTPMethod and closeConnect as used in the request:
2500                          response->syncAttributes(request);
2501 marek          1.264     PEG_TRACE((
2502 kumpf          1.262         TRC_HTTP,
2503                              Tracer::LEVEL3,
2504                              "_CIMOperationRequestDispatcher::_enqueueResponse - "
2505                                  "request->getCloseConnect() returned %d",
2506 marek          1.264         request->getCloseConnect()));
2507 brian.campbell 1.189 
2508 kumpf          1.262     _logOperation(request, response);
2509 kumpf          1.259 
2510 kumpf          1.262     if (Base::_enqueueResponse(request, response))
2511                          {
2512                              PEG_METHOD_EXIT();
2513                              return;
2514                          }
2515 brian.campbell 1.189 
2516 kumpf          1.262     MessageQueue* queue = MessageQueue::lookup(request->queueIds.top());
2517                          PEGASUS_ASSERT(queue != 0);
2518 brian.campbell 1.189 
2519 kumpf          1.262     queue->enqueue(response);
2520 brian.campbell 1.189 
2521 kumpf          1.262     PEG_METHOD_EXIT();
2522 brian.campbell 1.189 }
2523                      
2524 kumpf          1.262 void CIMOperationRequestDispatcher::handleEnqueue(Message* request)
2525 brian.campbell 1.189 {
2526 kumpf          1.267     PEGASUS_DEBUG_ASSERT(request->magic);
2527                      
2528 kumpf          1.262     PEG_METHOD_ENTER(TRC_DISPATCHER,
2529                              "CIMOperationRequestDispatcher::handleEnqueue(Message* request)");
2530                          if (!request)
2531                          {
2532                              PEG_METHOD_EXIT();
2533                              return;
2534                          }
2535                      
2536                          PEG_LOGGER_TRACE((Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE,
2537                              "CIMOperationRequestDispatcher::handleEnqueue - Case: $0",
2538                              request->getType()));
2539 brian.campbell 1.189 
2540 kumpf          1.262     // Set the client's requested language into this service thread.
2541                          // This will allow functions in this service to return messages
2542                          // in the correct language.
2543                          CIMMessage* req = dynamic_cast<CIMMessage*>(request);
2544                          if (req != NULL)
2545                          {
2546 kumpf          1.226         if (req->thread_changed())
2547 brian.campbell 1.189         {
2548 kumpf          1.262             Thread::setLanguages(new AcceptLanguageList(
2549                                      ((AcceptLanguageListContainer)req->operationContext.get(
2550                                          AcceptLanguageListContainer::NAME)).getLanguages()));
2551 kumpf          1.226         }
2552 kumpf          1.262     }
2553                          else
2554                          {
2555                               Thread::clearLanguages();
2556                          }
2557                      
2558                          switch(request->getType())
2559                          {
2560                              case CIM_GET_CLASS_REQUEST_MESSAGE:
2561                                  handleGetClassRequest((CIMGetClassRequestMessage*)request);
2562                                  break;
2563                      
2564                              case CIM_GET_INSTANCE_REQUEST_MESSAGE:
2565                                  handleGetInstanceRequest((CIMGetInstanceRequestMessage*)request);
2566                                  break;
2567                      
2568                              case CIM_DELETE_CLASS_REQUEST_MESSAGE:
2569                                  handleDeleteClassRequest(
2570                                      (CIMDeleteClassRequestMessage*)request);
2571                                  break;
2572                      
2573 kumpf          1.262         case CIM_DELETE_INSTANCE_REQUEST_MESSAGE:
2574                                  handleDeleteInstanceRequest(
2575                                      (CIMDeleteInstanceRequestMessage*)request);
2576                                  break;
2577                      
2578                              case CIM_CREATE_CLASS_REQUEST_MESSAGE:
2579                                  handleCreateClassRequest((CIMCreateClassRequestMessage*)request);
2580                                  break;
2581                      
2582                              case CIM_CREATE_INSTANCE_REQUEST_MESSAGE:
2583                                  handleCreateInstanceRequest(
2584                                      (CIMCreateInstanceRequestMessage*)request);
2585                                  break;
2586                      
2587                              case CIM_MODIFY_CLASS_REQUEST_MESSAGE:
2588                                  handleModifyClassRequest((CIMModifyClassRequestMessage*)request);
2589                                  break;
2590                      
2591                              case CIM_MODIFY_INSTANCE_REQUEST_MESSAGE:
2592                                  handleModifyInstanceRequest(
2593                                      (CIMModifyInstanceRequestMessage*)request);
2594 kumpf          1.262             break;
2595                      
2596                              case CIM_ENUMERATE_CLASSES_REQUEST_MESSAGE:
2597                                  handleEnumerateClassesRequest(
2598                                      (CIMEnumerateClassesRequestMessage*)request);
2599                                  break;
2600                      
2601                              case CIM_ENUMERATE_CLASS_NAMES_REQUEST_MESSAGE:
2602                                  handleEnumerateClassNamesRequest(
2603                                      (CIMEnumerateClassNamesRequestMessage*)request);
2604                                  break;
2605                      
2606                              case CIM_ENUMERATE_INSTANCES_REQUEST_MESSAGE:
2607                                  handleEnumerateInstancesRequest(
2608                                      (CIMEnumerateInstancesRequestMessage*)request);
2609                                  break;
2610                      
2611                              case CIM_ENUMERATE_INSTANCE_NAMES_REQUEST_MESSAGE:
2612                                  handleEnumerateInstanceNamesRequest(
2613                                      (CIMEnumerateInstanceNamesRequestMessage*)request);
2614                                  break;
2615 kumpf          1.262 
2616                              case CIM_EXEC_QUERY_REQUEST_MESSAGE:
2617                                  handleExecQueryRequest(
2618                                      (CIMExecQueryRequestMessage*)request);
2619                                  break;
2620                      
2621                              case CIM_ASSOCIATORS_REQUEST_MESSAGE:
2622                                  handleAssociatorsRequest((CIMAssociatorsRequestMessage*)request);
2623                                  break;
2624                      
2625                              case CIM_ASSOCIATOR_NAMES_REQUEST_MESSAGE:
2626                                  handleAssociatorNamesRequest(
2627                                      (CIMAssociatorNamesRequestMessage*)request);
2628                                  break;
2629                      
2630                              case CIM_REFERENCES_REQUEST_MESSAGE:
2631                                  handleReferencesRequest((CIMReferencesRequestMessage*)request);
2632                                  break;
2633                      
2634                              case CIM_REFERENCE_NAMES_REQUEST_MESSAGE:
2635                                  handleReferenceNamesRequest(
2636 kumpf          1.262                 (CIMReferenceNamesRequestMessage*)request);
2637                                  break;
2638                      
2639                              case CIM_GET_PROPERTY_REQUEST_MESSAGE:
2640                                  handleGetPropertyRequest(
2641                                      (CIMGetPropertyRequestMessage*)request);
2642                                  break;
2643                      
2644                              case CIM_SET_PROPERTY_REQUEST_MESSAGE:
2645                                  handleSetPropertyRequest(
2646                                      (CIMSetPropertyRequestMessage*)request);
2647                                  break;
2648                      
2649                              case CIM_GET_QUALIFIER_REQUEST_MESSAGE:
2650                                  handleGetQualifierRequest((CIMGetQualifierRequestMessage*)request);
2651                                  break;
2652                      
2653                              case CIM_SET_QUALIFIER_REQUEST_MESSAGE:
2654                                  handleSetQualifierRequest((CIMSetQualifierRequestMessage*)request);
2655                                  break;
2656                      
2657 kumpf          1.262         case CIM_DELETE_QUALIFIER_REQUEST_MESSAGE:
2658                                  handleDeleteQualifierRequest(
2659                                      (CIMDeleteQualifierRequestMessage*)request);
2660                                  break;
2661 brian.campbell 1.189 
2662 kumpf          1.262         case CIM_ENUMERATE_QUALIFIERS_REQUEST_MESSAGE:
2663                                  handleEnumerateQualifiersRequest(
2664                                      (CIMEnumerateQualifiersRequestMessage*)request);
2665                                  break;
2666 brian.campbell 1.189 
2667 kumpf          1.262         case CIM_INVOKE_METHOD_REQUEST_MESSAGE:
2668                                  handleInvokeMethodRequest(
2669                                      (CIMInvokeMethodRequestMessage*)request);
2670                                  break;
2671 brian.campbell 1.189 
2672 kumpf          1.262        default:
2673                                 Logger::put_l(
2674                                     Logger::ERROR_LOG, System::CIMSERVER, Logger::SEVERE,
2675                                     "Server.CIMOperationRequestDispatcher.HANDLE_ENQUEUE",
2676                                     "$0 - Case: $1 not valid",
2677                                     "CIMOperationRequestDispatcher::handleEnqueue",
2678                                     request->getType());
2679                           }
2680 brian.campbell 1.189 
2681 kumpf          1.262      delete request;
2682                           PEG_METHOD_EXIT();
2683 brian.campbell 1.189 }
2684                      
2685                      // allocate a CIM Operation_async,  opnode, context, and response handler
2686                      // initialize with pointers to async top and async bottom
2687                      // link to the waiting q
2688                      void CIMOperationRequestDispatcher::handleEnqueue()
2689                      {
2690 kumpf          1.262     PEG_METHOD_ENTER(TRC_DISPATCHER,
2691                              "CIMOperationRequestDispatcher::handleEnqueue");
2692 brian.campbell 1.189 
2693 kumpf          1.262     Message* request = dequeue();
2694 brian.campbell 1.189 
2695 kumpf          1.262     if (request)
2696                              handleEnqueue(request);
2697 brian.campbell 1.189 
2698 kumpf          1.262     PEG_METHOD_EXIT();
2699 brian.campbell 1.189 }
2700                      
2701                      /**$*******************************************************
2702                          handleGetClassRequest
2703                      **********************************************************/
2704                      
2705                      void CIMOperationRequestDispatcher::handleGetClassRequest(
2706 kumpf          1.262     CIMGetClassRequestMessage* request)
2707 brian.campbell 1.189 {
2708 kumpf          1.262     PEG_METHOD_ENTER(TRC_DISPATCHER,
2709                              "CIMOperationRequestDispatcher::handleGetClassRequest");
2710 brian.campbell 1.189 
2711 kumpf          1.262     AutoPtr<CIMGetClassResponseMessage> response(
2712                              dynamic_cast<CIMGetClassResponseMessage*>(
2713                                  request->buildResponse()));
2714 brian.campbell 1.189 
2715 kumpf          1.262     // ATTN: Need code here to expand partial class!
2716 brian.campbell 1.189 
2717 kumpf          1.262     CIMException cimException;
2718                          CIMClass cimClass;
2719 brian.campbell 1.189 
2720 kumpf          1.262     try
2721                          {
2722                              StatProviderTimeMeasurement providerTime(response.get());
2723                      
2724                              cimClass = _repository->getClass(
2725                                  request->nameSpace,
2726                                  request->className,
2727                                  request->localOnly,
2728                                  request->includeQualifiers,
2729                                  request->includeClassOrigin,
2730                                  request->propertyList);
2731 kumpf          1.256 
2732 kumpf          1.262         PEG_LOGGER_TRACE((
2733                                  Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE,
2734                                  "CIMOperationRequestDispatcher::handleGetClassRequest - "
2735                                      "Namespace: $0  Class name: $1",
2736                                  request->nameSpace.getString(),
2737                                  request->className.getString()));
2738                          }
2739                          catch (const CIMException& exception)
2740                          {
2741                              cimException = exception;
2742                          }
2743                          catch (const Exception& exception)
2744                          {
2745                              cimException =
2746                                  PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED, exception.getMessage());
2747                          }
2748                          catch (...)
2749                          {
2750                              cimException = PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED, String::EMPTY);
2751                          }
2752 brian.campbell 1.189 
2753 kumpf          1.262     response->cimClass = cimClass;
2754                          response->cimException = cimException;
2755 brian.campbell 1.189 
2756 kumpf          1.262     _enqueueResponse(request, response.release());
2757                          PEG_METHOD_EXIT();
2758 brian.campbell 1.189 }
2759                      
2760                      /**$*******************************************************
2761                          handleGetInstanceRequest
2762                      **********************************************************/
2763                      
2764                      void CIMOperationRequestDispatcher::handleGetInstanceRequest(
2765 kumpf          1.262     CIMGetInstanceRequestMessage* request)
2766 brian.campbell 1.189 {
2767 kumpf          1.262     PEG_METHOD_ENTER(TRC_DISPATCHER,
2768                              "CIMOperationRequestDispatcher::handleGetInstanceRequest");
2769 brian.campbell 1.189 
2770 kumpf          1.262     // ATTN: Need code here to expand partial instance!
2771 brian.campbell 1.189 
2772 kumpf          1.262     // get the class name
2773                          CIMName className = request->instanceName.getClassName();
2774                          CIMException checkClassException;
2775 brian.campbell 1.189 
2776 kumpf          1.262     CIMClass cimClass =
2777                              _getClass(
2778                                  request->nameSpace,
2779                                  className,
2780                                  checkClassException);
2781 brian.campbell 1.189 
2782 kumpf          1.262     if (checkClassException.getCode() != CIM_ERR_SUCCESS)
2783                          {
2784                              PEG_LOGGER_TRACE((
2785                                  Logger::STANDARD_LOG,
2786                                  System::CIMSERVER,
2787                                  Logger::TRACE,
2788                                  "CIMOperationRequestDispatcher::handleGetInstanceRequest - "
2789                                      "CIM exist exception has occurred.  Namespace: $0  "
2790                                      "Class Name: $1",
2791                                  request->nameSpace.getString(),
2792                                  className.getString()));
2793 brian.campbell 1.189 
2794 kumpf          1.262         CIMResponseMessage* response = request->buildResponse();
2795                              response->cimException = checkClassException;
2796 brian.campbell 1.189 
2797 kumpf          1.262         _enqueueResponse(request, response);
2798 chip           1.217 
2799 kumpf          1.262         PEG_METHOD_EXIT();
2800                              return;
2801                          }
2802 chip           1.217 
2803 kumpf          1.262     //String serviceName;
2804                          //String controlProviderName;
2805                          //ProviderIdContainer* providerIdContainer = 0;
2806 brian.campbell 1.189 
2807 kumpf          1.262     ProviderInfo providerInfo =
2808                              _lookupNewInstanceProvider(
2809                                  request->nameSpace,
2810                                  className);
2811 chip           1.217 
2812 kumpf          1.262     if (providerInfo.hasProvider)
2813                          {
2814                              CIMGetInstanceRequestMessage* requestCopy =
2815                                  new CIMGetInstanceRequestMessage(*request);
2816 chip           1.217 
2817 kumpf          1.262         if (providerInfo.providerIdContainer.get() != 0)
2818                              {
2819                                  requestCopy->operationContext.insert(
2820                                      *providerInfo.providerIdContainer.get());
2821 brian.campbell 1.189 
2822 kumpf          1.262             //delete providerIdContainer;
2823                                  //providerIdContainer = 0;
2824                              }
2825 brian.campbell 1.189 
2826 kumpf          1.226 #ifdef PEGASUS_ENABLE_OBJECT_NORMALIZATION
2827 kumpf          1.262         if (_enableNormalization && providerInfo.hasProviderNormalization)
2828                              {
2829                                  requestCopy->operationContext.insert(
2830                                      CachedClassDefinitionContainer(cimClass));
2831                              }
2832 kumpf          1.226 #endif
2833 chip           1.202 
2834 kumpf          1.262         CIMGetInstanceRequestMessage* requestCallbackCopy =
2835                                  new CIMGetInstanceRequestMessage(*requestCopy);
2836 kumpf          1.259 
2837 kumpf          1.262         _forwardRequestToProviderManager(
2838                                  providerInfo.className,
2839                                  providerInfo.serviceName,
2840                                  providerInfo.controlProviderName,
2841                                  requestCopy,
2842                                  requestCallbackCopy);
2843 brian.campbell 1.189 
2844 kumpf          1.262          PEG_METHOD_EXIT();
2845                               return;
2846                          }
2847 chip           1.217 
2848 kumpf          1.262     // not internal or found provider, go to default
2849                          AutoPtr<CIMGetInstanceResponseMessage> response(
2850                              dynamic_cast<CIMGetInstanceResponseMessage*>(
2851                                  request->buildResponse()));
2852 brian.campbell 1.189 
2853 kumpf          1.262     if (_repository->isDefaultInstanceProvider())
2854                          {
2855                              CIMException cimException;
2856                              CIMInstance cimInstance;
2857 kumpf          1.256 
2858 kumpf          1.262         try
2859                              {
2860                                  StatProviderTimeMeasurement providerTime(response.get());
2861 brian.campbell 1.189 
2862 kumpf          1.262             cimInstance =
2863                                      _repository->getInstance(
2864                                          request->nameSpace,
2865                                          request->instanceName,
2866                                          request->localOnly,
2867                                          request->includeQualifiers,
2868                                          request->includeClassOrigin,
2869                                          request->propertyList);
2870                              }
2871                              catch (const CIMException& exception)
2872                              {
2873                                  cimException = exception;
2874                              }
2875                              catch (const Exception& exception)
2876                              {
2877                                  cimException =
2878                                      PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED, exception.getMessage());
2879                              }
2880                              catch (...)
2881                              {
2882                                  cimException = PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED, String::EMPTY);
2883 kumpf          1.262         }
2884 kumpf          1.256 
2885 kumpf          1.262         response->cimInstance = cimInstance;
2886                              response->cimException = cimException;
2887 brian.campbell 1.189 
2888 kumpf          1.262         _enqueueResponse(request, response.release());
2889                          }
2890                          else // No provider is registered and the repository isn't the default
2891                          {
2892                              response->cimException =
2893                                  PEGASUS_CIM_EXCEPTION(CIM_ERR_NOT_SUPPORTED, String::EMPTY),
2894 brian.campbell 1.189 
2895 kumpf          1.262        _enqueueResponse(request, response.release());
2896                          }
2897 brian.campbell 1.189 
2898 kumpf          1.262     PEG_METHOD_EXIT();
2899                          return;
2900 brian.campbell 1.189 }
2901                      
2902                      /**$*******************************************************
2903                          handleDeleteClassRequest
2904                      **********************************************************/
2905                      
2906                      void CIMOperationRequestDispatcher::handleDeleteClassRequest(
2907 kumpf          1.262     CIMDeleteClassRequestMessage* request)
2908 brian.campbell 1.189 {
2909 kumpf          1.262     PEG_METHOD_ENTER(TRC_DISPATCHER,
2910                              "CIMOperationRequestDispatcher::handleDeleteClassRequest");
2911                      
2912                          AutoPtr<CIMDeleteClassResponseMessage> response(
2913                              dynamic_cast<CIMDeleteClassResponseMessage*>(
2914                                  request->buildResponse()));
2915 brian.campbell 1.189 
2916 kumpf          1.262     CIMException cimException;
2917 brian.campbell 1.189 
2918 kumpf          1.262     try
2919                          {
2920                              StatProviderTimeMeasurement providerTime(response.get());
2921 brian.campbell 1.189 
2922 kumpf          1.262         _repository->deleteClass(
2923                                  request->nameSpace,
2924                                  request->className);
2925 kumpf          1.256 
2926 kumpf          1.262         PEG_LOGGER_TRACE((
2927                                  Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE,
2928                                  "CIMOperationRequestDispatcher::handleDeleteClassRequest - "
2929                                      "Namespace: $0  Class Name: $1",
2930                                  request->nameSpace.getString(),
2931                                  request->className.getString()));
2932                          }
2933                          catch (const CIMException& exception)
2934                          {
2935                              cimException = exception;
2936                          }
2937                          catch (const Exception& exception)
2938                          {
2939                              cimException =
2940                                  PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED, exception.getMessage());
2941                          }
2942                          catch (...)
2943                          {
2944                              cimException = PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED, String::EMPTY);
2945                          }
2946 brian.campbell 1.189 
2947 kumpf          1.262     response->cimException = cimException;
2948 brian.campbell 1.189 
2949 kumpf          1.262     _enqueueResponse(request, response.release());
2950 brian.campbell 1.189 
2951 kumpf          1.262     PEG_METHOD_EXIT();
2952 brian.campbell 1.189 }
2953                      
2954                      /**$*******************************************************
2955                          handleDeleteInstanceRequest
2956                      **********************************************************/
2957                      
2958                      void CIMOperationRequestDispatcher::handleDeleteInstanceRequest(
2959 kumpf          1.262     CIMDeleteInstanceRequestMessage* request)
2960 brian.campbell 1.189 {
2961 kumpf          1.262     PEG_METHOD_ENTER(
2962                              TRC_DISPATCHER,
2963                              "CIMOperationRequestDispatcher::handleDeleteInstanceRequest");
2964 brian.campbell 1.189 
2965 kumpf          1.262     // get the class name
2966                          CIMName className = request->instanceName.getClassName();
2967 brian.campbell 1.189 
2968 kumpf          1.262     CIMException checkClassException;
2969 chip           1.217 
2970 kumpf          1.262     _checkExistenceOfClass(request->nameSpace, className, checkClassException);
2971 chip           1.217 
2972 kumpf          1.262     if (checkClassException.getCode() != CIM_ERR_SUCCESS)
2973                          {
2974                              PEG_LOGGER_TRACE((
2975                                  Logger::STANDARD_LOG,
2976                                  System::CIMSERVER,
2977                                  Logger::TRACE,
2978                                  "CIMOperationRequestDispatcher::handleDeleteInstanceRequest - "
2979                                      "CIM exist exception has occurred.  Namespace: $0  "
2980                                      "Class Name: $1",
2981                                  request->nameSpace.getString(),
2982                                  className.getString()));
2983 brian.campbell 1.189 
2984 kumpf          1.262         CIMResponseMessage* response = request->buildResponse();
2985                              response->cimException = checkClassException;
2986 chip           1.217 
2987 kumpf          1.262         _enqueueResponse(request, response);
2988 chip           1.217 
2989 kumpf          1.262         PEG_METHOD_EXIT();
2990                              return;
2991                          }
2992 chip           1.217 
2993 kumpf          1.262     //String serviceName;
2994                          //String controlProviderName;
2995                          //ProviderIdContainer* providerIdContainer = 0;
2996 brian.campbell 1.189 
2997 kumpf          1.262     ProviderInfo providerInfo =
2998                              _lookupNewInstanceProvider(
2999                                  request->nameSpace,
3000                                  className);
3001 brian.campbell 1.189 
3002 kumpf          1.262     if (providerInfo.hasProvider)
3003                          {
3004                              CIMDeleteInstanceRequestMessage* requestCopy =
3005                                  new CIMDeleteInstanceRequestMessage(*request);
3006 brian.campbell 1.189 
3007 kumpf          1.262         if (providerInfo.providerIdContainer.get() != 0)
3008                              {
3009                                  requestCopy->operationContext.insert(
3010                                      *providerInfo.providerIdContainer.get());
3011 brian.campbell 1.189 
3012 kumpf          1.262             //delete providerIdContainer;
3013                                  //providerIdContainer = 0;
3014                              }
3015 brian.campbell 1.189 
3016 kumpf          1.262         CIMDeleteInstanceRequestMessage* requestCallbackCopy =
3017                                  new CIMDeleteInstanceRequestMessage(*requestCopy);
3018 chip           1.217 
3019 kumpf          1.262         _forwardRequestToProviderManager(
3020                                  providerInfo.className,
3021                                  providerInfo.serviceName,
3022                                  providerInfo.controlProviderName,
3023                                  requestCopy,
3024                                  requestCallbackCopy);
3025 kumpf          1.259 
3026 kumpf          1.262         PEG_METHOD_EXIT();
3027                              return;
3028                          }
3029                          else if (_repository->isDefaultInstanceProvider())
3030                          {
3031                              AutoPtr<CIMDeleteInstanceResponseMessage> response(
3032                                  dynamic_cast<CIMDeleteInstanceResponseMessage*>(
3033                                      request->buildResponse()));
3034 chip           1.217 
3035 kumpf          1.262         CIMException cimException;
3036 chip           1.217 
3037 kumpf          1.262         try
3038                              {
3039                                  StatProviderTimeMeasurement providerTime(response.get());
3040 kumpf          1.256 
3041 kumpf          1.262             _repository->deleteInstance(
3042                                      request->nameSpace,
3043                                      request->instanceName);
3044 brian.campbell 1.189 
3045 kumpf          1.262             PEG_LOGGER_TRACE((
3046                                      Logger::STANDARD_LOG,
3047                                      System::CIMSERVER,
3048                                      Logger::TRACE,
3049                                      "CIMOperationRequestDispatcher::handleDeleteInstanceRequest - "
3050                                          "Namespace: $0  Instance Name: $1",
3051                                      request->nameSpace.getString(),
3052                                      request->instanceName.toString()));
3053                              }
3054                              catch (const CIMException& exception)
3055                              {
3056                                  cimException = exception;
3057                              }
3058                              catch (const Exception& exception)
3059                              {
3060                                  cimException =
3061                                      PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED, exception.getMessage());
3062                              }
3063                              catch (...)
3064                              {
3065                                  cimException = PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED, String::EMPTY);
3066 kumpf          1.262         }
3067 kumpf          1.256 
3068 kumpf          1.262         response->cimException = cimException;
3069 chip           1.217 
3070 kumpf          1.262         _enqueueResponse(request, response.release());
3071                          }
3072                          else // No provider is registered and the repository isn't the default
3073                          {
3074                              CIMResponseMessage* response = request->buildResponse();
3075                              response->cimException =
3076                                  PEGASUS_CIM_EXCEPTION(CIM_ERR_NOT_SUPPORTED, String::EMPTY),
3077 brian.campbell 1.189 
3078 kumpf          1.262         _enqueueResponse(request, response);
3079                          }
3080 brian.campbell 1.189 
3081 kumpf          1.262     PEG_METHOD_EXIT();
3082                          return;
3083 brian.campbell 1.189 }
3084                      
3085                      /**$*******************************************************
3086                          handleCreateClassRequest
3087                      **********************************************************/
3088                      
3089                      void CIMOperationRequestDispatcher::handleCreateClassRequest(
3090 kumpf          1.262     CIMCreateClassRequestMessage* request)
3091 brian.campbell 1.189 {
3092 kumpf          1.262     PEG_METHOD_ENTER(TRC_DISPATCHER,
3093                              "CIMOperationRequestDispatcher::handleCreateClassRequest");
3094                      
3095                          AutoPtr<CIMCreateClassResponseMessage> response(
3096                              dynamic_cast<CIMCreateClassResponseMessage*>(
3097                                  request->buildResponse()));
3098 brian.campbell 1.189 
3099 kumpf          1.262     CIMException cimException;
3100 kumpf          1.256 
3101 kumpf          1.262     try
3102                          {
3103                              removePropagatedAndOriginAttributes(request->newClass);
3104 brian.campbell 1.189 
3105 kumpf          1.262         StatProviderTimeMeasurement providerTime(response.get());
3106 kumpf          1.256 
3107 kumpf          1.262         _repository->createClass(
3108                                  request->nameSpace,
3109                                  request->newClass,
3110                                  ((ContentLanguageListContainer)request->operationContext.get(
3111                                      ContentLanguageListContainer::NAME)).getLanguages());
3112 kumpf          1.256 
3113 kumpf          1.262         PEG_LOGGER_TRACE((
3114                                  Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE,
3115                                  "CIMOperationRequestDispatcher::handleCreateClassRequest - "
3116                                      "Namespace: $0  Class Name: $1",
3117                                  request->nameSpace.getString(),
3118                                  request->newClass.getClassName().getString()));
3119                          }
3120                          catch (const CIMException& exception)
3121                          {
3122                              cimException = exception;
3123                          }
3124                          catch (const Exception& exception)
3125                          {
3126                              cimException =
3127                                  PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED, exception.getMessage());
3128                          }
3129                          catch (...)
3130                          {
3131                              cimException = PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED, String::EMPTY);
3132                          }
3133 brian.campbell 1.189 
3134 kumpf          1.262     response->cimException = cimException;
3135 brian.campbell 1.189 
3136 kumpf          1.262     _enqueueResponse(request, response.release());
3137 brian.campbell 1.189 
3138 kumpf          1.262     PEG_METHOD_EXIT();
3139 brian.campbell 1.189 }
3140                      
3141                      /**$*******************************************************
3142                          handleCreateInstanceRequest
3143                      **********************************************************/
3144                      
3145                      void CIMOperationRequestDispatcher::handleCreateInstanceRequest(
3146 kumpf          1.262     CIMCreateInstanceRequestMessage* request)
3147 brian.campbell 1.189 {
3148 kumpf          1.262     PEG_METHOD_ENTER(TRC_DISPATCHER,
3149                              "CIMOperationRequestDispatcher::handleCreateInstanceRequest()");
3150 brian.campbell 1.189 
3151 kumpf          1.262     // get the class name
3152                          CIMName className = request->newInstance.getClassName();
3153 brian.campbell 1.189 
3154 kumpf          1.262     CIMException checkClassException;
3155 chip           1.217 
3156 kumpf          1.262     _checkExistenceOfClass(request->nameSpace, className, checkClassException);
3157 chip           1.217 
3158 kumpf          1.262     if (checkClassException.getCode() != CIM_ERR_SUCCESS)
3159                          {
3160                              PEG_LOGGER_TRACE((
3161                                  Logger::STANDARD_LOG,
3162                                  System::CIMSERVER,
3163                                  Logger::TRACE,
3164                                  "CIMOperationRequestDispatcher::handleCreateInstanceRequest - "
3165                                      "CIM exist exception has occurred.  Namespace: $0  "
3166                                      "Class Name: $1",
3167                                  request->nameSpace.getString(),
3168                                  className.getString()));
3169 chip           1.217 
3170 kumpf          1.262         CIMResponseMessage* response = request->buildResponse();
3171                              response->cimException = checkClassException;
3172 chip           1.217 
3173 kumpf          1.262         _enqueueResponse(request, response);
3174 chip           1.217 
3175 kumpf          1.262         PEG_METHOD_EXIT();
3176                              return;
3177                          }
3178 chip           1.217 
3179 kumpf          1.262     //String serviceName;
3180                          //String controlProviderName;
3181                          //ProviderIdContainer* providerIdContainer = 0;
3182 brian.campbell 1.189 
3183 kumpf          1.262     ProviderInfo providerInfo =
3184                              _lookupNewInstanceProvider(
3185                                  request->nameSpace,
3186                                  className);
3187 chip           1.217 
3188 kumpf          1.262     if (providerInfo.hasProvider)
3189                          {
3190                              CIMCreateInstanceRequestMessage* requestCopy =
3191                                  new CIMCreateInstanceRequestMessage(*request);
3192 chip           1.217 
3193 kumpf          1.262         removePropagatedAndOriginAttributes(requestCopy->newInstance);
3194 chip           1.217 
3195 kumpf          1.262         if (providerInfo.providerIdContainer.get() != 0)
3196                              {
3197                                  requestCopy->operationContext.insert(
3198                                      *providerInfo.providerIdContainer.get());
3199 a.dunfey       1.231 
3200 kumpf          1.262             //delete providerIdContainer;
3201                                  //providerIdContainer = 0;
3202                              }
3203 brian.campbell 1.189 
3204 kumpf          1.262         CIMCreateInstanceRequestMessage* requestCallbackCopy =
3205                                  new CIMCreateInstanceRequestMessage(*requestCopy);
3206 brian.campbell 1.189 
3207 kumpf          1.262         _forwardRequestToProviderManager(
3208                                  providerInfo.className,
3209                                  providerInfo.serviceName,
3210                                  providerInfo.controlProviderName,
3211                                  requestCopy,
3212                                  requestCallbackCopy);
3213 kumpf          1.259 
3214 kumpf          1.262         PEG_METHOD_EXIT();
3215                              return;
3216                          }
3217                          else if (_repository->isDefaultInstanceProvider())
3218                          {
3219                              AutoPtr<CIMCreateInstanceResponseMessage> response(
3220                                  dynamic_cast<CIMCreateInstanceResponseMessage*>(
3221                                      request->buildResponse()));
3222 brian.campbell 1.189 
3223 kumpf          1.262         CIMException cimException;
3224                              CIMObjectPath instanceName;
3225 brian.campbell 1.189 
3226 kumpf          1.262         try
3227                              {
3228                                  removePropagatedAndOriginAttributes(request->newInstance);
3229 kumpf          1.256 
3230 kumpf          1.262             StatProviderTimeMeasurement providerTime(response.get());
3231 brian.campbell 1.189 
3232 kumpf          1.262             instanceName = _repository->createInstance(
3233                                      request->nameSpace,
3234                                      request->newInstance,
3235                                      ((ContentLanguageListContainer)request->operationContext.get(
3236                                          ContentLanguageListContainer::NAME)).getLanguages());
3237 kumpf          1.256 
3238 kumpf          1.262             PEG_LOGGER_TRACE((
3239                                      Logger::STANDARD_LOG,
3240                                      System::CIMSERVER,
3241                                      Logger::TRACE,
3242                                      "CIMOperationRequestDispatcher::handleCreateInstanceRequest - "
3243                                          "Namespace: $0  Instance name: $1",
3244                                      request->nameSpace.getString(),
3245                                      request->newInstance.getClassName().getString()));
3246                              }
3247                              catch (const CIMException& exception)
3248                              {
3249                                  cimException = exception;
3250                              }
3251                              catch (const Exception& exception)
3252                              {
3253                                  cimException =
3254                                      PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED, exception.getMessage());
3255                              }
3256                              catch (...)
3257                              {
3258                                  cimException = PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED, String::EMPTY);
3259 kumpf          1.262         }
3260 brian.campbell 1.189 
3261 kumpf          1.262         response->instanceName = instanceName;
3262                              response->cimException = cimException;
3263 brian.campbell 1.189 
3264 kumpf          1.262         _enqueueResponse(request, response.release());
3265                          }
3266                          else // No provider is registered and the repository isn't the default
3267                          {
3268                              CIMResponseMessage* response = request->buildResponse();
3269                              response->cimException =
3270                                  PEGASUS_CIM_EXCEPTION(CIM_ERR_NOT_SUPPORTED, String::EMPTY);
3271 brian.campbell 1.189 
3272 kumpf          1.262        _enqueueResponse(request, response);
3273                          }
3274 brian.campbell 1.189 
3275 kumpf          1.262     PEG_METHOD_EXIT();
3276                          return;
3277 brian.campbell 1.189 }
3278                      
3279                      /**$*******************************************************
3280                          handleModifyClassRequest
3281                          This request is analyzed and if correct, is passed directly to the
3282                          repository
3283                      **********************************************************/
3284                      void CIMOperationRequestDispatcher::handleModifyClassRequest(
3285 kumpf          1.262     CIMModifyClassRequestMessage* request)
3286 brian.campbell 1.189 {
3287 kumpf          1.262     PEG_METHOD_ENTER(TRC_DISPATCHER,
3288                             "CIMOperationRequestDispatcher::handleModifyClassRequest");
3289 brian.campbell 1.189 
3290 kumpf          1.262     AutoPtr<CIMModifyClassResponseMessage> response(
3291                              dynamic_cast<CIMModifyClassResponseMessage*>(
3292                                  request->buildResponse()));
3293 kumpf          1.256 
3294 kumpf          1.262     CIMException cimException;
3295 brian.campbell 1.189 
3296 kumpf          1.262     try
3297                          {
3298                              removePropagatedAndOriginAttributes(request->modifiedClass);
3299 kumpf          1.256 
3300 kumpf          1.262         StatProviderTimeMeasurement providerTime(response.get());
3301 kumpf          1.256 
3302 kumpf          1.262         _repository->modifyClass(
3303                                  request->nameSpace,
3304                                  request->modifiedClass,
3305                                  ((ContentLanguageListContainer)request->operationContext.get(
3306                                      ContentLanguageListContainer::NAME)).getLanguages());
3307                          }
3308                          catch (const CIMException& exception)
3309                          {
3310                              cimException = exception;
3311                          }
3312                          catch (const Exception& exception)
3313                          {
3314                              cimException =
3315                                  PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED, exception.getMessage());
3316                          }
3317                          catch (...)
3318                          {
3319                              cimException = PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED, String::EMPTY);
3320                          }
3321 brian.campbell 1.189 
3322 kumpf          1.262     response->cimException = cimException;
3323 brian.campbell 1.189 
3324 kumpf          1.262     _enqueueResponse(request, response.release());
3325 brian.campbell 1.189 
3326 kumpf          1.262     PEG_METHOD_EXIT();
3327 brian.campbell 1.189 }
3328                      
3329                      /**$*******************************************************
3330                          handleModifyInstanceRequest
3331                          ATTN: FIX LOOKUP
3332                      **********************************************************/
3333                      
3334                      void CIMOperationRequestDispatcher::handleModifyInstanceRequest(
3335 kumpf          1.262     CIMModifyInstanceRequestMessage* request)
3336 brian.campbell 1.189 {
3337 kumpf          1.262     PEG_METHOD_ENTER(TRC_DISPATCHER,
3338                              "CIMOperationRequestDispatcher::handleModifyInstanceRequest");
3339 brian.campbell 1.189 
3340 kumpf          1.262     // ATTN: Who makes sure the instance name and the instance match?
3341                          // ATTN: KS May 28. Change following to reflect new instancelookup
3342                          // get the class name
3343                          CIMName className = request->modifiedInstance.getClassName();
3344 brian.campbell 1.189 
3345 kumpf          1.262     CIMException checkClassException;
3346 chip           1.217 
3347 kumpf          1.262     _checkExistenceOfClass(request->nameSpace, className, checkClassException);
3348 chip           1.217 
3349 kumpf          1.262     if (checkClassException.getCode() != CIM_ERR_SUCCESS)
3350                          {
3351                              PEG_LOGGER_TRACE((
3352                                  Logger::STANDARD_LOG,
3353                                  System::CIMSERVER,
3354                                  Logger::TRACE,
3355                                  "CIMOperationRequestDispatcher::handleModifyInstanceRequest - "
3356                                      "CIM exist exception has occurred.  Namespace: $0  "
3357                                      "Class Name: $1",
3358                                  request->nameSpace.getString(),
3359                                  className.getString()));
3360 chip           1.217 
3361 kumpf          1.262         CIMResponseMessage* response = request->buildResponse();
3362                              response->cimException = checkClassException;
3363 chip           1.217 
3364 kumpf          1.262         _enqueueResponse(request, response);
3365 chip           1.217 
3366 kumpf          1.262         PEG_METHOD_EXIT();
3367                              return;
3368                          }
3369 chip           1.217 
3370 kumpf          1.262     //String serviceName;
3371                          //String controlProviderName;
3372                          //ProviderIdContainer* providerIdContainer = 0;
3373 brian.campbell 1.189 
3374 kumpf          1.262     ProviderInfo providerInfo =
3375                              _lookupNewInstanceProvider(
3376                                  request->nameSpace,
3377                                  className);
3378 chip           1.217 
3379 kumpf          1.262     if (providerInfo.hasProvider)
3380                          {
3381                              CIMModifyInstanceRequestMessage* requestCopy =
3382                                  new CIMModifyInstanceRequestMessage(*request);
3383                              removePropagatedAndOriginAttributes(requestCopy->modifiedInstance);
3384                              if (providerInfo.providerIdContainer.get() != 0)
3385                              {
3386                                  requestCopy->operationContext.insert(
3387                                      *providerInfo.providerIdContainer.get());
3388 chip           1.217 
3389 kumpf          1.262             //delete providerIdContainer;
3390                                  //providerIdContainer = 0;
3391                              }
3392 chip           1.217 
3393 kumpf          1.262         CIMModifyInstanceRequestMessage* requestCallbackCopy =
3394                                  new CIMModifyInstanceRequestMessage(*requestCopy);
3395 chip           1.217 
3396 kumpf          1.262         _forwardRequestToProviderManager(
3397                                  providerInfo.className,
3398                                  providerInfo.serviceName,
3399                                  providerInfo.controlProviderName,
3400                                  requestCopy,
3401                                  requestCallbackCopy);
3402 kumpf          1.259 
3403 kumpf          1.262         PEG_METHOD_EXIT();
3404                              return;
3405                          }
3406                          else if (_repository->isDefaultInstanceProvider())
3407                          {
3408                              // translate and forward request to repository
3409                              CIMException cimException;
3410 brian.campbell 1.189 
3411 kumpf          1.262         AutoPtr<CIMModifyInstanceResponseMessage> response(
3412                                  dynamic_cast<CIMModifyInstanceResponseMessage*>(
3413                                      request->buildResponse()));
3414 brian.campbell 1.189 
3415 kumpf          1.262         try
3416                              {
3417                                  removePropagatedAndOriginAttributes(request->modifiedInstance);
3418 brian.campbell 1.189 
3419 kumpf          1.262             StatProviderTimeMeasurement providerTime(response.get());
3420 brian.campbell 1.189 
3421 kumpf          1.262             _repository->modifyInstance(
3422                                      request->nameSpace,
3423                                      request->modifiedInstance,
3424                                      request->includeQualifiers,request->propertyList,
3425                                      ((ContentLanguageListContainer)request->operationContext.get(
3426                                          ContentLanguageListContainer::NAME)).getLanguages());
3427 kumpf          1.256 
3428 kumpf          1.262             PEG_LOGGER_TRACE((
3429                                      Logger::STANDARD_LOG,
3430                                      System::CIMSERVER,
3431                                      Logger::TRACE,
3432                                      "CIMOperationRequestDispatcher::handleModifyInstanceRequest - "
3433                                          "Namespace: $0  Instance name: $1",
3434                                      request->nameSpace.getString(),
3435                                      request->modifiedInstance.getClassName().getString()));
3436                             }
3437                             catch (const CIMException& exception)
3438                             {
3439                                 cimException = exception;
3440                             }
3441                             catch (const Exception& exception)
3442                             {
3443                                 cimException =
3444                                     PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED, exception.getMessage());
3445                             }
3446                             catch (...)
3447                             {
3448                                 cimException = PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED, String::EMPTY);
3449 kumpf          1.262        }
3450 kumpf          1.256 
3451 kumpf          1.262        response->cimException = cimException;
3452 brian.campbell 1.189 
3453 kumpf          1.262        _enqueueResponse(request, response.release());
3454                          }
3455                          else // No provider is registered and the repository isn't the default
3456                          {
3457                              CIMResponseMessage* response = request->buildResponse();
3458                              response->cimException =
3459                                  PEGASUS_CIM_EXCEPTION(CIM_ERR_NOT_SUPPORTED, String::EMPTY);
3460 brian.campbell 1.189 
3461 kumpf          1.262        _enqueueResponse(request, response);
3462                          }
3463 brian.campbell 1.189 
3464 kumpf          1.262     PEG_METHOD_EXIT();
3465                          return;
3466 brian.campbell 1.189 }
3467                      
3468                      /**$*******************************************************
3469                          handleEnumerateClassesRequest
3470                      **********************************************************/
3471                      
3472                      void CIMOperationRequestDispatcher::handleEnumerateClassesRequest(
3473 kumpf          1.262     CIMEnumerateClassesRequestMessage* request)
3474 brian.campbell 1.189 {
3475 kumpf          1.262     PEG_METHOD_ENTER(TRC_DISPATCHER,
3476                             "CIMOperationRequestDispatcher::handleEnumerateClassesRequest");
3477                      
3478                          AutoPtr<CIMEnumerateClassesResponseMessage> response(
3479                              dynamic_cast<CIMEnumerateClassesResponseMessage*>(
3480                                  request->buildResponse()));
3481 brian.campbell 1.189 
3482 kumpf          1.262     Array<CIMClass> cimClasses;
3483                          CIMException cimException;
3484 brian.campbell 1.189 
3485 kumpf          1.262     try
3486                          {
3487                              StatProviderTimeMeasurement providerTime(response.get());
3488 brian.campbell 1.189 
3489 kumpf          1.262         cimClasses = _repository->enumerateClasses(
3490                                  request->nameSpace,
3491                                  request->className,
3492                                  request->deepInheritance,
3493                                  request->localOnly,
3494                                  request->includeQualifiers,
3495                                  request->includeClassOrigin);
3496 kumpf          1.256 
3497 kumpf          1.262         PEG_LOGGER_TRACE((
3498                                 Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE,
3499                                 "CIMOperationRequestDispatcher::handleEnumerateClassesRequest - "
3500                                     "Namespace: $0  Class name: $1",
3501                                 request->nameSpace.getString(),
3502                                 request->className.getString()));
3503                          }
3504                          catch (const CIMException& exception)
3505                          {
3506                              cimException = exception;
3507                          }
3508                          catch (const Exception& exception)
3509                          {
3510                              cimException =
3511                                  PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED, exception.getMessage());
3512                          }
3513                          catch (...)
3514                          {
3515                              cimException = PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED, String::EMPTY);
3516                          }
3517 brian.campbell 1.189 
3518 kumpf          1.262     response->cimClasses = cimClasses;
3519                          response->cimException = cimException;
3520 brian.campbell 1.189 
3521 kumpf          1.262     _enqueueResponse(request, response.release());
3522 brian.campbell 1.189 
3523 kumpf          1.262     PEG_METHOD_EXIT();
3524 brian.campbell 1.189 }
3525                      
3526                      /**$*******************************************************
3527                          handleEnumerateClassNamesRequest
3528                          Passed directly to the CIMRepository
3529                      **********************************************************/
3530                      void CIMOperationRequestDispatcher::handleEnumerateClassNamesRequest(
3531 kumpf          1.262     CIMEnumerateClassNamesRequestMessage* request)
3532 brian.campbell 1.189 {
3533 kumpf          1.262     PEG_METHOD_ENTER(TRC_DISPATCHER,
3534                             "CIMOperationRequestDispatcher::handleEnumerateClassNamesRequest");
3535                      
3536                          AutoPtr<CIMEnumerateClassNamesResponseMessage> response(
3537                              dynamic_cast<CIMEnumerateClassNamesResponseMessage*>(
3538                                  request->buildResponse()));
3539 brian.campbell 1.189 
3540 kumpf          1.262     Array<CIMName> classNames;
3541                          CIMException cimException;
3542 brian.campbell 1.189 
3543 kumpf          1.262     try
3544                          {
3545                              StatProviderTimeMeasurement providerTime(response.get());
3546 brian.campbell 1.189 
3547 kumpf          1.262         classNames = _repository->enumerateClassNames(
3548                                  request->nameSpace,
3549                                  request->className,
3550                                  request->deepInheritance);
3551 kumpf          1.256 
3552 kumpf          1.262         PEG_LOGGER_TRACE((
3553                                  Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE,
3554                                  "CIMOperationRequestDispatcher::handleEnumerateClassNamesRequest - "
3555                                      "Namespace: $0  Class name: $1",
3556                                  request->nameSpace.getString(),
3557                                  request->className.getString()));
3558                          }
3559                          catch (const CIMException& exception)
3560                          {
3561                              cimException = exception;
3562                          }
3563                          catch (const Exception& exception)
3564                          {
3565                              cimException =
3566                                  PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED, exception.getMessage());
3567                          }
3568                          catch (...)
3569                          {
3570                              cimException = PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED, String::EMPTY);
3571                          }
3572 brian.campbell 1.189 
3573 kumpf          1.262     response->classNames = classNames;
3574                          response->cimException = cimException;
3575 brian.campbell 1.189 
3576 kumpf          1.262     _enqueueResponse(request, response.release());
3577 brian.campbell 1.189 
3578 kumpf          1.262     PEG_METHOD_EXIT();
3579 brian.campbell 1.189 }
3580                      
3581                      /**$*******************************************************
3582                          handleEnumerateInstancesRequest
3583                      
3584                          if !validClassName
3585                              generate exception response
3586                              return
3587                          get all subclasses to target class
3588                          for all classes
3589                              get Provider for Class
3590                          if (number of providers > BreadthLimit)
3591                              generate exception
3592                              return
3593                          if (no providers found) and !(repository is default provider)
3594                              generate CIM_ERR_NOT_SUPPORTED response
3595                              return
3596                          for all targetclass and subclasses
3597                              if (class has a provider)
3598                                  copy request
3599                                  substitute current class name
3600 brian.campbell 1.189             forward request to provider
3601                          if (repository is default provider)
3602                              for all targetclass and subclasses
3603                                  if !(class has a provider)
3604                                      issue request for this class to repository
3605                                      put response on aggregate list
3606                      **********************************************************/
3607                      
3608                      void CIMOperationRequestDispatcher::handleEnumerateInstancesRequest(
3609                          CIMEnumerateInstancesRequestMessage* request)
3610                      {
3611 kumpf          1.262     PEG_METHOD_ENTER(TRC_DISPATCHER,
3612 chip           1.217         "CIMOperationRequestDispatcher::handleEnumerateInstancesRequest");
3613 brian.campbell 1.189 
3614                          // get the class name
3615                          CIMName className = request->className;
3616                          CIMException checkClassException;
3617                      
3618 kumpf          1.262     CIMClass cimClass = _getClass(
3619                              request->nameSpace,
3620                              className,
3621                              checkClassException);
3622 chip           1.207 
3623 brian.campbell 1.189     if (checkClassException.getCode() != CIM_ERR_SUCCESS)
3624                          {
3625 kumpf          1.256         CIMResponseMessage* response = request->buildResponse();
3626                              response->cimException = checkClassException;
3627 chip           1.217 
3628 brian.campbell 1.189         _enqueueResponse(request, response);
3629 chip           1.207 
3630 brian.campbell 1.189         PEG_METHOD_EXIT();
3631                              return;
3632                          }
3633                      
3634 kumpf          1.228     CDEBUG("CIMOP ei client propertyList = " <<
3635                              _showPropertyList(request->propertyList));
3636                      
3637                          // If DeepInheritance==false and no PropertyList was specified by the
3638                          // client, the provider PropertyList should contain all the properties
3639                          // in the specified class.
3640                          if (!request->deepInheritance && request->propertyList.isNull())
3641                          {
3642                              Array<CIMName> propertyNameArray;
3643                              Uint32 numProperties = cimClass.getPropertyCount();
3644                              for (Uint32 i = 0; i < numProperties; i++)
3645                              {
3646                                  propertyNameArray.append(cimClass.getProperty(i).getName());
3647                              }
3648                      
3649                              request->propertyList.set(propertyNameArray);
3650 brian.campbell 1.189     }
3651 chip           1.207 
3652 kumpf          1.228     CDEBUG("CIMOP ei provider propertyList = " <<
3653                              _showPropertyList(request->propertyList));
3654 brian.campbell 1.189 
3655                          //
3656                          // Get names of descendent classes:
3657                          //
3658                          CIMException cimException;
3659                          Array<ProviderInfo> providerInfos;
3660                      
3661                          Uint32 providerCount;
3662                      
3663                          // Get list of providers.
3664                          try
3665                          {
3666                              CDEBUG("Looking up Instance Providers");
3667 chip           1.217         providerInfos =
3668                                  _lookupAllInstanceProviders(
3669                                      request->nameSpace,
3670                                      className,
3671                                      providerCount);
3672 brian.campbell 1.189     }
3673 kumpf          1.262     catch (const CIMException& exception)
3674 brian.campbell 1.189     {
3675 kumpf          1.256         CIMResponseMessage* response = request->buildResponse();
3676                              response->cimException = exception;
3677 brian.campbell 1.189 
3678                              _enqueueResponse(request, response);
3679 chip           1.217 
3680 brian.campbell 1.189         PEG_METHOD_EXIT();
3681                              return;
3682                          }
3683                      
3684                          Uint32 toIssueCount = providerInfos.size();
3685                      
3686                          // Test for "enumerate too Broad" and if so, execute exception.
3687                          // This limits the number of provider invocations, not the number
3688                          // of instances returned.
3689 kumpf          1.262     if (providerCount > _maximumEnumerateBreadth)
3690 brian.campbell 1.189     {
3691 mike           1.240         PEG_LOGGER_TRACE((
3692 chip           1.217             Logger::STANDARD_LOG,
3693                                  System::CIMSERVER,
3694                                  Logger::TRACE,
3695 mike           1.240             "Request-too-broad exception.  Namespace: $0  Class Name: $1  "
3696 kumpf          1.262             "Limit: $2  ProviderCount: $3",
3697 chip           1.217             request->nameSpace.getString(),
3698                                  request->className.getString(),
3699 mike           1.240             _maximumEnumerateBreadth, providerCount));
3700 chip           1.217 
3701 kumpf          1.266         PEG_TRACE((TRC_DISPATCHER, Tracer::LEVEL2,
3702                                  "ERROR: Enumerate operation too broad for class %s.  "
3703                                      "Limit = %u, providerCount = %u",
3704                                  (const char*)request->className.getString().getCString(),
3705                                  _maximumEnumerateBreadth,
3706                                  providerCount));
3707 brian.campbell 1.189 
3708 kumpf          1.256         CIMResponseMessage* response = request->buildResponse();
3709                              response->cimException =
3710                                  PEGASUS_CIM_EXCEPTION_L(CIM_ERR_NOT_SUPPORTED, MessageLoaderParms(
3711                                      "Server.CIMOperationRequestDispatcher.ENUM_REQ_TOO_BROAD",
3712                                      "Enumerate request too Broad")),
3713 brian.campbell 1.189 
3714                              _enqueueResponse(request, response);
3715 chip           1.217 
3716 brian.campbell 1.189         PEG_METHOD_EXIT();
3717                              return;
3718                          }
3719                      
3720                          // If no provider is registered and the repository isn't the default,
3721                          // return CIM_ERR_NOT_SUPPORTED
3722                      
3723                          if ((providerCount == 0) && !(_repository->isDefaultInstanceProvider()))
3724                          {
3725 chip           1.217         PEG_TRACE_STRING(
3726                                  TRC_DISPATCHER,
3727                                  Tracer::LEVEL4,
3728 brian.campbell 1.189             "CIM_ERROR_NOT_SUPPORTED for " + request->className.getString());
3729                      
3730 kumpf          1.256         CIMResponseMessage* response = request->buildResponse();
3731                              response->cimException =
3732                                  PEGASUS_CIM_EXCEPTION(CIM_ERR_NOT_SUPPORTED, String::EMPTY);
3733 brian.campbell 1.189 
3734                              _enqueueResponse(request, response);
3735 chip           1.217 
3736 brian.campbell 1.189         PEG_METHOD_EXIT();
3737                              return;
3738                          }
3739                      
3740 kumpf          1.262     //
3741                          // Get names of descendent classes:
3742                          //
3743                          //CIMException cimException;
3744                          //Array<ProviderInfo> providerInfos;
3745 brian.campbell 1.189 
3746                          // We have instances for Providers and possibly repository.
3747                          // Set up an aggregate object and save a copy of the original request.
3748 kumpf          1.262     OperationAggregate* poA= new OperationAggregate(
3749 brian.campbell 1.189         new CIMEnumerateInstancesRequestMessage(*request),
3750                              request->getType(),
3751                              request->messageId,
3752                              request->queueIds.top(),
3753                              request->className);
3754 karl           1.214 
3755 brian.campbell 1.189     poA->_aggregationSN = cimOperationAggregationSN++;
3756 chip           1.217     Uint32 numClasses = providerInfos.size();
3757 brian.campbell 1.189 
3758 kumpf          1.226     // gather up the repository responses and send it to out as one response
3759                          // with many instances
3760 brian.campbell 1.189     if (_repository->isDefaultInstanceProvider())
3761                          {
3762 chip           1.217         // Loop through providerInfos, forwarding requests to repository
3763                              for (Uint32 i = 0; i < numClasses; i++)
3764                              {
3765 kumpf          1.262             ProviderInfo& providerInfo = providerInfos[i];
3766 chip           1.217 
3767                                  // this class is registered to a provider - skip
3768                                  if (providerInfo.hasProvider)
3769                                      continue;
3770                      
3771 kumpf          1.266             PEG_TRACE((TRC_DISPATCHER, Tracer::LEVEL4,
3772                                      "Routing EnumerateInstances request for class %s to the "
3773                                          "repository.  Class # %u of %u, aggregation SN %u.",
3774                                      (const char*)providerInfo.className.getString().getCString(),
3775                                      i + 1,
3776                                      numClasses,
3777                                      poA->_aggregationSN));
3778 chip           1.217 
3779 kumpf          1.256             AutoPtr<CIMEnumerateInstancesResponseMessage> response(
3780                                      dynamic_cast<CIMEnumerateInstancesResponseMessage*>(
3781                                          request->buildResponse()));
3782                      
3783 chip           1.217             CIMException cimException;
3784                                  Array<CIMInstance> cimNamedInstances;
3785                      
3786                                  try
3787                                  {
3788 kumpf          1.256                 StatProviderTimeMeasurement providerTime(response.get());
3789                      
3790 chip           1.217                 // Enumerate instances only for this class
3791                                      cimNamedInstances =
3792                                          _repository->enumerateInstancesForClass(
3793 karl           1.214                         request->nameSpace,
3794                                              providerInfo.className,
3795                                              request->localOnly,
3796                                              request->includeQualifiers,
3797                                              request->includeClassOrigin,
3798                                              request->propertyList);
3799 chip           1.217             }
3800 kumpf          1.262             catch (const CIMException& exception)
3801 chip           1.217             {
3802                                      cimException = exception;
3803                                  }
3804 kumpf          1.262             catch (const Exception& exception)
3805 chip           1.217             {
3806                                      cimException = PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED,
3807                                          exception.getMessage());
3808                                  }
3809 kumpf          1.262             catch (...)
3810 chip           1.217             {
3811                                      cimException = PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED,
3812                                          String::EMPTY);
3813                                  }
3814                      
3815 kumpf          1.256             response->cimNamedInstances = cimNamedInstances;
3816                                  response->cimException = cimException;
3817 chip           1.217 
3818 kumpf          1.256             poA->appendResponse(response.release());
3819 chip           1.217         } // for all classes and derived classes
3820                      
3821                              Uint32 numberResponses = poA->numberResponses();
3822                              Uint32 totalIssued = providerCount + (numberResponses > 0 ? 1 : 0);
3823                              poA->setTotalIssued(totalIssued);
3824                      
3825                              if (numberResponses > 0)
3826                              {
3827                                  handleEnumerateInstancesResponseAggregation(poA);
3828                      
3829 kumpf          1.262             CIMResponseMessage* response = poA->removeResponse(0);
3830 brian.campbell 1.189 
3831 chip           1.217             _forwardRequestForAggregation(
3832                                      String(PEGASUS_QUEUENAME_OPREQDISPATCHER),
3833                                      String(),
3834                                      new CIMEnumerateInstancesRequestMessage(*request),
3835                                      poA,
3836                                      response);
3837                              }
3838 brian.campbell 1.190     } // if isDefaultInstanceProvider
3839 chip           1.217     else
3840                          {
3841                              // Set the number of expected responses in the OperationAggregate
3842                              poA->setTotalIssued(providerCount);
3843                          }
3844 brian.campbell 1.189 
3845 chip           1.217     CDEBUG("Before Loop to send requests. numClasses = " << numClasses);
3846 brian.campbell 1.189 
3847 brian.campbell 1.190     // Loop through providerInfos, forwarding requests to providers
3848                          for (Uint32 i = 0; i < numClasses; i++)
3849 brian.campbell 1.189     {
3850 kumpf          1.262         ProviderInfo& providerInfo = providerInfos[i];
3851 brian.campbell 1.189 
3852 chip           1.217         // this class is NOT registered to a provider - skip
3853                              if (! providerInfo.hasProvider)
3854                                  continue;
3855 brian.campbell 1.189 
3856 kumpf          1.266         PEG_TRACE((TRC_DISPATCHER, Tracer::LEVEL4,
3857                                  "Routing EnumerateInstances request for class %s to "
3858                                      "service \"%s\" for control provider \"%s\".  "
3859                                      "Class # %u of %u, aggregation SN %u.",
3860                                  (const char*)providerInfo.className.getString().getCString(),
3861                                  (const char*)providerInfo.serviceName.getCString(),
3862                                  (const char*)providerInfo.controlProviderName.getCString(),
3863                                  i + 1,
3864                                  numClasses,
3865                                  poA->_aggregationSN));
3866 brian.campbell 1.190 
3867 chip           1.217         CIMEnumerateInstancesRequestMessage* requestCopy =
3868                                  new CIMEnumerateInstancesRequestMessage(*request);
3869 brian.campbell 1.190 
3870 chip           1.217         requestCopy->className = providerInfo.className;
3871 chip           1.207 
3872 chip           1.217         CIMException checkClassException;
3873 chip           1.207 
3874 kumpf          1.262         CIMClass cimClass = _getClass(
3875                                  request->nameSpace,
3876                                  providerInfo.className,
3877                                  checkClassException);
3878 chip           1.207 
3879 kumpf          1.266         // ATTN: The following is not correct. Need better way to terminate.
3880 chip           1.217         if (checkClassException.getCode() != CIM_ERR_SUCCESS)
3881                              {
3882 kumpf          1.262             CIMResponseMessage* response = request->buildResponse();
3883 chip           1.207 
3884 chip           1.217             _forwardRequestForAggregation(
3885                                      String(PEGASUS_QUEUENAME_OPREQDISPATCHER),
3886                                      String(),
3887                                      new CIMEnumerateInstancesRequestMessage(*request),
3888                                      poA,
3889                                      response);
3890                              }
3891 chip           1.207 
3892 kumpf          1.262         if (providerInfo.providerIdContainer.get() != 0)
3893 chip           1.217         {
3894 kumpf          1.262             requestCopy->operationContext.insert(
3895                                      *(providerInfo.providerIdContainer.get()));
3896 chip           1.217         }
3897 brian.campbell 1.190 
3898 kumpf          1.226 #ifdef PEGASUS_ENABLE_OBJECT_NORMALIZATION
3899 kumpf          1.262         if (_enableNormalization && providerInfo.hasProviderNormalization)
3900 chip           1.217         {
3901 kumpf          1.262             requestCopy->operationContext.insert(
3902                                      CachedClassDefinitionContainer(cimClass));
3903 chip           1.217         }
3904 kumpf          1.226 #endif
3905 chip           1.216 
3906 kumpf          1.262         if (checkClassException.getCode() == CIM_ERR_SUCCESS)
3907 chip           1.217         {
3908 kumpf          1.266             PEG_TRACE_STRING(TRC_DISPATCHER, Tracer::LEVEL4,
3909                                      String("PropertyList = ") +
3910                                          _showPropertyList(requestCopy->propertyList));
3911 karl           1.214 
3912 chip           1.217             _forwardRequestForAggregation(
3913                                      providerInfo.serviceName,
3914                                      providerInfo.controlProviderName,
3915                                      requestCopy,
3916                                      poA);
3917                              }
3918                          } // for all classes and dervied classes
3919 brian.campbell 1.189 
3920                          PEG_METHOD_EXIT();
3921                      }
3922                      
3923                      /**$*******************************************************
3924                          handleEnumerateInstanceNamesRequest
3925                      
3926                          if !validClassName
3927                              generate exception response
3928                              return
3929                          get all subclasses to target class
3930                          for all classes
3931                              get Provider for Class
3932                          if (number of providers > BreadthLimit)
3933                              generate exception
3934                              return
3935                          if (no providers found) and !(repository is default provider)
3936                              generate CIM_ERR_NOT_SUPPORTED response
3937                              return
3938                          for all targetclass and subclasses
3939                              if (class has a provider)
3940 brian.campbell 1.189             copy request
3941                                  substitute current class name
3942                                  forward request to provider
3943                          if (repository is default provider)
3944                              for all targetclass and subclasses
3945                                  if !(class has a provider)
3946                                      issue request for this class to repository
3947                                      put response on aggregate list
3948                      **********************************************************/
3949                      
3950                      void CIMOperationRequestDispatcher::handleEnumerateInstanceNamesRequest(
3951                          CIMEnumerateInstanceNamesRequestMessage* request)
3952                      {
3953 kumpf          1.262     PEG_METHOD_ENTER(TRC_DISPATCHER,
3954 chip           1.217         "CIMOperationRequestDispatcher::handleEnumerateInstanceNamesRequest");
3955 brian.campbell 1.189 
3956 chip           1.207     CIMName className = request->className;
3957 chip           1.217 
3958 brian.campbell 1.189     CIMException checkClassException;
3959 chip           1.207 
3960 kumpf          1.262     CIMClass cimClass = _getClass(
3961                              request->nameSpace,
3962                              className,
3963                              checkClassException);
3964 chip           1.207 
3965 brian.campbell 1.189     if (checkClassException.getCode() != CIM_ERR_SUCCESS)
3966                          {
3967 kumpf          1.256         CIMResponseMessage* response = request->buildResponse();
3968                              response->cimException = checkClassException;
3969 chip           1.217 
3970 brian.campbell 1.189         _enqueueResponse(request, response);
3971 chip           1.217 
3972 brian.campbell 1.189         PEG_METHOD_EXIT();
3973                              return;
3974                          }
3975                      
3976                          //
3977                          // Get names of descendent classes:
3978                          //
3979                          CIMException cimException;
3980                          Array<ProviderInfo> providerInfos;
3981                      
3982                          // This gets set by _lookupAllInstanceProviders()
3983                          Uint32 providerCount;
3984                      
3985                          try
3986                          {
3987 chip           1.217         providerInfos = _lookupAllInstanceProviders(
3988                                  request->nameSpace,
3989                                  request->className,
3990                                  providerCount);
3991 brian.campbell 1.189     }
3992 kumpf          1.262     catch (const CIMException& exception)
3993 brian.campbell 1.189     {
3994 kumpf          1.256         CIMResponseMessage* response = request->buildResponse();
3995                              response->cimException = exception;
3996 brian.campbell 1.189 
3997                              _enqueueResponse(request, response);
3998 chip           1.217 
3999 brian.campbell 1.189         PEG_METHOD_EXIT();
4000                              return;
4001                          }
4002                      
4003                          // Test for "enumerate too Broad" and if so, execute exception.
4004                          // This limits the number of provider invocations, not the number
4005                          // of instances returned.
4006 kumpf          1.262     if (providerCount > _maximumEnumerateBreadth)
4007 brian.campbell 1.189     {
4008 mike           1.240         PEG_LOGGER_TRACE((
4009 chip           1.217             Logger::STANDARD_LOG,
4010                                  System::CIMSERVER,
4011                                  Logger::TRACE,
4012                                  "Request-too-broad exception.  Namespace: $0  "
4013 kumpf          1.262                 "Class Name: $1 Limit: $2  ProviderCount: $3",
4014 chip           1.217             request->nameSpace.getString(),
4015                                  request->className.getString(),
4016 mike           1.240             _maximumEnumerateBreadth, providerCount));
4017 chip           1.217 
4018 kumpf          1.266         PEG_TRACE((TRC_DISPATCHER, Tracer::LEVEL2,
4019                                  "ERROR: Enumerate operation too broad for class %s.  "
4020                                      "Limit = %u, providerCount = %u",
4021                                  (const char*)request->className.getString().getCString(),
4022                                  _maximumEnumerateBreadth,
4023                                  providerCount));
4024 brian.campbell 1.189 
4025 kumpf          1.256         CIMResponseMessage* response = request->buildResponse();
4026                              response->cimException = PEGASUS_CIM_EXCEPTION_L(CIM_ERR_NOT_SUPPORTED,
4027                                  MessageLoaderParms(
4028                                      "Server.CIMOperationRequestDispatcher.ENUM_REQ_TOO_BROAD",
4029                                      "Enumerate request too Broad")),
4030 brian.campbell 1.189 
4031                              _enqueueResponse(request, response);
4032 chip           1.217 
4033 brian.campbell 1.189         PEG_METHOD_EXIT();
4034                              return;
4035                          }
4036                      
4037                          // If no provider is registered and the repository isn't the default,
4038                          // return CIM_ERR_NOT_SUPPORTED
4039                          if ((providerCount == 0) && !(_repository->isDefaultInstanceProvider()))
4040                          {
4041 chip           1.217         PEG_TRACE_STRING(
4042                                  TRC_DISPATCHER,
4043                                  Tracer::LEVEL4,
4044 brian.campbell 1.189             "CIM_ERROR_NOT_SUPPORTED for " + request->className.getString());
4045                      
4046 kumpf          1.256         CIMResponseMessage* response = request->buildResponse();
4047                              response->cimException =
4048                                  PEGASUS_CIM_EXCEPTION(CIM_ERR_NOT_SUPPORTED, String::EMPTY);
4049 brian.campbell 1.189 
4050                              _enqueueResponse(request, response);
4051 chip           1.217 
4052 brian.campbell 1.189         PEG_METHOD_EXIT();
4053                              return;
4054                          }
4055                      
4056                          // We have instances for Providers and possibly repository.
4057                          // Set up an aggregate object and save a copy of the original request.
4058 kumpf          1.262     OperationAggregate* poA= new OperationAggregate(
4059 brian.campbell 1.189         new CIMEnumerateInstanceNamesRequestMessage(*request),
4060                              request->getType(),
4061                              request->messageId,
4062                              request->queueIds.top(),
4063                              request->className);
4064 chip           1.217 
4065 brian.campbell 1.189     poA->_aggregationSN = cimOperationAggregationSN++;
4066 brian.campbell 1.190     Uint32 numClasses = providerInfos.size();
4067 brian.campbell 1.189 
4068                          if (_repository->isDefaultInstanceProvider())
4069                          {
4070 chip           1.217         // Loop through providerInfos, forwarding requests to repository
4071                              for (Uint32 i = 0; i < numClasses; i++)
4072                              {
4073 kumpf          1.262             ProviderInfo& providerInfo = providerInfos[i];
4074 r.kieninger    1.197 
4075 chip           1.217             // this class is registered to a provider - skip
4076                                  if (providerInfo.hasProvider)
4077                                      continue;
4078                      
4079                                  // If this class does not have a provider
4080                      
4081 kumpf          1.266             PEG_TRACE((TRC_DISPATCHER, Tracer::LEVEL4,
4082                                      "Routing EnumerateInstanceNames request for class %s to the "
4083                                          "repository.  Class # %u of %u, aggregation SN %u.",
4084                                      (const char*)providerInfo.className.getString().getCString(),
4085                                      i + 1,
4086                                      numClasses,
4087                                      poA->_aggregationSN));
4088 brian.campbell 1.189 
4089 kumpf          1.256             AutoPtr<CIMEnumerateInstanceNamesResponseMessage> response(
4090                                      dynamic_cast<CIMEnumerateInstanceNamesResponseMessage*>(
4091                                          request->buildResponse()));
4092 chip           1.217 
4093                                  try
4094                                  {
4095 kumpf          1.256                 StatProviderTimeMeasurement providerTime(response.get());
4096                      
4097 chip           1.217                 // Enumerate instances only for this class
4098 kumpf          1.256                 response->instanceNames =
4099 chip           1.217                     _repository->enumerateInstanceNamesForClass(
4100                                              request->nameSpace,
4101 kumpf          1.258                         providerInfo.className);
4102 chip           1.217             }
4103 kumpf          1.262             catch (const CIMException& exception)
4104 chip           1.217             {
4105 kumpf          1.256                 response->cimException = exception;
4106 chip           1.217             }
4107 kumpf          1.262             catch (const Exception& exception)
4108                                  {
4109                                      response->cimException = PEGASUS_CIM_EXCEPTION(
4110                                          CIM_ERR_FAILED, exception.getMessage());
4111                                  }
4112                                  catch (...)
4113 chip           1.217             {
4114 kumpf          1.262                 response->cimException = PEGASUS_CIM_EXCEPTION(
4115                                          CIM_ERR_FAILED, String::EMPTY);
4116 chip           1.217             }
4117                      
4118 kumpf          1.256             poA->appendResponse(response.release());
4119 chip           1.217         } // for all classes and derived classes
4120                      
4121                              Uint32 numberResponses = poA->numberResponses();
4122                              Uint32 totalIssued = providerCount + (numberResponses > 0 ? 1 : 0);
4123                              poA->setTotalIssued(totalIssued);
4124 r.kieninger    1.197 
4125 chip           1.217         if (numberResponses > 0)
4126                              {
4127                                  handleEnumerateInstanceNamesResponseAggregation(poA);
4128                      
4129 kumpf          1.262             CIMResponseMessage* response = poA->removeResponse(0);
4130 chip           1.217 
4131                                  _forwardRequestForAggregation(
4132                                      String(PEGASUS_QUEUENAME_OPREQDISPATCHER),
4133                                      String(),
4134                                      new CIMEnumerateInstanceNamesRequestMessage(*request),
4135                                      poA,
4136                                      response);
4137                              }
4138 brian.campbell 1.190     } // if isDefaultInstanceProvider
4139 chip           1.217     else
4140                          {
4141                              // Set the number of expected responses in the OperationAggregate
4142                              poA->setTotalIssued(providerCount);
4143                          }
4144 brian.campbell 1.189 
4145 brian.campbell 1.190     // Loop through providerInfos, forwarding requests to providers
4146                          for (Uint32 i = 0; i < numClasses; i++)
4147                          {
4148 kumpf          1.262         ProviderInfo& providerInfo = providerInfos[i];
4149 brian.campbell 1.189 
4150 chip           1.217         // this class is NOT registered to a provider - skip
4151                              if (! providerInfo.hasProvider)
4152                                  continue;
4153 brian.campbell 1.189 
4154 kumpf          1.266         PEG_TRACE((TRC_DISPATCHER, Tracer::LEVEL4,
4155                                  "Routing EnumerateInstanceNames request for class %s to "
4156                                      "service \"%s\" for control provider \"%s\".  "
4157                                      "Class # %u of %u, aggregation SN %u.",
4158                                  (const char*)providerInfo.className.getString().getCString(),
4159                                  (const char*)providerInfo.serviceName.getCString(),
4160                                  (const char*)providerInfo.controlProviderName.getCString(),
4161                                  i + 1,
4162                                  numClasses,
4163                                  poA->_aggregationSN));
4164 brian.campbell 1.190 
4165 chip           1.217         CIMEnumerateInstanceNamesRequestMessage* requestCopy =
4166                                  new CIMEnumerateInstanceNamesRequestMessage(*request);
4167 r.kieninger    1.197 
4168 chip           1.217         requestCopy->className = providerInfo.className;
4169 brian.campbell 1.190 
4170 chip           1.217         CIMException checkClassException;
4171 chip           1.207 
4172 chip           1.217         CIMClass cimClass =
4173                                  _getClass(
4174                                      request->nameSpace,
4175                                      providerInfo.className,
4176                                      checkClassException);
4177 chip           1.207 
4178 chip           1.217         // The following is not correct. Need better way to terminate.
4179                              if (checkClassException.getCode() != CIM_ERR_SUCCESS)
4180                              {
4181 kumpf          1.262             CIMResponseMessage* response = request->buildResponse();
4182 chip           1.207 
4183 chip           1.217             _forwardRequestForAggregation(
4184                                      String(PEGASUS_QUEUENAME_OPREQDISPATCHER),
4185                                      String(),
4186                                      new CIMEnumerateInstanceNamesRequestMessage(*request),
4187                                      poA,
4188                                      response);
4189                              }
4190 chip           1.207 
4191 kumpf          1.262         if (providerInfo.providerIdContainer.get() != 0)
4192 chip           1.217         {
4193 kumpf          1.262             requestCopy->operationContext.insert(
4194                                      *(providerInfo.providerIdContainer.get()));
4195 chip           1.217         }
4196 brian.campbell 1.190 
4197 kumpf          1.226 #ifdef PEGASUS_ENABLE_OBJECT_NORMALIZATION
4198 kumpf          1.262         if (_enableNormalization && providerInfo.hasProviderNormalization)
4199 chip           1.217         {
4200 kumpf          1.262             requestCopy->operationContext.insert(
4201                                      CachedClassDefinitionContainer(cimClass));
4202 chip           1.217         }
4203 kumpf          1.226 #endif
4204 chip           1.202 
4205 kumpf          1.262         if (checkClassException.getCode() == CIM_ERR_SUCCESS)
4206 chip           1.217         {
4207                                  _forwardRequestForAggregation(
4208                                      providerInfo.serviceName,
4209                                      providerInfo.controlProviderName,
4210                                      requestCopy,
4211                                      poA);
4212                              }
4213 brian.campbell 1.190     } // for all classes and derived classes
4214 brian.campbell 1.189 
4215                          PEG_METHOD_EXIT();
4216                          return;
4217                      }
4218                      
4219                      /**$*******************************************************
4220                          handleAssociatorsRequest
4221                      **********************************************************/
4222                      
4223                      void CIMOperationRequestDispatcher::handleAssociatorsRequest(
4224                          CIMAssociatorsRequestMessage* request)
4225                      {
4226                          PEG_METHOD_ENTER(TRC_DISPATCHER,
4227                              "CIMOperationRequestDispatcher::handleAssociatorsRequest");
4228                      
4229                          if (!_enableAssociationTraversal)
4230                          {
4231 kumpf          1.256         CIMResponseMessage* response = request->buildResponse();
4232                              response->cimException =
4233 brian.campbell 1.189             PEGASUS_CIM_EXCEPTION(CIM_ERR_NOT_SUPPORTED, "Associators");
4234                      
4235                              _enqueueResponse(request, response);
4236                      
4237                              PEG_METHOD_EXIT();
4238                              return;
4239                          }
4240                      
4241 yi.zhou        1.232     // Validate role parameter syntax
4242                          if ((request->role != String::EMPTY) && (!CIMName::legal(request->role)))
4243                          {
4244 kumpf          1.256         CIMResponseMessage* response = request->buildResponse();
4245                              response->cimException =
4246 kumpf          1.262             PEGASUS_CIM_EXCEPTION(CIM_ERR_INVALID_PARAMETER, request->role);
4247 yi.zhou        1.232 
4248                              _enqueueResponse(request, response);
4249                      
4250                              PEG_METHOD_EXIT();
4251                              return;
4252                          }
4253                      
4254                          // Validate resultRole parameter syntax
4255 chip           1.241     if ((request->resultRole != String::EMPTY) &&
4256 kumpf          1.262         (!CIMName::legal(request->resultRole)))
4257 yi.zhou        1.232     {
4258 kumpf          1.256         CIMResponseMessage* response = request->buildResponse();
4259                              response->cimException = PEGASUS_CIM_EXCEPTION(
4260 yi.zhou        1.232             CIM_ERR_INVALID_PARAMETER, request->resultRole);
4261                      
4262                              _enqueueResponse(request, response);
4263                      
4264                              PEG_METHOD_EXIT();
4265                              return;
4266                          }
4267                      
4268 brian.campbell 1.189     CIMException checkClassException;
4269                          _checkExistenceOfClass(request->nameSpace,
4270                                                 request->objectName.getClassName(),
4271                                                 checkClassException);
4272                          if (checkClassException.getCode() != CIM_ERR_SUCCESS)
4273 kumpf          1.226     {
4274 kumpf          1.256         if (checkClassException.getCode() == CIM_ERR_INVALID_CLASS)
4275                              {
4276                                  checkClassException = PEGASUS_CIM_EXCEPTION(
4277                                      CIM_ERR_INVALID_PARAMETER, request->objectName.toString());
4278                              }
4279 brian.campbell 1.189 
4280 kumpf          1.256         CIMResponseMessage* response = request->buildResponse();
4281                              response->cimException = checkClassException;
4282 brian.campbell 1.189 
4283                              _enqueueResponse(request, response);
4284                      
4285                              PEG_METHOD_EXIT();
4286                              return;
4287                          }
4288                      
4289 mike           1.240     PEG_LOGGER_TRACE((Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE,
4290 brian.campbell 1.189         "CIMOperationRequestDispatcher::handleAssociators - "
4291 kumpf          1.262             "Namespace: $0  Class name: $1",
4292 brian.campbell 1.189         request->nameSpace.getString(),
4293 mike           1.240         request->objectName.toString()));
4294 brian.campbell 1.189 
4295                          //  ATTN-CAKG-P2-20020726:  The following condition does not correctly
4296                          //  distinguish instanceNames from classNames in every case
4297                          //  The instanceName of a singleton instance of a keyless class also
4298                          //  has no key bindings
4299                          Boolean isClassRequest =
4300                              (request->objectName.getKeyBindings().size() == 0) ? true : false;
4301                      
4302                          if (isClassRequest)
4303                          {
4304                              //
4305                              // For Class requests, get the results from the repository
4306                              //
4307                      
4308 marek          1.264         PEG_TRACE_CSTRING(TRC_DISPATCHER, Tracer::LEVEL4,
4309 brian.campbell 1.189                       "Associators executing Class request");
4310                      
4311 kumpf          1.256         AutoPtr<CIMAssociatorsResponseMessage> response(
4312                                  dynamic_cast<CIMAssociatorsResponseMessage*>(
4313                                      request->buildResponse()));
4314 brian.campbell 1.189 
4315                              try
4316                              {
4317 kumpf          1.256             StatProviderTimeMeasurement providerTime(response.get());
4318                      
4319                                  response->cimObjects = _repository->associators(
4320 brian.campbell 1.189                 request->nameSpace,
4321                                      request->objectName,
4322                                      request->assocClass,
4323                                      request->resultClass,
4324                                      request->role,
4325                                      request->resultRole,
4326                                      request->includeQualifiers,
4327                                      request->includeClassOrigin,
4328                                      request->propertyList);
4329                              }
4330 kumpf          1.262         catch (const CIMException& exception)
4331 brian.campbell 1.189         {
4332 kumpf          1.256             response->cimException = exception;
4333 brian.campbell 1.189         }
4334 kumpf          1.262         catch (const Exception& exception)
4335 brian.campbell 1.189         {
4336 kumpf          1.256             response->cimException = PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED,
4337 brian.campbell 1.189                                                  exception.getMessage());
4338                              }
4339 kumpf          1.262         catch (...)
4340 brian.campbell 1.189         {
4341 kumpf          1.256             response->cimException = PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED,
4342 brian.campbell 1.189                                                  String::EMPTY);
4343                              }
4344                      
4345 kumpf          1.256         _enqueueResponse(request, response.release());
4346 brian.campbell 1.189     }
4347                          else
4348                          {
4349                              //
4350                              // For Instance requests, get results from providers and the repository
4351                              //
4352                      
4353                              //
4354                              // Determine list of providers for this request
4355                              //
4356                      
4357                              Array<ProviderInfo> providerInfos;
4358                              Uint32 providerCount;
4359                              try
4360                              {
4361                                  providerInfos = _lookupAllAssociationProviders(
4362                                      request->nameSpace,
4363                                      request->objectName,
4364                                      request->assocClass,
4365                                      String::EMPTY,
4366                                      providerCount);
4367 brian.campbell 1.189         }
4368 kumpf          1.262         catch (const CIMException& cimException)
4369 brian.campbell 1.189         {
4370 kumpf          1.256             CIMResponseMessage* response = request->buildResponse();
4371                                  response->cimException = cimException;
4372 brian.campbell 1.189 
4373                                  _enqueueResponse(request, response);
4374                                  PEG_METHOD_EXIT();
4375                                  return;
4376                              }
4377                      
4378 marek          1.264         PEG_TRACE((TRC_DISPATCHER, Tracer::LEVEL4,
4379                                            "providerCount = %u.", providerCount));
4380 brian.campbell 1.189 
4381 kumpf          1.237         // If no provider is registered and the repository isn't the default,
4382                              // return CIM_ERR_NOT_SUPPORTED
4383                      
4384                              if ((providerCount == 0) && !_repository->isDefaultInstanceProvider())
4385                              {
4386                                  PEG_TRACE_STRING(
4387                                      TRC_DISPATCHER,
4388                                      Tracer::LEVEL4,
4389                                      "CIM_ERR_NOT_SUPPORTED for " + request->className.getString());
4390                      
4391 kumpf          1.256             CIMResponseMessage* response = request->buildResponse();
4392                                  response->cimException =
4393                                      PEGASUS_CIM_EXCEPTION(CIM_ERR_NOT_SUPPORTED, String::EMPTY);
4394 kumpf          1.237 
4395                                  _enqueueResponse(request, response);
4396                      
4397                                  PEG_METHOD_EXIT();
4398                                  return;
4399                              }
4400                      
4401 brian.campbell 1.189         //
4402                              // Get the instances from the repository, as necessary
4403                              //
4404                      
4405 kumpf          1.237         // Hold the repository results in a response message.
4406                              // If not using the repository, this pointer is null.
4407 kumpf          1.256         AutoPtr<CIMAssociatorsResponseMessage> response;
4408 brian.campbell 1.189 
4409                              if (_repository->isDefaultInstanceProvider())
4410                              {
4411 kumpf          1.256             response.reset(dynamic_cast<CIMAssociatorsResponseMessage*>(
4412                                      request->buildResponse()));
4413 brian.campbell 1.189 
4414                                  try
4415                                  {
4416 kumpf          1.256                 StatProviderTimeMeasurement providerTime(response.get());
4417                      
4418                                      response->cimObjects = _repository->associators(
4419 brian.campbell 1.189                     request->nameSpace,
4420                                          request->objectName,
4421                                          request->assocClass,
4422                                          request->resultClass,
4423                                          request->role,
4424                                          request->resultRole,
4425                                          request->includeQualifiers,
4426                                          request->includeClassOrigin,
4427                                          request->propertyList);
4428                                  }
4429 kumpf          1.262             catch (const CIMException& exception)
4430 brian.campbell 1.189             {
4431 kumpf          1.256                 response->cimException = exception;
4432 brian.campbell 1.189             }
4433 kumpf          1.262             catch (const Exception& exception)
4434 brian.campbell 1.189             {
4435 kumpf          1.256                 response->cimException = PEGASUS_CIM_EXCEPTION(
4436                                          CIM_ERR_FAILED, exception.getMessage());
4437 brian.campbell 1.189             }
4438 kumpf          1.262             catch (...)
4439 brian.campbell 1.189             {
4440 kumpf          1.256                 response->cimException = PEGASUS_CIM_EXCEPTION(
4441                                          CIM_ERR_FAILED, String::EMPTY);
4442 brian.campbell 1.189             }
4443                      
4444 marek          1.264             PEG_TRACE((TRC_DISPATCHER, Tracer::LEVEL4,
4445 brian.campbell 1.189                 "Associators repository access: class = %s, count = %u.",
4446                                          (const char*)request->objectName.toString().getCString(),
4447 marek          1.264                     response->cimObjects.size()));
4448 kumpf          1.237         }
4449 brian.campbell 1.189 
4450                              //
4451                              // If we have no providers to call, just return what we've got
4452                              //
4453                      
4454                              if (providerCount == 0)
4455                              {
4456 kumpf          1.256              _enqueueResponse(request, response.release());
4457 brian.campbell 1.189              PEG_METHOD_EXIT();
4458                                   return;
4459                              }
4460                      
4461                              //
4462                              // Set up an aggregate object and save the original request message
4463                              //
4464                      
4465 kumpf          1.262         OperationAggregate* poA = new OperationAggregate(
4466 brian.campbell 1.189             new CIMAssociatorsRequestMessage(*request),
4467                                  request->getType(),
4468                                  request->messageId,
4469                                  request->queueIds.top(),
4470                                  request->objectName.getClassName(),
4471                                  request->nameSpace);
4472                      
4473                              poA->_aggregationSN = cimOperationAggregationSN++;
4474 kumpf          1.237 
4475                              // Include the repository response in the aggregation, if applicable
4476 kumpf          1.256         if (response.get() != 0)
4477 kumpf          1.237         {
4478                                  poA->setTotalIssued(providerCount+1);
4479                                  // send the repository's results
4480                                  _forwardRequestForAggregation(
4481                                      String(PEGASUS_QUEUENAME_OPREQDISPATCHER),
4482                                      String(),
4483                                      new CIMAssociatorsRequestMessage(*request),
4484                                      poA,
4485 kumpf          1.256                 response.release());
4486 kumpf          1.237         }
4487                              else
4488                              {
4489                                  poA->setTotalIssued(providerCount);
4490                              }
4491 brian.campbell 1.189 
4492                              for (Uint32 i = 0; i < providerInfos.size(); i++)
4493                              {
4494                                  if (providerInfos[i].hasProvider)
4495                                  {
4496                                      CIMAssociatorsRequestMessage* requestCopy =
4497                                          new CIMAssociatorsRequestMessage(*request);
4498                                      // Insert the association class name to limit the provider
4499                                      // to this class.
4500                                      requestCopy->assocClass = providerInfos[i].className;
4501                      
4502 kumpf          1.262                 if (providerInfos[i].providerIdContainer.get() != 0)
4503                                          requestCopy->operationContext.insert(
4504                                              *(providerInfos[i].providerIdContainer.get()));
4505 brian.campbell 1.189 
4506                                      PEG_TRACE_STRING(TRC_DISPATCHER, Tracer::LEVEL4,
4507                                          "Forwarding to provider for class " +
4508                                          providerInfos[i].className.getString());
4509                                      _forwardRequestForAggregation(providerInfos[i].serviceName,
4510                                          providerInfos[i].controlProviderName, requestCopy, poA);
4511                                      // Note: poA must not be referenced after last "forwardRequest"
4512                                  }
4513                              }
4514                          }  // End of instance processing
4515                      
4516                          PEG_METHOD_EXIT();
4517                          return;
4518                      }
4519                      
4520                      /**$*******************************************************
4521                          handleAssociatorNamesRequest
4522                      **********************************************************/
4523                      
4524                      void CIMOperationRequestDispatcher::handleAssociatorNamesRequest(
4525                          CIMAssociatorNamesRequestMessage* request)
4526 brian.campbell 1.189 {
4527                          PEG_METHOD_ENTER(TRC_DISPATCHER,
4528                              "CIMOperationRequestDispatcher::handleAssociatorNamesRequest");
4529                      
4530                          if (!_enableAssociationTraversal)
4531                          {
4532 kumpf          1.256         CIMResponseMessage* response = request->buildResponse();
4533                              response->cimException =
4534 brian.campbell 1.189             PEGASUS_CIM_EXCEPTION(CIM_ERR_NOT_SUPPORTED, "AssociatorNames");
4535                      
4536                              _enqueueResponse(request, response);
4537                      
4538                              PEG_METHOD_EXIT();
4539                              return;
4540                          }
4541                      
4542 yi.zhou        1.232     // Validate role parameter syntax
4543                          if ((request->role != String::EMPTY) && (!CIMName::legal(request->role)))
4544                          {
4545 kumpf          1.256         CIMResponseMessage* response = request->buildResponse();
4546                              response->cimException =
4547                                  PEGASUS_CIM_EXCEPTION(CIM_ERR_INVALID_PARAMETER, request->role);
4548 yi.zhou        1.232 
4549                              _enqueueResponse(request, response);
4550                      
4551                              PEG_METHOD_EXIT();
4552                              return;
4553                          }
4554                      
4555                          // Validate resultRole parameter syntax
4556                          if ((request->resultRole != String::EMPTY) &&
4557                              (!CIMName::legal(request->resultRole)))
4558                          {
4559 kumpf          1.256         CIMResponseMessage* response = request->buildResponse();
4560                              response->cimException = PEGASUS_CIM_EXCEPTION(
4561 yi.zhou        1.232             CIM_ERR_INVALID_PARAMETER, request->resultRole);
4562                      
4563                              _enqueueResponse(request, response);
4564                      
4565                              PEG_METHOD_EXIT();
4566                              return;
4567                          }
4568                      
4569 brian.campbell 1.189     CIMException checkClassException;
4570                          _checkExistenceOfClass(request->nameSpace,
4571                                                 request->objectName.getClassName(),
4572                                                 checkClassException);
4573                          if (checkClassException.getCode() != CIM_ERR_SUCCESS)
4574                          {
4575 kumpf          1.256         if (checkClassException.getCode() == CIM_ERR_INVALID_CLASS)
4576                              {
4577                                  checkClassException = PEGASUS_CIM_EXCEPTION(
4578                                      CIM_ERR_INVALID_PARAMETER, request->objectName.toString());
4579                              }
4580 brian.campbell 1.189 
4581 kumpf          1.256         CIMResponseMessage* response = request->buildResponse();
4582                              response->cimException = checkClassException;
4583 brian.campbell 1.189 
4584                              _enqueueResponse(request, response);
4585                      
4586                              PEG_METHOD_EXIT();
4587                              return;
4588                          }
4589                      
4590 mike           1.240     PEG_LOGGER_TRACE((Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE,
4591 brian.campbell 1.189         "CIMOperationRequestDispatcher::handleAssociatorNames - "
4592 kumpf          1.262             "Namespace: $0  Class name: $1",
4593 brian.campbell 1.189         request->nameSpace.getString(),
4594 mike           1.240         request->objectName.toString()));
4595 brian.campbell 1.189 
4596                          //  ATTN-CAKG-P2-20020726:  The following condition does not correctly
4597                          //  distinguish instanceNames from classNames in every case
4598                          //  The instanceName of a singleton instance of a keyless class also
4599                          //  has no key bindings
4600                          Boolean isClassRequest =
4601                              (request->objectName.getKeyBindings().size() == 0) ? true : false;
4602                      
4603                          if (isClassRequest)
4604                          {
4605                              //
4606                              // For Class requests, get the results from the repository
4607                              //
4608                      
4609 marek          1.264         PEG_TRACE_CSTRING(TRC_DISPATCHER, Tracer::LEVEL4,
4610 brian.campbell 1.189                       "AssociatorNames executing Class request");
4611                      
4612 kumpf          1.256         AutoPtr<CIMAssociatorNamesResponseMessage> response(
4613                                  dynamic_cast<CIMAssociatorNamesResponseMessage*>(
4614                                      request->buildResponse()));
4615 brian.campbell 1.189 
4616                              try
4617                              {
4618 kumpf          1.256             StatProviderTimeMeasurement providerTime(response.get());
4619                      
4620                                  response->objectNames = _repository->associatorNames(
4621 brian.campbell 1.189                 request->nameSpace,
4622                                      request->objectName,
4623                                      request->assocClass,
4624                                      request->resultClass,
4625                                      request->role,
4626                                      request->resultRole);
4627                              }
4628 kumpf          1.262         catch (const CIMException& exception)
4629 brian.campbell 1.189         {
4630 kumpf          1.256             response->cimException = exception;
4631 brian.campbell 1.189         }
4632 kumpf          1.262         catch (const Exception& exception)
4633 brian.campbell 1.189         {
4634 kumpf          1.256             response->cimException = PEGASUS_CIM_EXCEPTION(
4635                                      CIM_ERR_FAILED, exception.getMessage());
4636 brian.campbell 1.189         }
4637 kumpf          1.262         catch (...)
4638 brian.campbell 1.189         {
4639 kumpf          1.256             response->cimException = PEGASUS_CIM_EXCEPTION(
4640                                      CIM_ERR_FAILED, String::EMPTY);
4641 brian.campbell 1.189         }
4642                      
4643 kumpf          1.256         _enqueueResponse(request, response.release());
4644 brian.campbell 1.189     }
4645                          else
4646                          {
4647                              //
4648                              // For Instance requests, get results from providers and the repository
4649                              //
4650                      
4651                              //
4652                              // Determine list of providers for this request
4653                              //
4654                      
4655                              Array<ProviderInfo> providerInfos;
4656                              Uint32 providerCount;
4657                              try
4658                              {
4659                                  providerInfos = _lookupAllAssociationProviders(
4660                                      request->nameSpace,
4661                                      request->objectName,
4662                                      request->assocClass,
4663                                      String::EMPTY,
4664                                      providerCount);
4665 brian.campbell 1.189         }
4666 kumpf          1.262         catch (const CIMException& cimException)
4667 brian.campbell 1.189         {
4668 kumpf          1.256             CIMResponseMessage* response = request->buildResponse();
4669                                  response->cimException = cimException;
4670 brian.campbell 1.189 
4671                                  _enqueueResponse(request, response);
4672                                  PEG_METHOD_EXIT();
4673                                  return;
4674                              }
4675                      
4676 marek          1.264         PEG_TRACE((TRC_DISPATCHER, Tracer::LEVEL4,
4677                                            "providerCount = %u.", providerCount));
4678 brian.campbell 1.189 
4679 kumpf          1.237         // If no provider is registered and the repository isn't the default,
4680                              // return CIM_ERR_NOT_SUPPORTED
4681                      
4682                              if ((providerCount == 0) && !_repository->isDefaultInstanceProvider())
4683                              {
4684                                  PEG_TRACE_STRING(
4685                                      TRC_DISPATCHER,
4686                                      Tracer::LEVEL4,
4687                                      "CIM_ERR_NOT_SUPPORTED for " + request->className.getString());
4688                      
4689 kumpf          1.256             CIMResponseMessage* response = request->buildResponse();
4690                                  response->cimException =
4691                                      PEGASUS_CIM_EXCEPTION(CIM_ERR_NOT_SUPPORTED, String::EMPTY);
4692 kumpf          1.237 
4693                                  _enqueueResponse(request, response);
4694                      
4695                                  PEG_METHOD_EXIT();
4696                                  return;
4697                              }
4698                      
4699 brian.campbell 1.189         //
4700                              // Get the instances from the repository, as necessary
4701                              //
4702                      
4703 kumpf          1.237         // Hold the repository results in a response message.
4704                              // If not using the repository, this pointer is null.
4705 kumpf          1.256         AutoPtr<CIMAssociatorNamesResponseMessage> response;
4706 brian.campbell 1.189 
4707                              if (_repository->isDefaultInstanceProvider())
4708                              {
4709 kumpf          1.256             response.reset(dynamic_cast<CIMAssociatorNamesResponseMessage*>(
4710                                      request->buildResponse()));
4711 brian.campbell 1.189 
4712                                  try
4713                                  {
4714 kumpf          1.256                 StatProviderTimeMeasurement providerTime(response.get());
4715                      
4716                                      response->objectNames = _repository->associatorNames(
4717 brian.campbell 1.189                     request->nameSpace,
4718                                          request->objectName,
4719                                          request->assocClass,
4720                                          request->resultClass,
4721                                          request->role,
4722                                          request->resultRole);
4723                                  }
4724 kumpf          1.262             catch (const CIMException& exception)
4725 brian.campbell 1.189             {
4726 kumpf          1.256                 response->cimException = exception;
4727 brian.campbell 1.189             }
4728 kumpf          1.262             catch (const Exception& exception)
4729 brian.campbell 1.189             {
4730 kumpf          1.262                 response->cimException = PEGASUS_CIM_EXCEPTION(
4731 kumpf          1.256                     CIM_ERR_FAILED, exception.getMessage());
4732 brian.campbell 1.189             }
4733 kumpf          1.262             catch (...)
4734 brian.campbell 1.189             {
4735 kumpf          1.256                 response->cimException = PEGASUS_CIM_EXCEPTION(
4736                                          CIM_ERR_FAILED, String::EMPTY);
4737 brian.campbell 1.189             }
4738                      
4739 marek          1.264             PEG_TRACE((TRC_DISPATCHER, Tracer::LEVEL4,
4740 brian.campbell 1.189                 "AssociatorNames repository access: class = %s, count = %u.",
4741                                          (const char*)request->objectName.toString().getCString(),
4742 marek          1.264                     response->objectNames.size()));
4743 kumpf          1.237         }
4744 brian.campbell 1.189 
4745                              //
4746                              // If we have no providers to call, just return what we've got
4747                              //
4748                      
4749                              if (providerCount == 0)
4750                              {
4751 kumpf          1.256              _enqueueResponse(request, response.release());
4752 brian.campbell 1.189              PEG_METHOD_EXIT();
4753                                   return;
4754                              }
4755                      
4756                              //
4757                              // Set up an aggregate object and save the original request message
4758                              //
4759                      
4760 kumpf          1.262         OperationAggregate* poA = new OperationAggregate(
4761 brian.campbell 1.189             new CIMAssociatorNamesRequestMessage(*request),
4762                                  request->getType(),
4763                                  request->messageId,
4764                                  request->queueIds.top(),
4765                                  request->objectName.getClassName(),
4766                                  request->nameSpace);
4767                      
4768                              poA->_aggregationSN = cimOperationAggregationSN++;
4769 kumpf          1.237 
4770                              // Include the repository response in the aggregation, if applicable
4771 kumpf          1.256         if (response.get() != 0)
4772 kumpf          1.237         {
4773                                  poA->setTotalIssued(providerCount+1);
4774                                  // send the repository's results
4775                                  _forwardRequestForAggregation(
4776                                      String(PEGASUS_QUEUENAME_OPREQDISPATCHER),
4777                                      String(),
4778                                      new CIMAssociatorNamesRequestMessage(*request),
4779                                      poA,
4780 kumpf          1.256                 response.release());
4781 kumpf          1.237         }
4782                              else
4783                              {
4784                                  poA->setTotalIssued(providerCount);
4785                              }
4786 brian.campbell 1.189 
4787                              for (Uint32 i = 0; i < providerInfos.size(); i++)
4788                              {
4789                                  if (providerInfos[i].hasProvider)
4790                                  {
4791                                      CIMAssociatorNamesRequestMessage* requestCopy =
4792                                          new CIMAssociatorNamesRequestMessage(*request);
4793                                      // Insert the association class name to limit the provider
4794                                      // to this class.
4795                                      requestCopy->assocClass = providerInfos[i].className;
4796                      
4797 kumpf          1.262                 if (providerInfos[i].providerIdContainer.get() != 0)
4798                                          requestCopy->operationContext.insert(
4799                                              *(providerInfos[i].providerIdContainer.get()));
4800 brian.campbell 1.189 
4801                                      PEG_TRACE_STRING(TRC_DISPATCHER, Tracer::LEVEL4,
4802                                          "Forwarding to provider for class " +
4803                                          providerInfos[i].className.getString());
4804                                      _forwardRequestForAggregation(providerInfos[i].serviceName,
4805                                          providerInfos[i].controlProviderName, requestCopy, poA);
4806                                      // Note: poA must not be referenced after last "forwardRequest"
4807                                  }
4808                              }
4809                          }  // End of instance processing
4810                      
4811                          PEG_METHOD_EXIT();
4812                          return;
4813                      }
4814                      
4815                      /**$*******************************************************
4816                          handleReferencesRequest
4817                      **********************************************************/
4818                      
4819                      void CIMOperationRequestDispatcher::handleReferencesRequest(
4820                          CIMReferencesRequestMessage* request)
4821 brian.campbell 1.189 {
4822                          PEG_METHOD_ENTER(TRC_DISPATCHER,
4823                              "CIMOperationRequestDispatcher::handleReferencesRequest");
4824                      
4825                          if (!_enableAssociationTraversal)
4826                          {
4827 kumpf          1.256         CIMResponseMessage* response = request->buildResponse();
4828                              response->cimException =
4829 brian.campbell 1.189             PEGASUS_CIM_EXCEPTION(CIM_ERR_NOT_SUPPORTED, "References");
4830                      
4831                              _enqueueResponse(request, response);
4832                      
4833                              PEG_METHOD_EXIT();
4834                              return;
4835                          }
4836                      
4837 yi.zhou        1.232     // Validate role parameter syntax
4838                          if ((request->role != String::EMPTY) && (!CIMName::legal(request->role)))
4839                          {
4840 kumpf          1.256         CIMResponseMessage* response = request->buildResponse();
4841                              response->cimException =
4842 kumpf          1.262             PEGASUS_CIM_EXCEPTION(CIM_ERR_INVALID_PARAMETER, request->role);
4843 yi.zhou        1.232 
4844                              _enqueueResponse(request, response);
4845                      
4846                              PEG_METHOD_EXIT();
4847                              return;
4848                          }
4849                      
4850 brian.campbell 1.189     CIMException checkClassException;
4851 kumpf          1.262     _checkExistenceOfClass(
4852                              request->nameSpace,
4853                              request->objectName.getClassName(),
4854                              checkClassException);
4855 brian.campbell 1.189     if (checkClassException.getCode() != CIM_ERR_SUCCESS)
4856                          {
4857 kumpf          1.256         if (checkClassException.getCode() == CIM_ERR_INVALID_CLASS)
4858                              {
4859                                  checkClassException = PEGASUS_CIM_EXCEPTION(
4860                                      CIM_ERR_INVALID_PARAMETER, request->objectName.toString());
4861                              }
4862 brian.campbell 1.189 
4863 kumpf          1.256         CIMResponseMessage* response = request->buildResponse();
4864                              response->cimException = checkClassException;
4865 brian.campbell 1.189 
4866                              _enqueueResponse(request, response);
4867                      
4868                              PEG_METHOD_EXIT();
4869                              return;
4870                          }
4871                      
4872 mike           1.240     PEG_LOGGER_TRACE((Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE,
4873 brian.campbell 1.189         "CIMOperationRequestDispatcher::handleReferences - "
4874 kumpf          1.262             "Namespace: $0  Class name: $1",
4875 brian.campbell 1.189         request->nameSpace.getString(),
4876 mike           1.240         request->objectName.toString()));
4877 brian.campbell 1.189 
4878                          //  ATTN-CAKG-P2-20020726:  The following condition does not correctly
4879                          //  distinguish instanceNames from classNames in every case
4880                          //  The instanceName of a singleton instance of a keyless class also
4881                          //  has no key bindings
4882                          Boolean isClassRequest =
4883                              (request->objectName.getKeyBindings().size() == 0) ? true : false;
4884                      
4885                          if (isClassRequest)
4886                          {
4887                              //
4888                              // For Class requests, get the results from the repository
4889                              //
4890                      
4891 marek          1.264         PEG_TRACE_CSTRING(TRC_DISPATCHER, Tracer::LEVEL4,
4892 brian.campbell 1.189                       "References executing Class request");
4893                      
4894 kumpf          1.256         AutoPtr<CIMReferencesResponseMessage> response(
4895                                  dynamic_cast<CIMReferencesResponseMessage*>(
4896                                      request->buildResponse()));
4897 brian.campbell 1.189 
4898                              try
4899                              {
4900 kumpf          1.256             StatProviderTimeMeasurement providerTime(response.get());
4901                      
4902                                  response->cimObjects = _repository->references(
4903 brian.campbell 1.189                 request->nameSpace,
4904                                      request->objectName,
4905                                      request->resultClass,
4906                                      request->role,
4907                                      request->includeQualifiers,
4908                                      request->includeClassOrigin,
4909                                      request->propertyList);
4910                              }
4911 kumpf          1.262         catch (const CIMException& exception)
4912 brian.campbell 1.189         {
4913 kumpf          1.256             response->cimException = exception;
4914 brian.campbell 1.189         }
4915 kumpf          1.262         catch (const Exception& exception)
4916 brian.campbell 1.189         {
4917 kumpf          1.256             response->cimException = PEGASUS_CIM_EXCEPTION(
4918                                      CIM_ERR_FAILED, exception.getMessage());
4919 brian.campbell 1.189         }
4920 kumpf          1.262         catch (...)
4921 brian.campbell 1.189         {
4922 kumpf          1.256             response->cimException = PEGASUS_CIM_EXCEPTION(
4923                                      CIM_ERR_FAILED, String::EMPTY);
4924 brian.campbell 1.189         }
4925                      
4926 kumpf          1.256         _enqueueResponse(request, response.release());
4927 brian.campbell 1.189     }
4928                          else
4929                          {
4930                              //
4931                              // For Instance requests, get results from providers and the repository
4932                              //
4933                      
4934                              //
4935                              // Determine list of providers for this request
4936                              //
4937                      
4938                              Array<ProviderInfo> providerInfos;
4939                              Uint32 providerCount;
4940                              try
4941                              {
4942                                  providerInfos = _lookupAllAssociationProviders(
4943                                      request->nameSpace,
4944                                      request->objectName,
4945                                      request->resultClass,
4946                                      String::EMPTY,
4947                                      providerCount);
4948 brian.campbell 1.189         }
4949 kumpf          1.262         catch (const CIMException& cimException)
4950 brian.campbell 1.189         {
4951 kumpf          1.256             CIMResponseMessage* response = request->buildResponse();
4952                                  response->cimException = cimException;
4953 brian.campbell 1.189 
4954                                  _enqueueResponse(request, response);
4955                                  PEG_METHOD_EXIT();
4956                                  return;
4957                              }
4958                      
4959 marek          1.264         PEG_TRACE((TRC_DISPATCHER, Tracer::LEVEL4,
4960                                            "providerCount = %u.", providerCount));
4961 brian.campbell 1.189 
4962 kumpf          1.237         // If no provider is registered and the repository isn't the default,
4963                              // return CIM_ERR_NOT_SUPPORTED
4964                      
4965                              if ((providerCount == 0) && !_repository->isDefaultInstanceProvider())
4966                              {
4967                                  PEG_TRACE_STRING(
4968                                      TRC_DISPATCHER,
4969                                      Tracer::LEVEL4,
4970                                      "CIM_ERR_NOT_SUPPORTED for " + request->className.getString());
4971                      
4972 kumpf          1.256             CIMResponseMessage* response = request->buildResponse();
4973                                  response->cimException =
4974                                      PEGASUS_CIM_EXCEPTION(CIM_ERR_NOT_SUPPORTED, String::EMPTY);
4975 kumpf          1.237 
4976                                  _enqueueResponse(request, response);
4977                      
4978                                  PEG_METHOD_EXIT();
4979                                  return;
4980                              }
4981                      
4982 brian.campbell 1.189         //
4983                              // Get the instances from the repository, as necessary
4984                              //
4985                      
4986 kumpf          1.237         // Hold the repository results in a response message.
4987                              // If not using the repository, this pointer is null.
4988 kumpf          1.256         AutoPtr<CIMReferencesResponseMessage> response;
4989 brian.campbell 1.189 
4990                              if (_repository->isDefaultInstanceProvider())
4991                              {
4992 kumpf          1.256             response.reset(dynamic_cast<CIMReferencesResponseMessage*>(
4993                                      request->buildResponse()));
4994 brian.campbell 1.189 
4995                                  try
4996                                  {
4997 kumpf          1.256                 StatProviderTimeMeasurement providerTime(response.get());
4998                      
4999                                      response->cimObjects = _repository->references(
5000 brian.campbell 1.189                     request->nameSpace,
5001                                          request->objectName,
5002                                          request->resultClass,
5003                                          request->role,
5004                                          request->includeQualifiers,
5005                                          request->includeClassOrigin,
5006                                          request->propertyList);
5007                                  }
5008 kumpf          1.262             catch (const CIMException& exception)
5009 brian.campbell 1.189             {
5010 kumpf          1.256                 response->cimException = exception;
5011 brian.campbell 1.189             }
5012 kumpf          1.262             catch (const Exception& exception)
5013 brian.campbell 1.189             {
5014 kumpf          1.256                 response->cimException = PEGASUS_CIM_EXCEPTION(
5015                                          CIM_ERR_FAILED, exception.getMessage());
5016 brian.campbell 1.189             }
5017 kumpf          1.262             catch (...)
5018 brian.campbell 1.189             {
5019 kumpf          1.256                 response->cimException = PEGASUS_CIM_EXCEPTION(
5020                                          CIM_ERR_FAILED, String::EMPTY);
5021 brian.campbell 1.189             }
5022                      
5023 marek          1.264             PEG_TRACE((TRC_DISPATCHER, Tracer::LEVEL4,
5024 brian.campbell 1.189                 "References repository access: class = %s, count = %u.",
5025                                          (const char*)request->objectName.toString().getCString(),
5026 marek          1.264                     response->cimObjects.size()));
5027 kumpf          1.237         }
5028 brian.campbell 1.189 
5029                              //
5030                              // If we have no providers to call, just return what we've got
5031                              //
5032                      
5033                              if (providerCount == 0)
5034                              {
5035 kumpf          1.256              _enqueueResponse(request, response.release());
5036 brian.campbell 1.189              PEG_METHOD_EXIT();
5037                                   return;
5038                              }
5039                      
5040                              //
5041                              // Set up an aggregate object and save the original request message
5042                              //
5043                      
5044 kumpf          1.262         OperationAggregate* poA = new OperationAggregate(
5045 brian.campbell 1.189             new CIMReferencesRequestMessage(*request),
5046                                  request->getType(),
5047                                  request->messageId,
5048                                  request->queueIds.top(),
5049                                  request->objectName.getClassName(),
5050                                  request->nameSpace);
5051                      
5052                              poA->_aggregationSN = cimOperationAggregationSN++;
5053 kumpf          1.237 
5054                              // Include the repository response in the aggregation, if applicable
5055 kumpf          1.256         if (response.get() != 0)
5056 kumpf          1.237         {
5057                                  poA->setTotalIssued(providerCount+1);
5058                                  // send the repository's results
5059                                  _forwardRequestForAggregation(
5060                                      String(PEGASUS_QUEUENAME_OPREQDISPATCHER),
5061                                      String(),
5062                                      new CIMReferencesRequestMessage(*request),
5063                                      poA,
5064 kumpf          1.256                 response.release());
5065 kumpf          1.237         }
5066                              else
5067                              {
5068                                  poA->setTotalIssued(providerCount);
5069                              }
5070 brian.campbell 1.189 
5071                              for (Uint32 i = 0; i < providerInfos.size(); i++)
5072                              {
5073                                  if (providerInfos[i].hasProvider)
5074                                  {
5075                                      CIMReferencesRequestMessage* requestCopy =
5076                                          new CIMReferencesRequestMessage(*request);
5077                                      // Insert the association class name to limit the provider
5078                                      // to this class.
5079                                      requestCopy->resultClass = providerInfos[i].className;
5080                      
5081 kumpf          1.262                 if (providerInfos[i].providerIdContainer.get() != 0)
5082                                          requestCopy->operationContext.insert(
5083                                              *(providerInfos[i].providerIdContainer.get()));
5084 brian.campbell 1.189 
5085                                      PEG_TRACE_STRING(TRC_DISPATCHER, Tracer::LEVEL4,
5086                                          "Forwarding to provider for class " +
5087                                          providerInfos[i].className.getString());
5088                                      _forwardRequestForAggregation(providerInfos[i].serviceName,
5089                                          providerInfos[i].controlProviderName, requestCopy, poA);
5090                                      // Note: poA must not be referenced after last "forwardRequest"
5091                                  }
5092                              }
5093                          }  // End of instance processing
5094                      
5095                          PEG_METHOD_EXIT();
5096                          return;
5097                      }
5098                      
5099                      /**$*******************************************************
5100                          handleReferenceNamesRequest
5101                      **********************************************************/
5102                      
5103                      void CIMOperationRequestDispatcher::handleReferenceNamesRequest(
5104                          CIMReferenceNamesRequestMessage* request)
5105 brian.campbell 1.189 {
5106                          PEG_METHOD_ENTER(TRC_DISPATCHER,
5107                              "CIMOperationRequestDispatcher::handleReferenceNamesRequest");
5108                      
5109                          if (!_enableAssociationTraversal)
5110                          {
5111 kumpf          1.256         CIMResponseMessage* response = request->buildResponse();
5112                              response->cimException =
5113 brian.campbell 1.189             PEGASUS_CIM_EXCEPTION(CIM_ERR_NOT_SUPPORTED, "ReferenceNames");
5114                      
5115                              _enqueueResponse(request, response);
5116                      
5117                              PEG_METHOD_EXIT();
5118                              return;
5119                          }
5120                      
5121 yi.zhou        1.232     // Validate role parameter syntax
5122                          if ((request->role != String::EMPTY) && (!CIMName::legal(request->role)))
5123                          {
5124 kumpf          1.256         CIMResponseMessage* response = request->buildResponse();
5125                              response->cimException =
5126 kumpf          1.262             PEGASUS_CIM_EXCEPTION(CIM_ERR_INVALID_PARAMETER, request->role);
5127 yi.zhou        1.232 
5128                              _enqueueResponse(request, response);
5129                      
5130                              PEG_METHOD_EXIT();
5131                              return;
5132                          }
5133                      
5134 brian.campbell 1.189     CIMException checkClassException;
5135                          _checkExistenceOfClass(request->nameSpace,
5136                                                 request->objectName.getClassName(),
5137                                                 checkClassException);
5138                          if (checkClassException.getCode() != CIM_ERR_SUCCESS)
5139                          {
5140 kumpf          1.256         if (checkClassException.getCode() == CIM_ERR_INVALID_CLASS)
5141                              {
5142                                  checkClassException = PEGASUS_CIM_EXCEPTION(
5143                                      CIM_ERR_INVALID_PARAMETER, request->objectName.toString());
5144                              }
5145 brian.campbell 1.189 
5146 kumpf          1.256         CIMResponseMessage* response = request->buildResponse();
5147                              response->cimException = checkClassException;
5148 brian.campbell 1.189 
5149                              _enqueueResponse(request, response);
5150                      
5151                              PEG_METHOD_EXIT();
5152                              return;
5153                          }
5154                      
5155 mike           1.240     PEG_LOGGER_TRACE((Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE,
5156 brian.campbell 1.189         "CIMOperationRequestDispatcher::handleReferenceNames - "
5157 kumpf          1.262             "Namespace: $0  Class name: $1",
5158 brian.campbell 1.189         request->nameSpace.getString(),
5159 mike           1.240         request->objectName.toString()));
5160 brian.campbell 1.189 
5161                          //  ATTN-CAKG-P2-20020726:  The following condition does not correctly
5162                          //  distinguish instanceNames from classNames in every case
5163                          //  The instanceName of a singleton instance of a keyless class also
5164                          //  has no key bindings
5165                          Boolean isClassRequest =
5166                              (request->objectName.getKeyBindings().size() == 0) ? true : false;
5167                      
5168                          if (isClassRequest)
5169                          {
5170                              //
5171                              // For Class requests, get the results from the repository
5172                              //
5173                      
5174 marek          1.264         PEG_TRACE_CSTRING(TRC_DISPATCHER, Tracer::LEVEL4,
5175 brian.campbell 1.189                       "ReferenceNames executing Class request");
5176                      
5177 kumpf          1.256         AutoPtr<CIMReferenceNamesResponseMessage> response(
5178                                  dynamic_cast<CIMReferenceNamesResponseMessage*>(
5179                                      request->buildResponse()));
5180 brian.campbell 1.189 
5181                              try
5182                              {
5183 kumpf          1.256             StatProviderTimeMeasurement providerTime(response.get());
5184                      
5185                                  response->objectNames = _repository->referenceNames(
5186 brian.campbell 1.189                 request->nameSpace,
5187                                      request->objectName,
5188                                      request->resultClass,
5189                                      request->role);
5190                              }
5191 kumpf          1.262         catch (const CIMException& exception)
5192 brian.campbell 1.189         {
5193 kumpf          1.256             response->cimException = exception;
5194 brian.campbell 1.189         }
5195 kumpf          1.262         catch (const Exception& exception)
5196 brian.campbell 1.189         {
5197 kumpf          1.256             response->cimException = PEGASUS_CIM_EXCEPTION(
5198                                      CIM_ERR_FAILED, exception.getMessage());
5199 brian.campbell 1.189         }
5200 kumpf          1.262         catch (...)
5201 brian.campbell 1.189         {
5202 kumpf          1.256             response->cimException = PEGASUS_CIM_EXCEPTION(
5203                                      CIM_ERR_FAILED, String::EMPTY);
5204 brian.campbell 1.189         }
5205                      
5206 kumpf          1.256         _enqueueResponse(request, response.release());
5207 brian.campbell 1.189     }
5208                          else
5209                          {
5210                              //
5211                              // For Instance requests, get results from providers and the repository
5212                              //
5213                      
5214                              //
5215                              // Determine list of providers for this request
5216                              //
5217                      
5218                              Array<ProviderInfo> providerInfos;
5219                              Uint32 providerCount;
5220                              try
5221                              {
5222                                  providerInfos = _lookupAllAssociationProviders(
5223                                      request->nameSpace,
5224                                      request->objectName,
5225                                      request->resultClass,
5226                                      String::EMPTY,
5227                                      providerCount);
5228 brian.campbell 1.189         }
5229 kumpf          1.262         catch (const CIMException& cimException)
5230 brian.campbell 1.189         {
5231 kumpf          1.256             CIMResponseMessage* response = request->buildResponse();
5232                                  response->cimException = cimException;
5233 brian.campbell 1.189 
5234                                  _enqueueResponse(request, response);
5235                                  PEG_METHOD_EXIT();
5236                                  return;
5237                              }
5238                      
5239 marek          1.264         PEG_TRACE((TRC_DISPATCHER, Tracer::LEVEL4,
5240                                            "providerCount = %u.", providerCount));
5241 brian.campbell 1.189 
5242 kumpf          1.237         // If no provider is registered and the repository isn't the default,
5243                              // return CIM_ERR_NOT_SUPPORTED
5244                      
5245                              if ((providerCount == 0) && !_repository->isDefaultInstanceProvider())
5246                              {
5247                                  PEG_TRACE_STRING(
5248                                      TRC_DISPATCHER,
5249                                      Tracer::LEVEL4,
5250                                      "CIM_ERR_NOT_SUPPORTED for " + request->className.getString());
5251                      
5252 kumpf          1.256             CIMResponseMessage* response = request->buildResponse();
5253                                  response->cimException =
5254                                      PEGASUS_CIM_EXCEPTION(CIM_ERR_NOT_SUPPORTED, String::EMPTY);
5255 kumpf          1.237 
5256                                  _enqueueResponse(request, response);
5257                      
5258                                  PEG_METHOD_EXIT();
5259                                  return;
5260                              }
5261                      
5262 brian.campbell 1.189         //
5263                              // Get the instances from the repository, as necessary
5264                              //
5265                      
5266 kumpf          1.237         // Hold the repository results in a response message.
5267                              // If not using the repository, this pointer is null.
5268 kumpf          1.256         AutoPtr<CIMReferenceNamesResponseMessage> response;
5269 brian.campbell 1.189 
5270                              if (_repository->isDefaultInstanceProvider())
5271                              {
5272 kumpf          1.256             response.reset(dynamic_cast<CIMReferenceNamesResponseMessage*>(
5273                                      request->buildResponse()));
5274 brian.campbell 1.189 
5275                                  try
5276                                  {
5277 kumpf          1.256                 StatProviderTimeMeasurement providerTime(response.get());
5278                      
5279                                      response->objectNames = _repository->referenceNames(
5280 brian.campbell 1.189                     request->nameSpace,
5281                                          request->objectName,
5282                                          request->resultClass,
5283                                          request->role);
5284                                  }
5285 kumpf          1.262             catch (const CIMException& exception)
5286 brian.campbell 1.189             {
5287 kumpf          1.256                 response->cimException = exception;
5288 brian.campbell 1.189             }
5289 kumpf          1.262             catch (const Exception& exception)
5290 brian.campbell 1.189             {
5291 kumpf          1.256                 response->cimException = PEGASUS_CIM_EXCEPTION(
5292                                          CIM_ERR_FAILED, exception.getMessage());
5293 brian.campbell 1.189             }
5294 kumpf          1.262             catch (...)
5295 brian.campbell 1.189             {
5296 kumpf          1.256                 response->cimException = PEGASUS_CIM_EXCEPTION(
5297                                          CIM_ERR_FAILED, String::EMPTY);
5298 brian.campbell 1.189             }
5299                      
5300 marek          1.264             PEG_TRACE((TRC_DISPATCHER, Tracer::LEVEL4,
5301 brian.campbell 1.189                 "ReferenceNames repository access: class = %s, count = %u.",
5302                                          (const char*)request->objectName.toString().getCString(),
5303 marek          1.264                     response->objectNames.size()));
5304 kumpf          1.237         }
5305 brian.campbell 1.189 
5306                              //
5307                              // If we have no providers to call, just return what we've got
5308                              //
5309                      
5310                              if (providerCount == 0)
5311                              {
5312 kumpf          1.256              _enqueueResponse(request, response.release());
5313 brian.campbell 1.189              PEG_METHOD_EXIT();
5314                                   return;
5315                              }
5316                      
5317                              //
5318                              // Set up an aggregate object and save the original request message
5319                              //
5320                      
5321 kumpf          1.262         OperationAggregate* poA = new OperationAggregate(
5322 brian.campbell 1.189             new CIMReferenceNamesRequestMessage(*request),
5323                                  request->getType(),
5324                                  request->messageId,
5325                                  request->queueIds.top(),
5326                                  request->objectName.getClassName(),
5327                                  request->nameSpace);
5328                      
5329                              poA->_aggregationSN = cimOperationAggregationSN++;
5330 kumpf          1.237 
5331                              // Include the repository response in the aggregation, if applicable
5332 kumpf          1.256         if (response.get() != 0)
5333 kumpf          1.237         {
5334                                  poA->setTotalIssued(providerCount+1);
5335                                  _forwardRequestForAggregation(
5336                                      String(PEGASUS_QUEUENAME_OPREQDISPATCHER),
5337                                      String(),
5338                                      new CIMReferenceNamesRequestMessage(*request),
5339                                      poA,
5340 kumpf          1.256                 response.release());
5341 kumpf          1.237         }
5342                              else
5343                              {
5344                                  poA->setTotalIssued(providerCount);
5345                              }
5346 brian.campbell 1.189 
5347                              for (Uint32 i = 0; i < providerInfos.size(); i++)
5348                              {
5349                                  if (providerInfos[i].hasProvider)
5350                                  {
5351                                      CIMReferenceNamesRequestMessage* requestCopy =
5352                                          new CIMReferenceNamesRequestMessage(*request);
5353                                      // Insert the association class name to limit the provider
5354                                      // to this class.
5355                                      requestCopy->resultClass = providerInfos[i].className;
5356                      
5357 kumpf          1.262                 if (providerInfos[i].providerIdContainer.get() != 0)
5358                                          requestCopy->operationContext.insert(
5359                                              *(providerInfos[i].providerIdContainer.get()));
5360 brian.campbell 1.189 
5361                                      PEG_TRACE_STRING(TRC_DISPATCHER, Tracer::LEVEL4,
5362                                          "Forwarding to provider for class " +
5363                                          providerInfos[i].className.getString());
5364                                      _forwardRequestForAggregation(providerInfos[i].serviceName,
5365                                          providerInfos[i].controlProviderName, requestCopy, poA);
5366                                      // Note: poA must not be referenced after last "forwardRequest"
5367                                  }
5368                              }
5369                          }  // End of instance processing
5370                      
5371                          PEG_METHOD_EXIT();
5372                          return;
5373                      }
5374                      
5375                      /**$*******************************************************
5376                          handleGetPropertyRequest
5377                          ATTN: FIX LOOKUP
5378                      **********************************************************/
5379                      
5380                      void CIMOperationRequestDispatcher::handleGetPropertyRequest(
5381 brian.campbell 1.189    CIMGetPropertyRequestMessage* request)
5382                      {
5383                         PEG_METHOD_ENTER(TRC_DISPATCHER,
5384                            "CIMOperationRequestDispatcher::handleGetPropertyRequest");
5385                      
5386                         CIMName className = request->instanceName.getClassName();
5387                      
5388                         // check the class name for an "external provider"
5389                         // Assumption here is that there are no "internal" property requests.
5390                         // teATTN: KS 20030402 - This needs cleanup along with the setproperty.
5391                      
5392 chip           1.219    ProviderInfo providerInfo =
5393                             _lookupInstanceProvider(
5394                                 request->nameSpace,
5395                                 className);
5396 brian.campbell 1.189 
5397 kumpf          1.262    if (providerInfo.hasProvider)
5398 brian.campbell 1.189    {
5399 chip           1.219        CIMGetPropertyRequestMessage* requestCopy =
5400                                 new CIMGetPropertyRequestMessage(*request);
5401                      
5402 kumpf          1.262        if (providerInfo.providerIdContainer.get() != 0)
5403 chip           1.219        {
5404 kumpf          1.262            requestCopy->operationContext.insert(
5405                                     *providerInfo.providerIdContainer.get());
5406 chip           1.219        }
5407 brian.campbell 1.189 
5408 kumpf          1.259        CIMGetPropertyRequestMessage* requestCallbackCopy =
5409                                 new CIMGetPropertyRequestMessage(*requestCopy);
5410 chip           1.219 
5411                             _forwardRequestToService(
5412 kumpf          1.259            PEGASUS_QUEUENAME_PROVIDERMANAGER_CPP,
5413                                 requestCopy,
5414                                 requestCallbackCopy);
5415 chip           1.219 
5416                             PEG_METHOD_EXIT();
5417                             return;
5418 brian.campbell 1.189    }
5419                         else if (_repository->isDefaultInstanceProvider())
5420                         {
5421 kumpf          1.256       AutoPtr<CIMGetPropertyResponseMessage> response(
5422                                dynamic_cast<CIMGetPropertyResponseMessage*>(
5423                                    request->buildResponse()));
5424 brian.campbell 1.189 
5425                            try
5426                            {
5427 kumpf          1.256           StatProviderTimeMeasurement providerTime(response.get());
5428                      
5429                                response->value = _repository->getProperty(
5430                                    request->nameSpace,
5431                                    request->instanceName,
5432                                    request->propertyName);
5433 brian.campbell 1.189       }
5434 kumpf          1.262       catch (const CIMException& exception)
5435 brian.campbell 1.189       {
5436 kumpf          1.256           response->cimException = exception;
5437 brian.campbell 1.189       }
5438 kumpf          1.262       catch (const Exception& exception)
5439 brian.campbell 1.189       {
5440 kumpf          1.256           response->cimException = PEGASUS_CIM_EXCEPTION(
5441                                    CIM_ERR_FAILED, exception.getMessage());
5442 brian.campbell 1.189       }
5443 kumpf          1.262       catch (...)
5444 brian.campbell 1.189       {
5445 kumpf          1.256           response->cimException = PEGASUS_CIM_EXCEPTION(
5446                                    CIM_ERR_FAILED, String::EMPTY);
5447 brian.campbell 1.189       }
5448                      
5449 kumpf          1.256       _enqueueResponse(request, response.release());
5450 brian.campbell 1.189    }
5451                         else // No provider is registered and the repository isn't the default
5452                         {
5453 kumpf          1.256        CIMResponseMessage* response = request->buildResponse();
5454                             response->cimException =
5455                                 PEGASUS_CIM_EXCEPTION(CIM_ERR_NOT_SUPPORTED, String::EMPTY);
5456 brian.campbell 1.189 
5457                            _enqueueResponse(request, response);
5458                         }
5459                         PEG_METHOD_EXIT();
5460                      }
5461                      
5462                      /**$*******************************************************
5463                          handleSetPropertyRequest
5464                          ATTN: FIX LOOKUP
5465                      **********************************************************/
5466                      
5467                      void CIMOperationRequestDispatcher::handleSetPropertyRequest(
5468                         CIMSetPropertyRequestMessage* request)
5469                      {
5470 kumpf          1.262     PEG_METHOD_ENTER(TRC_DISPATCHER,
5471                              "CIMOperationRequestDispatcher::handleSetPropertyRequest");
5472                      
5473                          {
5474                              CIMException cimException;
5475                              try
5476                              {
5477                                  _fixSetPropertyValueType(request);
5478                              }
5479                              catch (CIMException& exception)
5480                              {
5481                                  cimException = exception;
5482                              }
5483                              catch (const Exception& exception)
5484                              {
5485                                  cimException =
5486                                      PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED, exception.getMessage());
5487                              }
5488                              catch (...)
5489                              {
5490                                  cimException = PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED, String::EMPTY);
5491 kumpf          1.262         }
5492 brian.campbell 1.189 
5493 kumpf          1.262         if (cimException.getCode() != CIM_ERR_SUCCESS)
5494                              {
5495                                  PEG_LOGGER_TRACE((
5496                                      Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE,
5497                                      "CIMOperationRequestDispatcher::handleSetPropertyRequest - "
5498                                          "CIM exception has occurred."));
5499 brian.campbell 1.189 
5500 kumpf          1.262             CIMResponseMessage* response = request->buildResponse();
5501                                  response->cimException = cimException;
5502 brian.campbell 1.189 
5503 kumpf          1.262             _enqueueResponse(request, response);
5504 brian.campbell 1.189 
5505 kumpf          1.262             PEG_METHOD_EXIT();
5506                                  return;
5507                              }
5508                          }
5509 brian.campbell 1.189 
5510 kumpf          1.262     CIMName className = request->instanceName.getClassName();
5511 brian.campbell 1.189 
5512 kumpf          1.262     // check the class name for an "external provider"
5513                          ProviderInfo providerInfo = _lookupInstanceProvider(
5514                              request->nameSpace,
5515                              className);
5516 brian.campbell 1.189 
5517 kumpf          1.262     if (providerInfo.hasProvider)
5518                          {
5519                              CIMSetPropertyRequestMessage* requestCopy =
5520                                  new CIMSetPropertyRequestMessage(*request);
5521 brian.campbell 1.189 
5522 kumpf          1.262         if (providerInfo.providerIdContainer.get() != 0)
5523                              {
5524                                  requestCopy->operationContext.insert(
5525                                      *providerInfo.providerIdContainer.get());
5526                              }
5527 brian.campbell 1.189 
5528 kumpf          1.262         CIMSetPropertyRequestMessage* requestCallbackCopy =
5529                                  new CIMSetPropertyRequestMessage(*requestCopy);
5530 r.kieninger    1.197 
5531 kumpf          1.262         _forwardRequestToService(
5532                                  PEGASUS_QUEUENAME_PROVIDERMANAGER_CPP,
5533                                  requestCopy,
5534                                  requestCallbackCopy);
5535 chip           1.219 
5536 kumpf          1.262         PEG_METHOD_EXIT();
5537                              return;
5538                          }
5539                          else if (_repository->isDefaultInstanceProvider())
5540                          {
5541                              AutoPtr<CIMSetPropertyResponseMessage> response(
5542                                  dynamic_cast<CIMSetPropertyResponseMessage*>(
5543                                      request->buildResponse()));
5544 chip           1.219 
5545 kumpf          1.262         try
5546                              {
5547                                  StatProviderTimeMeasurement providerTime(response.get());
5548 brian.campbell 1.189 
5549 kumpf          1.262             _repository->setProperty(
5550                                      request->nameSpace,
5551                                      request->instanceName,
5552                                      request->propertyName,
5553                                      request->newValue,
5554                                      ((ContentLanguageListContainer)request->operationContext.get(
5555                                          ContentLanguageListContainer::NAME)).getLanguages());
5556 kumpf          1.256 
5557 kumpf          1.262             PEG_LOGGER_TRACE((
5558                                      Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE,
5559                                      "CIMOperationRequestDispatcher::handleSetPropertyRequest - "
5560                                          "Namespace: $0  Instance Name: $1  Property Name: $2  New "
5561                                          "Value: $3",
5562                                      request->nameSpace.getString(),
5563                                      request->instanceName.getClassName().getString(),
5564                                      request->propertyName.getString(),
5565                                      request->newValue.toString()));
5566                              }
5567                              catch (const CIMException& exception)
5568                              {
5569                                  response->cimException = exception;
5570                              }
5571                              catch (const Exception& exception)
5572                              {
5573                                  response->cimException = PEGASUS_CIM_EXCEPTION(
5574                                      CIM_ERR_FAILED, exception.getMessage());
5575                              }
5576                              catch (...)
5577                              {
5578 kumpf          1.262             response->cimException = PEGASUS_CIM_EXCEPTION(
5579                                      CIM_ERR_FAILED, String::EMPTY);
5580                              }
5581 brian.campbell 1.189 
5582 kumpf          1.262         _enqueueResponse(request, response.release());
5583                          }
5584                          else // No provider is registered and the repository isn't the default
5585                          {
5586                              CIMResponseMessage* response = request->buildResponse();
5587                              response->cimException =
5588                                  PEGASUS_CIM_EXCEPTION(CIM_ERR_NOT_SUPPORTED, String::EMPTY);
5589 brian.campbell 1.189 
5590 kumpf          1.262         _enqueueResponse(request, response);
5591                          }
5592 brian.campbell 1.189 
5593 kumpf          1.262     PEG_METHOD_EXIT();
5594 brian.campbell 1.189 }
5595                      
5596                      /**$*******************************************************
5597                          handleGetQualifierRequest
5598                      **********************************************************/
5599                      
5600                      void CIMOperationRequestDispatcher::handleGetQualifierRequest(
5601 kumpf          1.262     CIMGetQualifierRequestMessage* request)
5602 brian.campbell 1.189 {
5603 kumpf          1.262     PEG_METHOD_ENTER(TRC_DISPATCHER,
5604                              "CIMOperationRequestDispatcher::handleGetQualifierRequest");
5605                      
5606                          AutoPtr<CIMGetQualifierResponseMessage> response(
5607                              dynamic_cast<CIMGetQualifierResponseMessage*>(
5608                                  request->buildResponse()));
5609 brian.campbell 1.189 
5610 kumpf          1.262     try
5611                          {
5612                              StatProviderTimeMeasurement providerTime(response.get());
5613 brian.campbell 1.189 
5614 kumpf          1.262         response->cimQualifierDecl = _repository->getQualifier(
5615                                  request->nameSpace,
5616                                  request->qualifierName);
5617 kumpf          1.256 
5618 kumpf          1.262         PEG_LOGGER_TRACE((
5619                                  Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE,
5620                                  "CIMOperationRequestDispatcher::handleGetQualifierRequest - "
5621                                      "Namespace: $0  Qualifier Name: $1",
5622                                  request->nameSpace.getString(),
5623                                  request->qualifierName.getString()));
5624                          }
5625                          catch (const CIMException& exception)
5626                          {
5627                              response->cimException = exception;
5628                          }
5629                          catch (const Exception& exception)
5630                          {
5631                              response->cimException = PEGASUS_CIM_EXCEPTION(
5632                                  CIM_ERR_FAILED, exception.getMessage());
5633                          }
5634                          catch (...)
5635                          {
5636                              response->cimException = PEGASUS_CIM_EXCEPTION(
5637                                  CIM_ERR_FAILED, String::EMPTY);
5638                          }
5639 brian.campbell 1.189 
5640 kumpf          1.262     _enqueueResponse(request, response.release());
5641 brian.campbell 1.189 
5642 kumpf          1.262     PEG_METHOD_EXIT();
5643 brian.campbell 1.189 }
5644                      
5645                      /**$*******************************************************
5646                          handleSetQualifierRequest
5647                      **********************************************************/
5648                      
5649                      void CIMOperationRequestDispatcher::handleSetQualifierRequest(
5650 kumpf          1.262     CIMSetQualifierRequestMessage* request)
5651 brian.campbell 1.189 {
5652 kumpf          1.262     PEG_METHOD_ENTER(TRC_DISPATCHER,
5653                              "CIMOperationRequestDispatcher::handleSetQualifierRequest");
5654                      
5655                          AutoPtr<CIMSetQualifierResponseMessage> response(
5656                              dynamic_cast<CIMSetQualifierResponseMessage*>(
5657                                  request->buildResponse()));
5658 brian.campbell 1.189 
5659 kumpf          1.262     try
5660                          {
5661                              StatProviderTimeMeasurement providerTime(response.get());
5662 brian.campbell 1.189 
5663 kumpf          1.262         _repository->setQualifier(
5664                                  request->nameSpace,
5665                                  request->qualifierDeclaration,
5666                                  ((ContentLanguageListContainer)request->operationContext.get(
5667                                      ContentLanguageListContainer::NAME)).getLanguages());
5668 kumpf          1.256 
5669 kumpf          1.262         PEG_LOGGER_TRACE((
5670                                  Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE,
5671                              "CIMOperationRequestDispatcher::handleSetQualifierRequest - "
5672                                  "Namespace: $0  Qualifier Name: $1",
5673                              request->nameSpace.getString(),
5674                              request->qualifierDeclaration.getName().getString()));
5675                          }
5676                          catch (const CIMException& exception)
5677                          {
5678                              response->cimException = exception;
5679                          }
5680                          catch (const Exception& exception)
5681                          {
5682                              response->cimException = PEGASUS_CIM_EXCEPTION(
5683                                  CIM_ERR_FAILED, exception.getMessage());
5684                          }
5685                          catch (...)
5686                          {
5687                              response->cimException = PEGASUS_CIM_EXCEPTION(
5688                                  CIM_ERR_FAILED, String::EMPTY);
5689                          }
5690 brian.campbell 1.189 
5691 kumpf          1.262     _enqueueResponse(request, response.release());
5692 brian.campbell 1.189 
5693 kumpf          1.262     PEG_METHOD_EXIT();
5694 brian.campbell 1.189 }
5695                      
5696                      /**$*******************************************************
5697                          handleDeleteQualifierRequest
5698                      **********************************************************/
5699                      
5700                      void CIMOperationRequestDispatcher::handleDeleteQualifierRequest(
5701 kumpf          1.262     CIMDeleteQualifierRequestMessage* request)
5702 brian.campbell 1.189 {
5703 kumpf          1.262     PEG_METHOD_ENTER(TRC_DISPATCHER,
5704                              "CIMOperationRequestDispatcher::handleDeleteQualifierRequest");
5705                      
5706                          AutoPtr<CIMDeleteQualifierResponseMessage> response(
5707                              dynamic_cast<CIMDeleteQualifierResponseMessage*>(
5708                                  request->buildResponse()));
5709 brian.campbell 1.189 
5710 kumpf          1.262     try
5711                          {
5712                              StatProviderTimeMeasurement providerTime(response.get());
5713 brian.campbell 1.189 
5714 kumpf          1.262         _repository->deleteQualifier(
5715                                  request->nameSpace,
5716                                  request->qualifierName);
5717 kumpf          1.256 
5718 kumpf          1.262         PEG_LOGGER_TRACE((
5719                                  Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE,
5720                                  "CIMOperationRequestDispatcher::handleDeleteQualifierRequest - "
5721                                      "Namespace: $0  Qualifier Name: $1",
5722                                  request->nameSpace.getString(),
5723                                  request->qualifierName.getString()));
5724                          }
5725                          catch (const CIMException& exception)
5726                          {
5727                              response->cimException = exception;
5728                          }
5729                          catch (const Exception& exception)
5730                          {
5731                              response->cimException = PEGASUS_CIM_EXCEPTION(
5732                                  CIM_ERR_FAILED, exception.getMessage());
5733                          }
5734                          catch (...)
5735                          {
5736                              response->cimException = PEGASUS_CIM_EXCEPTION(
5737                                  CIM_ERR_FAILED, String::EMPTY);
5738                          }
5739 brian.campbell 1.189 
5740 kumpf          1.262     _enqueueResponse(request, response.release());
5741 brian.campbell 1.189 
5742 kumpf          1.262     PEG_METHOD_EXIT();
5743 brian.campbell 1.189 }
5744                      
5745                      /**$*******************************************************
5746                          handleEnumerateQualifiersRequest
5747                      **********************************************************/
5748                      
5749                      void CIMOperationRequestDispatcher::handleEnumerateQualifiersRequest(
5750 kumpf          1.262     CIMEnumerateQualifiersRequestMessage* request)
5751 brian.campbell 1.189 {
5752 kumpf          1.262     PEG_METHOD_ENTER(TRC_DISPATCHER,
5753                              "CIMOperationRequestDispatcher::handleEnumerateQualifiersRequest");
5754 brian.campbell 1.189 
5755 kumpf          1.262     AutoPtr<CIMEnumerateQualifiersResponseMessage> response(
5756                              dynamic_cast<CIMEnumerateQualifiersResponseMessage*>(
5757                                  request->buildResponse()));
5758 brian.campbell 1.189 
5759 kumpf          1.262     try
5760                          {
5761                              StatProviderTimeMeasurement providerTime(response.get());
5762 kumpf          1.256 
5763 kumpf          1.262         response->qualifierDeclarations = _repository->enumerateQualifiers(
5764                                  request->nameSpace);
5765 brian.campbell 1.189 
5766 kumpf          1.262         PEG_LOGGER_TRACE((
5767                                  Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE,
5768                                  "CIMOperationRequestDispatcher::handleEnumerateQualifiersRequest - "
5769                                      "Namespace: $0",
5770                                  request->nameSpace.getString()));
5771                          }
5772                          catch (const CIMException& exception)
5773                          {
5774                              response->cimException = exception;
5775                          }
5776                          catch (const Exception& exception)
5777                          {
5778                              response->cimException = PEGASUS_CIM_EXCEPTION(
5779                                  CIM_ERR_FAILED, exception.getMessage());
5780                          }
5781                          catch (...)
5782                          {
5783                              response->cimException = PEGASUS_CIM_EXCEPTION(
5784                                  CIM_ERR_FAILED, String::EMPTY);
5785                          }
5786 brian.campbell 1.189 
5787 kumpf          1.262     _enqueueResponse(request, response.release());
5788 brian.campbell 1.189 
5789 kumpf          1.262     PEG_METHOD_EXIT();
5790 brian.campbell 1.189 }
5791                      
5792                      /**$*******************************************************
5793                          handleExecQueryRequest
5794                      **********************************************************/
5795                      
5796                      void CIMOperationRequestDispatcher::handleExecQueryRequest(
5797 kumpf          1.262     CIMExecQueryRequestMessage* request)
5798 brian.campbell 1.189 {
5799 kumpf          1.256     PEG_METHOD_ENTER(TRC_DISPATCHER,
5800                              "CIMOperationRequestDispatcher::handleExecQueryRequest");
5801 brian.campbell 1.189 
5802 kumpf          1.256     AutoPtr<CIMExecQueryResponseMessage> response(
5803                              dynamic_cast<CIMExecQueryResponseMessage*>(
5804                                  request->buildResponse()));
5805 brian.campbell 1.189 
5806 kumpf          1.256     Boolean exception = false;
5807 brian.campbell 1.189 
5808 kumpf          1.209 #ifdef PEGASUS_DISABLE_EXECQUERY
5809 kumpf          1.256     response->cimException =
5810                              PEGASUS_CIM_EXCEPTION(CIM_ERR_NOT_SUPPORTED, String::EMPTY);
5811                          exception=true;
5812 kumpf          1.209 #else
5813 a.dunfey       1.252     if (QuerySupportRouter::routeHandleExecQueryRequest(this,request)==false)
5814                          {
5815 kumpf          1.262         if (request->operationContext.contains(
5816                                      SubscriptionFilterConditionContainer::NAME))
5817 a.dunfey       1.252         {
5818 kumpf          1.262             SubscriptionFilterConditionContainer sub_cntr =
5819                                      request->operationContext.get(
5820                                          SubscriptionFilterConditionContainer::NAME);
5821 kumpf          1.256             response->cimException = PEGASUS_CIM_EXCEPTION(
5822                                      CIM_ERR_QUERY_LANGUAGE_NOT_SUPPORTED,
5823                                      sub_cntr.getQueryLanguage());
5824 a.dunfey       1.252         }
5825                              else
5826                              {
5827 kumpf          1.256             response->cimException = PEGASUS_CIM_EXCEPTION(
5828                                      CIM_ERR_QUERY_LANGUAGE_NOT_SUPPORTED, request->queryLanguage);
5829 a.dunfey       1.252         }
5830 kumpf          1.262 
5831 a.dunfey       1.252         exception = true;
5832                          }
5833 kumpf          1.209 #endif
5834 brian.campbell 1.189 
5835 kumpf          1.256     if (exception)
5836                          {
5837                              _enqueueResponse(request, response.release());
5838                              PEG_METHOD_EXIT();
5839                              return;
5840 brian.campbell 1.189     }
5841                      
5842                          PEG_METHOD_EXIT();
5843                          return;
5844                      }
5845                      
5846                      /**$*******************************************************
5847                          handleInvokeMethodRequest
5848                      **********************************************************/
5849                      
5850                      void CIMOperationRequestDispatcher::handleInvokeMethodRequest(
5851 kumpf          1.262     CIMInvokeMethodRequestMessage* request)
5852 brian.campbell 1.189 {
5853 kumpf          1.262     PEG_METHOD_ENTER(TRC_DISPATCHER,
5854                              "CIMOperationRequestDispatcher::handleInvokeMethodRequest");
5855 brian.campbell 1.189 
5856 kumpf          1.262     {
5857                              CIMException cimException;
5858                              try
5859                              {
5860                                  _fixInvokeMethodParameterTypes(request);
5861                              }
5862                              catch (CIMException& exception)
5863                              {
5864                                  cimException = exception;
5865                              }
5866                              catch (const Exception& exception)
5867                              {
5868                                  cimException =
5869                                      PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED, exception.getMessage());
5870                              }
5871                              catch (...)
5872                              {
5873                                  cimException = PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED, String::EMPTY);
5874                              }
5875 brian.campbell 1.189 
5876 kumpf          1.262         if (cimException.getCode() != CIM_ERR_SUCCESS)
5877                              {
5878                                  PEG_LOGGER_TRACE((
5879                                      Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE,
5880                                      "CIMOperationRequestDispatcher::handleInvokeMethodRequest - "
5881                                          "CIM exception has occurred."));
5882 brian.campbell 1.189 
5883 kumpf          1.262             CIMResponseMessage* response = request->buildResponse();
5884                                  response->cimException = cimException;
5885 brian.campbell 1.189 
5886 kumpf          1.262             _enqueueResponse(request, response);
5887 brian.campbell 1.189 
5888 kumpf          1.262             PEG_METHOD_EXIT();
5889                                  return;
5890                              }
5891                          }
5892 brian.campbell 1.189 
5893 kumpf          1.262     CIMName className = request->instanceName.getClassName();
5894 brian.campbell 1.189 
5895 kumpf          1.262     CIMException checkClassException;
5896                          _checkExistenceOfClass(request->nameSpace, className, checkClassException);
5897                          if (checkClassException.getCode() != CIM_ERR_SUCCESS)
5898                          {
5899                              // map CIM_ERR_INVALID_CLASS to CIM_ERR_NOT_FOUND
5900                              if (checkClassException.getCode() == CIM_ERR_INVALID_CLASS)
5901                              {
5902                                  checkClassException = PEGASUS_CIM_EXCEPTION(
5903                                      CIM_ERR_NOT_FOUND, className.getString());
5904                              }
5905 brian.campbell 1.189 
5906 kumpf          1.262         PEG_LOGGER_TRACE((
5907                                  Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE,
5908                                      "CIMOperationRequestDispatcher::handleInvokeMethodRequest - "
5909                                          "CIM exist exception has occurred.  Namespace: $0  "
5910                                          "Class Name: $1",
5911                                      request->nameSpace.getString(),
5912                                      className.getString()));
5913 brian.campbell 1.189 
5914 kumpf          1.262         CIMResponseMessage* response = request->buildResponse();
5915                              response->cimException = checkClassException;
5916 kumpf          1.256 
5917 kumpf          1.262         _enqueueResponse(request, response);
5918                              PEG_METHOD_EXIT();
5919                              return;
5920                          }
5921 brian.campbell 1.189 
5922 kumpf          1.262     String serviceName;
5923                          String controlProviderName;
5924 brian.campbell 1.189 
5925 kumpf          1.262     // Check for class provided by an internal provider
5926                          if (_lookupInternalProvider(
5927                                  request->nameSpace, className, serviceName, controlProviderName))
5928                          {
5929                              CIMInvokeMethodRequestMessage* requestCopy =
5930                                  new CIMInvokeMethodRequestMessage(*request);
5931 brian.campbell 1.189 
5932 kumpf          1.262         CIMInvokeMethodRequestMessage* requestCallbackCopy =
5933                                  new CIMInvokeMethodRequestMessage(*requestCopy);
5934 brian.campbell 1.189 
5935 kumpf          1.262         _forwardRequestToProviderManager(
5936                                  className,
5937                                  serviceName,
5938                                  controlProviderName,
5939                                  requestCopy,
5940                                  requestCallbackCopy);
5941 kumpf          1.259 
5942 kumpf          1.262         PEG_METHOD_EXIT();
5943                              return;
5944                          }
5945 brian.campbell 1.189 
5946 kumpf          1.262     // check the class name for an "external provider"
5947                          ProviderIdContainer* providerIdContainer=NULL;
5948 brian.campbell 1.189 
5949 kumpf          1.262     String providerName = _lookupMethodProvider(
5950                              request->nameSpace,
5951                              className,
5952                              request->methodName,
5953                              &providerIdContainer);
5954 brian.campbell 1.189 
5955 kumpf          1.262     if (providerName.size() != 0)
5956                          {
5957                              CIMInvokeMethodRequestMessage* requestCopy =
5958                                  new CIMInvokeMethodRequestMessage(*request);
5959 brian.campbell 1.189 
5960 kumpf          1.262         if (providerIdContainer!=NULL)
5961                              {
5962                                  requestCopy->operationContext.insert(*providerIdContainer);
5963                                  delete providerIdContainer;
5964                                  providerIdContainer = NULL;
5965                              }
5966 brian.campbell 1.189 
5967 kumpf          1.262         CIMInvokeMethodRequestMessage* requestCallbackCopy =
5968                                  new CIMInvokeMethodRequestMessage(*requestCopy);
5969 kumpf          1.259 
5970 kumpf          1.262         _forwardRequestToService(
5971                                  PEGASUS_QUEUENAME_PROVIDERMANAGER_CPP,
5972                                  requestCopy,
5973                                  requestCallbackCopy);
5974 brian.campbell 1.189 
5975 kumpf          1.262         PEG_METHOD_EXIT();
5976                              return;
5977                          }
5978 brian.campbell 1.189 
5979 kumpf          1.262     CIMResponseMessage* response = request->buildResponse();
5980                          response->cimException =
5981                              PEGASUS_CIM_EXCEPTION(CIM_ERR_METHOD_NOT_AVAILABLE,
5982                                  request->methodName.getString());
5983 brian.campbell 1.189 
5984 kumpf          1.262     _enqueueResponse(request, response);
5985 brian.campbell 1.189 
5986 kumpf          1.262     PEG_METHOD_EXIT();
5987 brian.campbell 1.189 }
5988                      
5989                      /*********************************************************************/
5990                      //
5991                      //   Return Aggregated responses back to the Correct Aggregator
5992                      //   ATTN: This was temporary to isolate the aggregation processing.
5993                      //   We need to combine this with the other callbacks to create a single
5994                      //   set of functions
5995                      //
5996                      //   The aggregator includes an aggregation object that is used to
5997                      //   accumulate responses.  It is attached to each request sent and
5998                      //   received back as part of the response call back in the "parm"
5999                      //   Responses are aggregated until the count reaches the sent count and
6000                      //   then the aggregation code is called to create a single response from
6001                      //   the accumulated responses.
6002                      //
6003                      /*********************************************************************/
6004                      
6005                      // Aggregate the responses for reference names into a single response
6006                      //
6007                      void CIMOperationRequestDispatcher::handleAssociatorNamesResponseAggregation(
6008 brian.campbell 1.189     OperationAggregate* poA)
6009                      {
6010                          PEG_METHOD_ENTER(TRC_DISPATCHER,
6011 kumpf          1.262         "CIMOperationRequestDispatcher::"
6012                                  "handleAssociatorNamesResponseAggregation");
6013                          CIMAssociatorNamesResponseMessage* toResponse =
6014                              (CIMAssociatorNamesResponseMessage*) poA->getResponse(0);
6015 mike           1.240     PEG_LOGGER_TRACE((Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE,
6016                              "CIMOperationRequestDispatcher::AssociatorNames Response - "
6017 kumpf          1.262             "Namespace: $0  Class name: $1 Response Count: $2",
6018 brian.campbell 1.189         poA->_nameSpace.getString(),
6019                              poA->_className.getString(),
6020 mike           1.240         poA->numberResponses()));
6021 brian.campbell 1.189 
6022 kumpf          1.226     // This double loop has 2 purposes:
6023 brian.campbell 1.201     // 1. To work backward and delete each response off the end of the array
6024 kumpf          1.226     //    and append each instance to the list of instances of the first
6025                          //    element in the array.
6026                          // 2. fill in host, namespace on all instances on all elements of array
6027                          //    if they have been left out. This is required because XML reader
6028                          //    will fail without them populated
6029                      
6030                          Uint32 i = poA->numberResponses() - 1;
6031                          do
6032                          {
6033 kumpf          1.262         CIMAssociatorNamesResponseMessage* fromResponse =
6034                                  (CIMAssociatorNamesResponseMessage*)poA->getResponse(i);
6035 kumpf          1.226 
6036                              for (Uint32 j = 0, n = fromResponse->objectNames.size(); j < n; j++)
6037                              {
6038 kumpf          1.262             CIMObjectPath& p = fromResponse->objectNames[j];
6039 kumpf          1.226 
6040                                  if (p.getHost().size() == 0)
6041                                      p.setHost(cimAggregationLocalHost);
6042                      
6043                                  if (p.getNameSpace().isNull())
6044                                      p.setNameSpace(poA->_nameSpace);
6045                      
6046                                  // only append if we are not the first response
6047                                  if (i > 0)
6048                                      toResponse->objectNames.append(p);
6049                              }
6050                      
6051                              // only delete if we are not the first response, else we're done
6052                              if (i == 0)
6053                                  break;
6054                              else poA->deleteResponse(i--);
6055 brian.campbell 1.201 
6056                          } while (true);
6057                      
6058 brian.campbell 1.189     PEG_METHOD_EXIT();
6059                      }
6060                      
6061                      // Aggregate the responses for Associators into a single response
6062                      
6063                      void CIMOperationRequestDispatcher::handleAssociatorsResponseAggregation(
6064                          OperationAggregate* poA)
6065                      {
6066                          PEG_METHOD_ENTER(TRC_DISPATCHER,
6067                              "CIMOperationRequestDispatcher::handleAssociatorsResponseAggregation");
6068                      
6069 kumpf          1.262     CIMAssociatorsResponseMessage* toResponse =
6070                          (CIMAssociatorsResponseMessage*) poA->getResponse(0);
6071 brian.campbell 1.189 
6072 mike           1.240     PEG_LOGGER_TRACE((Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE,
6073                              "CIMOperationRequestDispatcher::Associators Response - "
6074 kumpf          1.262             "Namespace: $0  Class name: $1 Response Count: $2",
6075 brian.campbell 1.189         poA->_nameSpace.getString(),
6076                              poA->_className.getString(),
6077 mike           1.240         poA->numberResponses()));
6078 brian.campbell 1.189 
6079 kumpf          1.226     // This double loop has 2 purposes:
6080 brian.campbell 1.201     // 1. To work backward and delete each response off the end of the array
6081 kumpf          1.226     //    and append each instance to the list of instances of the first
6082                          //    element in the array.
6083                          // 2. fill in host, namespace on all instances on all elements of array
6084                          //    if they have been left out. This is required because XML reader
6085                          //    will fail without them populated
6086                      
6087                          Uint32 i = poA->numberResponses() - 1;
6088                          do
6089                          {
6090 kumpf          1.262         CIMAssociatorsResponseMessage* fromResponse =
6091                                  (CIMAssociatorsResponseMessage*)poA->getResponse(i);
6092 kumpf          1.226 
6093                              for (Uint32 j = 0, n = fromResponse->cimObjects.size(); j < n; j++)
6094                              {
6095 kumpf          1.262             const CIMObject& object = fromResponse->cimObjects[j];
6096                                  CIMObjectPath& p = const_cast<CIMObjectPath&>(object.getPath());
6097 kumpf          1.226 
6098                                  if (p.getHost().size() ==0)
6099                                      p.setHost(cimAggregationLocalHost);
6100                      
6101                                  if (p.getNameSpace().isNull())
6102                                      p.setNameSpace(poA->_nameSpace);
6103                      
6104                                  // only append if we are not the first response
6105                                  if (i > 0)
6106                                      toResponse->cimObjects.append(object);
6107                              }
6108                      
6109                              // only delete if we are not the first response, else we're done
6110                              if (i == 0)
6111                                  break;
6112                              else poA->deleteResponse(i--);
6113 brian.campbell 1.201 
6114                          } while (true);
6115                      
6116 brian.campbell 1.189     PEG_METHOD_EXIT();
6117                      }
6118                      
6119                      // Aggregate the responses for References into a single response
6120                      
6121                      void CIMOperationRequestDispatcher::handleReferencesResponseAggregation(
6122                          OperationAggregate* poA)
6123                      {
6124                          PEG_METHOD_ENTER(TRC_DISPATCHER,
6125                              "CIMOperationRequestDispatcher::handleReferencesResponseAggregation");
6126                      
6127 kumpf          1.262     CIMReferencesResponseMessage* toResponse =
6128                              (CIMReferencesResponseMessage*) poA->getResponse(0);
6129 brian.campbell 1.189 
6130 mike           1.240     PEG_LOGGER_TRACE((Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE,
6131                              "CIMOperationRequestDispatcher::References Response - "
6132 kumpf          1.262             "Namespace: $0  Class name: $1 Response Count: $2",
6133 brian.campbell 1.189         poA->_nameSpace.getString(),
6134                              poA->_className.getString(),
6135 mike           1.240         poA->numberResponses()));
6136 brian.campbell 1.189 
6137 kumpf          1.226     // This double loop has 2 purposes:
6138 brian.campbell 1.201     // 1. To work backward and delete each response off the end of the array
6139 kumpf          1.226     //    and append each instance to the list of instances of the first
6140                          //    element in the array.
6141                          // 2. fill in host, namespace on all instances on all elements of array
6142                          //    if they have been left out. This is required because XML reader
6143                          //    will fail without them populated
6144                      
6145                          Uint32 i = poA->numberResponses() - 1;
6146                          do
6147                          {
6148 kumpf          1.262         CIMReferencesResponseMessage* fromResponse =
6149                                  (CIMReferencesResponseMessage*)poA->getResponse(i);
6150 kumpf          1.226 
6151                              for (Uint32 j = 0, n = fromResponse->cimObjects.size(); j < n; j++)
6152                              {
6153                                  // Test and complete path if necessary. Required because
6154                                  // XML not correct without full path.
6155 kumpf          1.262             const CIMObject& object = fromResponse->cimObjects[j];
6156                                  CIMObjectPath& p = const_cast<CIMObjectPath&>(object.getPath());
6157 kumpf          1.226 
6158                                  if (p.getHost().size() == 0)
6159                                      p.setHost(cimAggregationLocalHost);
6160                      
6161                                  if (p.getNameSpace().isNull())
6162                                      p.setNameSpace(poA->_nameSpace);
6163                      
6164                                  // only append if we are not the first response
6165                                  if (i > 0)
6166                                      toResponse->cimObjects.append(object);
6167                              }
6168                      
6169                              // only delete if we are not the first response, else we're done
6170                              if (i == 0)
6171                                  break;
6172                              else poA->deleteResponse(i--);
6173 brian.campbell 1.201 
6174                          } while (true);
6175 r.kieninger    1.197 
6176 brian.campbell 1.189     PEG_METHOD_EXIT();
6177                      }
6178                      
6179                      // Aggregate the responses for reference names into a single response
6180                      //
6181                      void CIMOperationRequestDispatcher::handleReferenceNamesResponseAggregation(
6182 kumpf          1.262     OperationAggregate* poA)
6183 brian.campbell 1.189 {
6184                          PEG_METHOD_ENTER(TRC_DISPATCHER,
6185 kumpf          1.262         "CIMOperationRequestDispatcher::"
6186                                  "handleReferenceNamesResponseAggregation");
6187                          CIMReferenceNamesResponseMessage* toResponse =
6188                          (CIMReferenceNamesResponseMessage*) poA->getResponse(0);
6189 brian.campbell 1.189 
6190                          // Work backward and delete each response off the end of the array
6191                          // adding it to the toResponse, which is really the first response.
6192 mike           1.240     PEG_LOGGER_TRACE((Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE,
6193                              "CIMOperationRequestDispatcher::ReferenceNames Response - "
6194 kumpf          1.262             "Namespace: $0  Class name: $1 Response Count: $2",
6195 brian.campbell 1.189         poA->_nameSpace.getString(),
6196                              poA->_className.getString(),
6197 mike           1.240         poA->numberResponses()));
6198 brian.campbell 1.189 
6199 kumpf          1.226     // This double loop has 2 purposes:
6200 brian.campbell 1.201     // 1. To work backward and delete each response off the end of the array
6201 kumpf          1.226     //    and append each instance to the list of instances of the first
6202                          //    element in the array.
6203                          // 2. fill in host, namespace on all instances on all elements of array
6204                          //    if they have been left out. This is required because XML reader
6205                          //    will fail without them populated
6206                      
6207                          Uint32 i = poA->numberResponses() - 1;
6208                          do
6209                          {
6210 kumpf          1.262         CIMReferenceNamesResponseMessage* fromResponse =
6211                                  (CIMReferenceNamesResponseMessage*)poA->getResponse(i);
6212 kumpf          1.226 
6213                              for (Uint32 j = 0, n = fromResponse->objectNames.size(); j < n; j++)
6214                              {
6215 kumpf          1.262             CIMObjectPath& p = fromResponse->objectNames[j];
6216 kumpf          1.226 
6217                                  if (p.getHost().size() == 0)
6218                                      p.setHost(cimAggregationLocalHost);
6219                      
6220                                  if (p.getNameSpace().isNull())
6221                                      p.setNameSpace(poA->_nameSpace);
6222                      
6223                                  // only append if we are not the first response
6224                                  if (i > 0)
6225                                      toResponse->objectNames.append(p);
6226                              }
6227                      
6228                              // only delete if we are not the first response, else we're done
6229                              if (i == 0)
6230                                  break;
6231                              else poA->deleteResponse(i--);
6232 brian.campbell 1.201 
6233                          } while (true);
6234 brian.campbell 1.189 
6235                          PEG_METHOD_EXIT();
6236                      }
6237                      
6238                      /* aggregate the responses for enumerateinstancenames into a single response
6239                      */
6240 kumpf          1.262 void CIMOperationRequestDispatcher::
6241                          handleEnumerateInstanceNamesResponseAggregation(
6242                              OperationAggregate* poA)
6243 brian.campbell 1.189 {
6244                          PEG_METHOD_ENTER(TRC_DISPATCHER,
6245 kumpf          1.262         "CIMOperationRequestDispatcher::"
6246                                  "handleEnumerateInstanceNamesResponseAggregation");
6247                          CIMEnumerateInstanceNamesResponseMessage* toResponse =
6248                              (CIMEnumerateInstanceNamesResponseMessage*) poA->getResponse(0);
6249 brian.campbell 1.189 
6250 mike           1.240     PEG_LOGGER_TRACE((Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE,
6251                              "CIMOperationRequestDispatcher::EnumerateInstanceNames Response - "
6252 kumpf          1.262             "Namespace: $0  Class name: $1 Response Count: $2",
6253 brian.campbell 1.189         poA->_nameSpace.getString(),
6254                              poA->_className.getString(),
6255 mike           1.240         poA->numberResponses()));
6256 brian.campbell 1.189 
6257                          // Work backward and delete each response off the end of the array
6258 kumpf          1.262     for (Uint32 i = poA->numberResponses() - 1; i > 0; i--)
6259 brian.campbell 1.189     {
6260 kumpf          1.262         CIMEnumerateInstanceNamesResponseMessage* fromResponse =
6261                                  (CIMEnumerateInstanceNamesResponseMessage*)poA->getResponse(i);
6262 brian.campbell 1.189 
6263 kumpf          1.226         for (Uint32 j = 0; j < fromResponse->instanceNames.size(); j++)
6264                              {
6265 kumpf          1.262             // Duplicate test goes here if we decide to eliminate dups in
6266                                  // the future.
6267 brian.campbell 1.189             toResponse->instanceNames.append(fromResponse->instanceNames[j]);
6268 kumpf          1.226         }
6269                              poA->deleteResponse(i);
6270 brian.campbell 1.189     }
6271                          PEG_METHOD_EXIT();
6272                      }
6273                      
6274 kumpf          1.262 /* The function aggregates individual EnumerateInstance Responses into a
6275                         single response
6276 brian.campbell 1.189    for return to the client. It aggregates the responses into the
6277                         first response (0).
6278                         ATTN: KS 28 May 2002 - At this time we do not do the following:
6279                         1. eliminate duplicates.
6280                         2. prune the properties if localOnly or deepInheritance are set.
6281                         This function does not send any responses.
6282                      */
6283 kumpf          1.262 void CIMOperationRequestDispatcher::handleEnumerateInstancesResponseAggregation(
6284                          OperationAggregate* poA)
6285 brian.campbell 1.189 {
6286                          PEG_METHOD_ENTER(TRC_DISPATCHER,
6287                              "CIMOperationRequestDispatcher::handleEnumerateInstancesResponse");
6288                      
6289 kumpf          1.262     CIMEnumerateInstancesResponseMessage* toResponse =
6290                              (CIMEnumerateInstancesResponseMessage*)poA->getResponse(0);
6291 brian.campbell 1.189 
6292 mike           1.240     PEG_LOGGER_TRACE((Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE,
6293                              "CIMOperationRequestDispatcher::EnumerateInstancesResponseAggregation"
6294 kumpf          1.262             "- Namespace: $0 Class name: $1 Response Count: $2",
6295 brian.campbell 1.189         poA->_nameSpace.getString(),
6296                              poA->_className.getString(),
6297 mike           1.240         poA->numberResponses()));
6298 brian.campbell 1.189 
6299 kumpf          1.262     CIMEnumerateInstancesRequestMessage* request =
6300                              (CIMEnumerateInstancesRequestMessage*)poA->getRequest();
6301 brian.campbell 1.189 
6302                          // Work backward and delete each response off the end of the array
6303 kumpf          1.262     for (Uint32 i = poA->numberResponses() - 1; i > 0; i--)
6304 brian.campbell 1.189     {
6305 kumpf          1.262         CIMEnumerateInstancesResponseMessage* fromResponse =
6306                                  (CIMEnumerateInstancesResponseMessage*)poA->getResponse(i);
6307 brian.campbell 1.189 
6308 kumpf          1.262         for (Uint32 j = 0; j < fromResponse->cimNamedInstances.size(); j++)
6309 kumpf          1.226         {
6310 kumpf          1.262             toResponse->cimNamedInstances.append(
6311                                      fromResponse->cimNamedInstances[j]);
6312 kumpf          1.226         }
6313 brian.campbell 1.189 
6314                              poA->deleteResponse(i);
6315                          }
6316                      
6317 mike           1.240     PEG_LOGGER_TRACE((Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE,
6318                              "CIMOperationRequestDispatcher::"
6319 kumpf          1.262         "EnumerateInstancesResponseAggregation - "
6320                              "Local Only: $0 Include Qualifiers: $1 Include Class Origin: $2",
6321 brian.campbell 1.189         (request->localOnly == true ? "true" : "false"),
6322                              (request->includeQualifiers == true ? "true" : "false"),
6323 mike           1.240         (request->includeClassOrigin == true ? "true" : "false")));
6324 brian.campbell 1.189 
6325                          PEG_METHOD_EXIT();
6326                      }
6327                      
6328                      
6329                      void CIMOperationRequestDispatcher::handleExecQueryResponseAggregation(
6330 kumpf          1.262     OperationAggregate* poA)
6331 brian.campbell 1.189 {
6332 kumpf          1.262     QuerySupportRouter::routeHandleExecQueryResponseAggregation(this, poA);
6333 brian.campbell 1.189 }
6334                      
6335                      /*******End of the functions for aggregation***************************/
6336                      
6337                      /**
6338 kumpf          1.262     Convert the specified CIMValue to the specified type, and return it in
6339                          a new CIMValue.
6340 brian.campbell 1.189 */
6341                      CIMValue CIMOperationRequestDispatcher::_convertValueType(
6342 kumpf          1.262     const CIMValue& value,
6343                          CIMType type)
6344 brian.campbell 1.189 {
6345 kumpf          1.262     PEG_METHOD_ENTER(TRC_DISPATCHER,
6346                              "CIMOperationRequestDispatcher::_convertValueType");
6347                      
6348                          CIMValue newValue;
6349 brian.campbell 1.189 
6350 kumpf          1.262     if (value.isArray())
6351                          {
6352                              Array<String> stringArray;
6353                              Array<char*> charPtrArray;
6354                              Array<const char*> constCharPtrArray;
6355 brian.campbell 1.189 
6356 kumpf          1.262         //
6357                              // Convert the value to Array<const char*> to send to conversion method
6358                              //
6359                              // ATTN-RK-P3-20020221: Deal with TypeMismatchException
6360                              // (Shouldn't really ever get that exception)
6361                              value.get(stringArray);
6362 brian.campbell 1.189 
6363 kumpf          1.262         for (Uint32 k=0; k<stringArray.size(); k++)
6364                              {
6365                                  // Need to build an Array<const char*> to send to the conversion
6366                                  // routine, but also need to keep track of them pointers as char*
6367                                  // because Windows won't let me delete a const char*.
6368                                  char* charPtr = strdup(stringArray[k].getCString());
6369                                  charPtrArray.append(charPtr);
6370                                  constCharPtrArray.append(charPtr);
6371                              }
6372 brian.campbell 1.189 
6373 kumpf          1.262         //
6374                              // Convert the value to the specified type
6375                              //
6376                              try
6377                              {
6378                                  newValue =
6379                                      XmlReader::stringArrayToValue(0, constCharPtrArray, type);
6380                              }
6381                              catch (XmlSemanticError&)
6382                              {
6383                                  for (Uint32 k=0; k<charPtrArray.size(); k++)
6384                                  {
6385                                      free(charPtrArray[k]);
6386                                  }
6387 brian.campbell 1.189 
6388 kumpf          1.262             PEG_METHOD_EXIT();
6389 brian.campbell 1.189 
6390 kumpf          1.262             throw PEGASUS_CIM_EXCEPTION_L(CIM_ERR_INVALID_PARAMETER,
6391                                      MessageLoaderParms(
6392                                          "Server.CIMOperationRequestDispatcher."
6393                                              "CIM_ERR_INVALID_PARAMETER",
6394                                          "Malformed $0 value",
6395                                          cimTypeToString(type)));
6396                              }
6397                              catch (...)
6398                              {
6399                                  for (Uint32 k=0; k<charPtrArray.size(); k++)
6400                                  {
6401                                      free(charPtrArray[k]);
6402                                  }
6403 brian.campbell 1.189 
6404 kumpf          1.262             PEG_METHOD_EXIT();
6405                                  throw;
6406                              }
6407 brian.campbell 1.189 
6408 kumpf          1.262         for (Uint32 k = 0; k < charPtrArray.size(); k++)
6409                              {
6410 brian.campbell 1.189             free(charPtrArray[k]);
6411 kumpf          1.262         }
6412                          }
6413                          else
6414                          {
6415                              String stringValue;
6416 brian.campbell 1.189 
6417 kumpf          1.262         // ATTN-RK-P3-20020221: Deal with TypeMismatchException
6418                              // (Shouldn't really ever get that exception)
6419                              value.get(stringValue);
6420 brian.campbell 1.189 
6421 kumpf          1.262         try
6422                              {
6423                                  newValue =
6424                                      XmlReader::stringToValue(0, stringValue.getCString(), type);
6425                              }
6426                              catch (XmlSemanticError&)
6427                              {
6428                                  PEG_METHOD_EXIT();
6429                                  throw PEGASUS_CIM_EXCEPTION_L(CIM_ERR_INVALID_PARAMETER,
6430                                      MessageLoaderParms(
6431                                          "Server.CIMOperationRequestDispatcher."
6432                                              "CIM_ERR_INVALID_PARAMETER",
6433                                          "Malformed $0 value",
6434                                          cimTypeToString(type)));
6435                              }
6436                          }
6437 brian.campbell 1.189 
6438 kumpf          1.262     PEG_METHOD_EXIT();
6439                          return newValue;
6440 brian.campbell 1.189 }
6441                      
6442                      /**
6443                         Find the CIMParamValues in the InvokeMethod request whose types were
6444                         not specified in the XML encoding, and convert them to the types
6445                         specified in the method schema.
6446                      */
6447                      void CIMOperationRequestDispatcher::_fixInvokeMethodParameterTypes(
6448 kumpf          1.262     CIMInvokeMethodRequestMessage* request)
6449 brian.campbell 1.189 {
6450 kumpf          1.262     PEG_METHOD_ENTER(TRC_DISPATCHER,
6451                              "CIMOperationRequestDispatcher::_fixInvokeMethodParameterTypes");
6452 brian.campbell 1.189 
6453 kumpf          1.262     Boolean gotMethodDefinition = false;
6454                          CIMMethod method;
6455 brian.campbell 1.189 
6456                          //
6457                          // Cycle through the input parameters, converting the untyped ones.
6458                          //
6459                          Array<CIMParamValue> inParameters = request->inParameters;
6460                          Uint32 numInParamValues = inParameters.size();
6461                          for (Uint32 i=0; i<numInParamValues; i++)
6462                          {
6463                              if (!inParameters[i].isTyped())
6464                              {
6465                                  //
6466                                  // Retrieve the method definition, if we haven't already done so
6467                                  // (only look up the method if we have an untyped parameter value)
6468                                  //
6469                                  if (!gotMethodDefinition)
6470                                  {
6471                                      //
6472                                      // Get the class definition for this method
6473                                      //
6474                                      CIMClass cimClass;
6475                                      try
6476 brian.campbell 1.189                 {
6477                                          cimClass = _repository->getClass(
6478                                              request->nameSpace,
6479                                              request->instanceName.getClassName(),
6480                                              false, //localOnly,
6481                                              false, //includeQualifiers,
6482                                              false, //includeClassOrigin,
6483                                              CIMPropertyList());
6484                      
6485 kumpf          1.262                     PEG_LOGGER_TRACE((Logger::STANDARD_LOG, System::CIMSERVER,
6486                                              Logger::TRACE,
6487                                              "CIMOperationRequestDispatcher::"
6488                                                  "_fixInvokeMethodParameterTypes - "
6489                                                  "Namespace: $0  Class Name: $1",
6490                                              request->nameSpace.getString(),
6491                                              request->instanceName.getClassName().getString()));
6492 brian.campbell 1.189                 }
6493 kumpf          1.226                 catch (CIMException&)
6494 brian.campbell 1.189                 {
6495                                          PEG_METHOD_EXIT();
6496 kumpf          1.226                     throw;
6497 brian.campbell 1.189                 }
6498 kumpf          1.226                 catch (Exception& e)
6499 brian.campbell 1.189                 {
6500                                          PEG_METHOD_EXIT();
6501 kumpf          1.226                     throw PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED, e.getMessage());
6502 brian.campbell 1.189                 }
6503                                      catch (...)
6504                                      {
6505                                          PEG_METHOD_EXIT();
6506                                          throw PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED, String::EMPTY);
6507                                      }
6508                      
6509                                      //
6510                                      // Get the method definition from the class
6511                                      //
6512                                      Uint32 methodPos = cimClass.findMethod(request->methodName);
6513                                      if (methodPos == PEG_NOT_FOUND)
6514                                      {
6515 kumpf          1.262                     throw PEGASUS_CIM_EXCEPTION(
6516                                              CIM_ERR_METHOD_NOT_FOUND, String::EMPTY);
6517 brian.campbell 1.189                 }
6518                                      method = cimClass.getMethod(methodPos);
6519                      
6520                                      gotMethodDefinition = true;
6521                                  }
6522                      
6523                                  //
6524                                  // Find the parameter definition for this input parameter
6525                                  //
6526                                  CIMName paramName = inParameters[i].getParameterName();
6527                                  Uint32 numParams = method.getParameterCount();
6528                                  for (Uint32 j=0; j<numParams; j++)
6529                                  {
6530                                      CIMParameter param = method.getParameter(j);
6531                                      if (paramName == param.getName())
6532                                      {
6533                                          //
6534                                          // Retype the input parameter value according to the
6535                                          // type defined in the class/method schema
6536                                          //
6537                                          CIMType paramType = param.getType();
6538 brian.campbell 1.189                     CIMValue newValue;
6539                      
6540                                          if (inParameters[i].getValue().isNull())
6541                                          {
6542                                              newValue.setNullValue(param.getType(), param.isArray());
6543                                          }
6544                                          else if (inParameters[i].getValue().isArray() !=
6545                                                       param.isArray())
6546                                          {
6547                                              // ATTN-RK-P1-20020222: Who catches this?  They aren't.
6548                                              PEG_METHOD_EXIT();
6549 kumpf          1.262                         throw PEGASUS_CIM_EXCEPTION(
6550                                                  CIM_ERR_TYPE_MISMATCH, String::EMPTY);
6551 brian.campbell 1.189                     }
6552                                          else
6553                                          {
6554                                              newValue = _convertValueType(inParameters[i].getValue(),
6555                                                  paramType);
6556                                          }
6557                      
6558                                          inParameters[i].setValue(newValue);
6559                                          inParameters[i].setIsTyped(true);
6560                                          break;
6561                                      }
6562                                  }
6563                              }
6564                          }
6565                      
6566                          PEG_METHOD_EXIT();
6567                      }
6568                      
6569                      /**
6570 kumpf          1.262     Convert the CIMValue given in a SetProperty request to the correct
6571                          type according to the schema, because it is not possible to specify
6572                          the property type in the XML encoding.
6573 brian.campbell 1.189 */
6574                      void CIMOperationRequestDispatcher::_fixSetPropertyValueType(
6575 kumpf          1.262     CIMSetPropertyRequestMessage* request)
6576 brian.campbell 1.189 {
6577 kumpf          1.262     PEG_METHOD_ENTER(TRC_DISPATCHER,
6578                              "CIMOperationRequestDispatcher::_fixSetPropertyValueType");
6579                      
6580                          CIMValue inValue = request->newValue;
6581 brian.campbell 1.189 
6582 kumpf          1.262     //
6583                          // Only do the conversion if the type is not already set
6584                          //
6585                          if ((inValue.getType() != CIMTYPE_STRING))
6586                          {
6587                              PEG_METHOD_EXIT();
6588                              return;
6589                          }
6590 brian.campbell 1.189 
6591 kumpf          1.262     //
6592                          // Get the class definition for this property
6593                          //
6594                          CIMClass cimClass;
6595                          try
6596                          {
6597                              cimClass = _repository->getClass(
6598                                  request->nameSpace,
6599                                  request->instanceName.getClassName(),
6600                                  false, //localOnly,
6601                                  false, //includeQualifiers,
6602                                  false, //includeClassOrigin,
6603                                  CIMPropertyList());
6604 brian.campbell 1.189 
6605 kumpf          1.262         PEG_LOGGER_TRACE((
6606                                  Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE,
6607                                  "CIMOperationRequestDispatcher::_fixSetPropertyValueType - "
6608                                      "Namespace: $0  Class Name: $1",
6609                                  request->nameSpace.getString(),
6610                                  request->instanceName.getClassName().getString()));
6611                          }
6612                          catch (CIMException& exception)
6613                          {
6614                              // map CIM_ERR_NOT_FOUND to CIM_ERR_INVALID_CLASS
6615                              if (exception.getCode() == CIM_ERR_NOT_FOUND)
6616                              {
6617                                  PEG_METHOD_EXIT();
6618                                  throw PEGASUS_CIM_EXCEPTION(CIM_ERR_INVALID_CLASS,
6619                                      request->instanceName.getClassName().getString());
6620                              }
6621                              else
6622                              {
6623                                  PEG_METHOD_EXIT();
6624                                  throw;
6625                              }
6626 kumpf          1.262     }
6627                          catch (Exception&)
6628                          {
6629                              PEG_METHOD_EXIT();
6630                              throw;
6631                          }
6632                          catch (...)
6633                          {
6634                              PEG_METHOD_EXIT();
6635                              throw PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED, String::EMPTY);
6636                          }
6637 brian.campbell 1.189 
6638 kumpf          1.262     //
6639                          // Get the property definition from the class
6640                          //
6641                          Uint32 propertyPos = cimClass.findProperty(request->propertyName);
6642                          if (propertyPos == PEG_NOT_FOUND)
6643                          {
6644                              PEG_METHOD_EXIT();
6645                              throw PEGASUS_CIM_EXCEPTION(CIM_ERR_NO_SUCH_PROPERTY, String::EMPTY);
6646                          }
6647                          CIMProperty property = cimClass.getProperty(propertyPos);
6648 brian.campbell 1.189 
6649 kumpf          1.262     //
6650                          // Retype the input property value according to the
6651                          // type defined in the schema
6652                          //
6653                          CIMValue newValue;
6654 brian.campbell 1.189 
6655 kumpf          1.262     if (inValue.isNull())
6656                          {
6657                              newValue.setNullValue(property.getType(), property.isArray());
6658                          }
6659                          else if (inValue.isArray() != property.isArray())
6660                          {
6661                              // ATTN-RK-P1-20020222: Who catches this?  They aren't.
6662                              PEG_METHOD_EXIT();
6663                              throw PEGASUS_CIM_EXCEPTION(CIM_ERR_TYPE_MISMATCH, String::EMPTY);
6664                          }
6665                          else
6666                          {
6667                              newValue = _convertValueType(inValue, property.getType());
6668                          }
6669 brian.campbell 1.189 
6670 kumpf          1.262     //
6671                          // Put the retyped value back into the message
6672                          //
6673                          request->newValue = newValue;
6674 brian.campbell 1.189 
6675 kumpf          1.262     PEG_METHOD_EXIT();
6676 brian.campbell 1.189 }
6677                      
6678                      void CIMOperationRequestDispatcher::_checkExistenceOfClass(
6679 kumpf          1.262     const CIMNamespaceName& nameSpace,
6680                          const CIMName& className,
6681                          CIMException& cimException)
6682 brian.campbell 1.189 {
6683 kumpf          1.262     if (className.equal (CIMName (PEGASUS_CLASSNAME___NAMESPACE)))
6684                          {
6685                              return;
6686                          }
6687                      
6688                          CIMClass cimClass;
6689 brian.campbell 1.189 
6690 kumpf          1.262     try
6691                          {
6692                              cimClass = _repository->getClass(
6693                                  nameSpace,
6694                                  className,
6695                                  true,
6696                                  false,
6697                                  false,
6698                                  CIMPropertyList());
6699 brian.campbell 1.189 
6700 kumpf          1.262         PEG_LOGGER_TRACE((
6701                                  Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE,
6702                                  "CIMOperationRequestDispatcher::_checkExistenceOfClass - "
6703                                      "Namespace: $0  Class Name: $1",
6704                                  nameSpace.getString(),
6705                                  className.getString()));
6706                          }
6707                          catch (const CIMException& exception)
6708                          {
6709                              // map CIM_ERR_NOT_FOUND to CIM_ERR_INVALID_CLASS
6710                              if (exception.getCode() == CIM_ERR_NOT_FOUND)
6711                              {
6712                                  cimException = PEGASUS_CIM_EXCEPTION(
6713                                      CIM_ERR_INVALID_CLASS, className.getString());
6714                              }
6715                              else
6716                              {
6717                                  cimException = exception;
6718                              }
6719                          }
6720                          catch (const Exception& exception)
6721 kumpf          1.262     {
6722                              cimException =
6723                                  PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED, exception.getMessage());
6724                          }
6725                          catch (...)
6726                          {
6727                              cimException = PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED, String::EMPTY);
6728                          }
6729 brian.campbell 1.189 }
6730                      
6731                      CIMClass CIMOperationRequestDispatcher::_getClass(
6732 kumpf          1.262     const CIMNamespaceName& nameSpace,
6733                          const CIMName& className,
6734                          CIMException& cimException)
6735 brian.campbell 1.189 {
6736 kumpf          1.262     if (className.equal (CIMName (PEGASUS_CLASSNAME___NAMESPACE)))
6737                          {
6738                              CIMClass __namespaceClass(PEGASUS_CLASSNAME___NAMESPACE);
6739                              // ATTN: Qualifiers not added here, but they shouldn't be needed
6740                              __namespaceClass.addProperty(
6741                                  CIMProperty(CIMName("Name"), String::EMPTY));
6742                              return __namespaceClass;
6743                          }
6744                      
6745                          CIMClass cimClass;
6746 brian.campbell 1.189 
6747 kumpf          1.262     // get the complete class, specifically not local only
6748                          try
6749                          {
6750                              cimClass = _repository->getClass(
6751                                  nameSpace,
6752                                  className,
6753                                  false,
6754                                  true,
6755                                  true,
6756                                  CIMPropertyList());
6757 brian.campbell 1.189 
6758 kumpf          1.262         PEG_LOGGER_TRACE((
6759                                  Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE,
6760                                  "CIMOperationRequestDispatcher::_getClass - "
6761                                      "Namespace: $0  Class Name: $1",
6762                                  nameSpace.getString(),
6763                                  className.getString()));
6764                          }
6765                          catch (const CIMException& exception)
6766                          {
6767                              // map CIM_ERR_NOT_FOUND to CIM_ERR_INVALID_CLASS
6768                              if (exception.getCode() == CIM_ERR_NOT_FOUND)
6769                              {
6770                                  cimException = PEGASUS_CIM_EXCEPTION(
6771                                      CIM_ERR_INVALID_CLASS, className.getString());
6772                              }
6773                              else
6774                              {
6775                                  cimException = exception;
6776                              }
6777                          }
6778                          catch (const Exception& exception)
6779 kumpf          1.262     {
6780                              cimException =
6781                                  PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED, exception.getMessage());
6782                          }
6783                          catch (...)
6784                          {
6785                              cimException = PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED, String::EMPTY);
6786                          }
6787 brian.campbell 1.189 
6788 kumpf          1.262     return cimClass;
6789 brian.campbell 1.189 }
6790                      
6791 a.dunfey       1.231 template <class ObjectClass>
6792 kumpf          1.262 void removePropagatedAndOriginAttributes(ObjectClass& newObject)
6793 a.dunfey       1.231 {
6794                          Uint32 numProperties = newObject.getPropertyCount();
6795 kumpf          1.262     for (Uint32 i = 0; i < numProperties; i++)
6796 a.dunfey       1.231     {
6797                              CIMProperty currentProperty = newObject.getProperty(i);
6798 kumpf          1.262         if (currentProperty.getPropagated() == true ||
6799 a.dunfey       1.231             currentProperty.getClassOrigin().getString().size() > 0)
6800                              {
6801                                  newObject.removeProperty(i);
6802                                  currentProperty.setPropagated(false);
6803                                  currentProperty.setClassOrigin(CIMName());
6804                                  newObject.addProperty(currentProperty);
6805                                  --i;
6806                              }
6807                          }
6808                      }
6809                      
6810 brian.campbell 1.189 PEGASUS_NAMESPACE_END

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2