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

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2