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

   1 martin 1.30 //%LICENSE////////////////////////////////////////////////////////////////
   2 martin 1.31 //
   3 martin 1.30 // Licensed to The Open Group (TOG) under one or more contributor license
   4             // agreements.  Refer to the OpenPegasusNOTICE.txt file distributed with
   5             // this work for additional information regarding copyright ownership.
   6             // Each contributor licenses this file to you under the OpenPegasus Open
   7             // Source License; you may not use this file except in compliance with the
   8             // License.
   9 martin 1.31 //
  10 martin 1.30 // Permission is hereby granted, free of charge, to any person obtaining a
  11             // copy of this software and associated documentation files (the "Software"),
  12             // to deal in the Software without restriction, including without limitation
  13             // the rights to use, copy, modify, merge, publish, distribute, sublicense,
  14             // and/or sell copies of the Software, and to permit persons to whom the
  15             // Software is furnished to do so, subject to the following conditions:
  16 martin 1.31 //
  17 martin 1.30 // The above copyright notice and this permission notice shall be included
  18             // in all copies or substantial portions of the Software.
  19 martin 1.31 //
  20 martin 1.30 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  21 martin 1.31 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  22 martin 1.30 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
  23             // IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
  24             // CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
  25             // TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
  26             // SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  27 martin 1.31 //
  28 martin 1.30 //////////////////////////////////////////////////////////////////////////
  29 schuur 1.1  //
  30             //%/////////////////////////////////////////////////////////////////////////////
  31             
  32             #include "OperationResponseHandler.h"
  33 a.dunfey 1.15 #include "CIMOMHandleContext.h"
  34 chip     1.7  
  35 marek    1.25 #include <Pegasus/Common/Tracer.h>
  36 dave.sudlik 1.24 #include <Pegasus/Common/SharedPtr.h>
  37 a.dunfey    1.15 #include <Pegasus/Provider/CIMOMHandle.h>
  38 venkat.puvvada 1.26 #include <Pegasus/Config/ConfigManager.h>
  39 marek          1.35 #include <Pegasus/Common/SCMOClassCache.h>
  40 chip           1.7  
  41 schuur         1.1  PEGASUS_NAMESPACE_BEGIN
  42                     
  43 venkat.puvvada 1.26 static void _initializeNormalizer(
  44                         CIMOperationRequestMessage *request,
  45                         Boolean includeQualifiers,
  46                         Boolean includeClassOrigin,
  47                         ObjectNormalizer &normalizer)
  48                     {
  49 kumpf          1.32     // Attempt to get the cached class definition, normalization is disabled
  50 venkat.puvvada 1.26     // if it does not exist.
  51                         if (request->operationContext.contains(
  52                                 CachedClassDefinitionContainer::NAME))
  53                         {
  54                             CachedClassDefinitionContainer container =
  55                                 request->operationContext.get(
  56                                     CachedClassDefinitionContainer::NAME);
  57 mike           1.28         CIMClass cimClass = container.getClass().clone();
  58 mike           1.29         container = CachedClassDefinitionContainer(cimClass);
  59 venkat.puvvada 1.26         SharedPtr<NormalizerContext> tmpContext(new CIMOMHandleContext());
  60                             ObjectNormalizer tmpNormalizer(
  61                                 cimClass,
  62                                 includeQualifiers,
  63                                 includeClassOrigin,
  64                                 request->nameSpace,
  65                                 tmpContext);
  66                             normalizer = tmpNormalizer;
  67                         }
  68                     }
  69                     
  70 chip           1.7  //
  71                     // OperationResponseHandler
  72                     //
  73                     
  74                     OperationResponseHandler::OperationResponseHandler(
  75 kumpf          1.23     CIMRequestMessage* request,
  76                         CIMResponseMessage* response,
  77 kumpf          1.14     PEGASUS_RESPONSE_CHUNK_CALLBACK_T responseChunkCallback)
  78 chip           1.7      : _request(request),
  79                         _response(response),
  80 kumpf          1.14     _responseChunkCallback(responseChunkCallback),
  81 chip           1.8      _responseObjectTotal(0),
  82 chip           1.7      _responseMessageTotal(0),
  83 kumpf          1.14     _responseObjectThreshold(0)
  84 brian.campbell 1.3  {
  85                     #ifndef PEGASUS_RESPONSE_OBJECT_COUNT_THRESHOLD
  86 kumpf          1.23 # define PEGASUS_RESPONSE_OBJECT_COUNT_THRESHOLD 100
  87 brian.campbell 1.3  #elif PEGASUS_RESPONSE_OBJECT_COUNT_THRESHOLD  == 0
  88 kumpf          1.23 # undef PEGASUS_RESPONSE_OBJECT_COUNT_THRESHOLD
  89                     # define PEGASUS_RESPONSE_OBJECT_COUNT_THRESHOLD  ~0
  90 brian.campbell 1.3  #endif
  91                     
  92 kumpf          1.14     if (!request)
  93 a.dunfey       1.4      {
  94                             _responseObjectThreshold = ~0;
  95                         }
  96 kumpf          1.23     else
  97 a.dunfey       1.4      {
  98                             _responseObjectThreshold = PEGASUS_RESPONSE_OBJECT_COUNT_THRESHOLD;
  99 brian.campbell 1.3  
 100                     #ifdef PEGASUS_DEBUG
 101 kumpf          1.23         static const char* responseObjectThreshold =
 102                                 getenv("PEGASUS_RESPONSE_OBJECT_COUNT_THRESHOLD");
 103 chip           1.7  
 104                             if (responseObjectThreshold)
 105 kumpf          1.23         {
 106                                 Uint32 i = (Uint32)atoi(responseObjectThreshold);
 107 chip           1.7  
 108                                 if (i > 0)
 109                                 {
 110                                     _responseObjectThreshold = i;
 111                                 }
 112 kumpf          1.23         }
 113 brian.campbell 1.3  #endif
 114 a.dunfey       1.4      }
 115 brian.campbell 1.3  }
 116                     
 117                     OperationResponseHandler::~OperationResponseHandler()
 118                     {
 119 kumpf          1.23     _request = 0;
 120                         _response = 0;
 121 brian.campbell 1.3  }
 122                     
 123 kumpf          1.23 CIMRequestMessage* OperationResponseHandler::getRequest() const
 124 chip           1.7  {
 125 kumpf          1.23     return _request;
 126 chip           1.7  }
 127                     
 128 kumpf          1.23 CIMResponseMessage* OperationResponseHandler::getResponse() const
 129 chip           1.7  {
 130 kumpf          1.23     return _response;
 131 chip           1.7  }
 132                     
 133                     void OperationResponseHandler::setStatus(
 134                         const Uint32 code,
 135 kumpf          1.23     const String& message)
 136 chip           1.7  {
 137 kumpf          1.23     _response->cimException =
 138                             PEGASUS_CIM_EXCEPTION(CIMStatusCode(code), message);
 139 chip           1.7  }
 140                     
 141                     void OperationResponseHandler::setStatus(
 142                         const Uint32 code,
 143 kumpf          1.23     const ContentLanguageList& langs,
 144                         const String& message)
 145 chip           1.7  {
 146                         _response->cimException =
 147                             PEGASUS_CIM_EXCEPTION_LANG(
 148                             langs,
 149                             CIMStatusCode(code),
 150                             message);
 151                     }
 152                     
 153 mike           1.22 void OperationResponseHandler::setCIMException(
 154                         const CIMException& cimException)
 155                     {
 156                         // Assign the cimException argument to _response->cimException. Note that
 157                         // there is no need to use the PEGASUS_CIM_EXCEPTION_LANG() macro to create
 158 kumpf          1.32     // a TraceableCIMException since both _response->cimException and
 159 mike           1.22     // cimException are of type CIMException and the TraceableCIMException
 160                         // constructor has no side effects.
 161                         _response->cimException = cimException;
 162                     }
 163                     
 164 kumpf          1.23 Boolean OperationResponseHandler::isAsync() const
 165 chip           1.7  {
 166 kumpf          1.17     return _responseChunkCallback != 0;
 167 chip           1.7  }
 168                     
 169 brian.campbell 1.3  // This is only called from SimpleResponseHandler.deliver() but lives in this
 170                     // class because all asyncronous response must have a "response" pointer
 171                     // to go through. Only operation classes have a response pointer
 172                     void OperationResponseHandler::send(Boolean isComplete)
 173                     {
 174 kumpf          1.20     // It is possible to instantiate this class directly (not a derived
 175                         // class, which would also inherit from SimpleResponseHandler).
 176                         // The caller would do this only if the operation does not have any
 177                         // data to be returned.
 178                     
 179                         SimpleResponseHandler* simpleP =
 180                             dynamic_cast<SimpleResponseHandler*>(this);
 181                         if (simpleP == 0)
 182                         {
 183                             // if there is no data to be returned, then the message should NEVER be
 184                             // incomplete (even on an error)
 185                             PEGASUS_ASSERT(isComplete);
 186 chip           1.7          return;
 187 kumpf          1.20     }
 188 kumpf          1.19 
 189 kumpf          1.20     // some handlers do not send async because their callers cannot handle
 190                         // partial responses. If this is the case, stop here.
 191 brian.campbell 1.3  
 192 kumpf          1.20     if (!isAsync())
 193                         {
 194                             // preserve traditional behavior
 195                             if (isComplete)
 196 chip           1.7          {
 197 kumpf          1.20             if (_response != 0)
 198                                 {
 199                                     _response->operationContext.set(
 200                                         ContentLanguageListContainer(simpleP->getLanguages()));
 201                                 }
 202                                 transfer();
 203 chip           1.7          }
 204                     
 205                             return;
 206 kumpf          1.20     }
 207 brian.campbell 1.3  
 208 kumpf          1.23     SimpleResponseHandler& simple = *simpleP;
 209                         PEGASUS_ASSERT(_response);
 210                         Uint32 objectCount = simple.size();
 211 brian.campbell 1.3  
 212 kumpf          1.23     // have not reached threshold yet
 213                         if ((isComplete == false) && (objectCount < _responseObjectThreshold))
 214 chip           1.7      {
 215                             return;
 216                         }
 217 brian.campbell 1.3  
 218 kumpf          1.23     CIMResponseMessage* response = _response;
 219 brian.campbell 1.3  
 220 kumpf          1.23     // for complete responses, just use the one handed down from caller
 221                         // otherwise, create our own that the caller never sees but is
 222                         // utilized for async responses underneath
 223 brian.campbell 1.3  
 224 kumpf          1.23     if (isComplete == false)
 225 chip           1.7      {
 226                             _response = _request->buildResponse();
 227                         }
 228 brian.campbell 1.3  
 229 kumpf          1.23     _response->setComplete(isComplete);
 230                         _responseObjectTotal += objectCount;
 231 brian.campbell 1.3  
 232 kumpf          1.23     // since we are reusing response for every chunk, keep track of original
 233                         // count
 234                         _response->setIndex(_responseMessageTotal++);
 235                     
 236                         // set the originally allocated response to one more than the current.
 237                         // The reason for doing this is proactive in case of an exception. This
 238                         // allows the last response to be set as it may not re-enter this code.
 239 brian.campbell 1.3  
 240 kumpf          1.23     if (isComplete == false)
 241 chip           1.7      {
 242                             response->setIndex(_responseMessageTotal);
 243                         }
 244 brian.campbell 1.3  
 245 kumpf          1.23     validate();
 246 brian.campbell 1.3  
 247 kumpf          1.23     if (_response->cimException.getCode() != CIM_ERR_SUCCESS)
 248 chip           1.7      {
 249                             simple.clear();
 250                         }
 251                     
 252 marek          1.25     PEG_TRACE((
 253                             TRC_PROVIDERMANAGER,
 254                             Tracer::LEVEL4,
 255                             "%s::transfer",
 256                             (const char*) getClass().getCString()));
 257 chip           1.7  
 258 kumpf          1.23     transfer();
 259                         simple.clear();
 260 brian.campbell 1.3  
 261 kumpf          1.23     _response->operationContext.set(
 262                             ContentLanguageListContainer(simple.getLanguages()));
 263 brian.campbell 1.3  
 264 kumpf          1.23     // call thru ProviderManager to get externally declared entry point
 265 brian.campbell 1.3  
 266 kumpf          1.23     if (isComplete == false)
 267                         {
 268                             _responseChunkCallback(_request, _response);
 269                         }
 270 brian.campbell 1.3  
 271 kumpf          1.23     // put caller's allocated response back in place. Note that _response
 272                         // is INVALID after sending because it has been deleted externally
 273 brian.campbell 1.3  
 274 kumpf          1.23     _response = response;
 275 brian.campbell 1.3  }
 276                     
 277 kumpf          1.23 void OperationResponseHandler::transfer()
 278 chip           1.7  {
 279                     }
 280                     
 281 kumpf          1.23 void OperationResponseHandler::validate()
 282 chip           1.7  {
 283                     }
 284                     
 285 kumpf          1.23 String OperationResponseHandler::getClass() const
 286 chip           1.7  {
 287 kumpf          1.23     return String("OperationResponseHandler");
 288 chip           1.7  }
 289                     
 290 kumpf          1.23 Uint32 OperationResponseHandler::getResponseObjectTotal() const
 291 chip           1.7  {
 292 kumpf          1.23     return _responseObjectTotal;
 293 chip           1.7  }
 294                     
 295 kumpf          1.23 Uint32 OperationResponseHandler::getResponseMessageTotal() const
 296 chip           1.7  {
 297 kumpf          1.23     return _responseMessageTotal;
 298 chip           1.7  }
 299                     
 300 kumpf          1.23 Uint32 OperationResponseHandler::getResponseObjectThreshold() const
 301 chip           1.7  {
 302 kumpf          1.23     return _responseObjectThreshold;
 303 chip           1.7  }
 304                     
 305                     //
 306                     // GetInstanceResponseHandler
 307                     //
 308                     
 309                     GetInstanceResponseHandler::GetInstanceResponseHandler(
 310 kumpf          1.14     CIMGetInstanceRequestMessage* request,
 311                         CIMGetInstanceResponseMessage* response,
 312                         PEGASUS_RESPONSE_CHUNK_CALLBACK_T responseChunkCallback)
 313                         : OperationResponseHandler(request, response, responseChunkCallback)
 314 chip           1.7  {
 315 venkat.puvvada 1.26     _initializeNormalizer(
 316                             request,
 317 a.dunfey       1.15         request->includeQualifiers,
 318                             request->includeClassOrigin,
 319 venkat.puvvada 1.26         _normalizer);
 320 chip           1.7  }
 321                     
 322 kumpf          1.23 void GetInstanceResponseHandler::deliver(const CIMInstance& cimInstance)
 323 chip           1.7  {
 324 kumpf          1.23     if (cimInstance.isUninitialized())
 325 chip           1.7      {
 326                             MessageLoaderParms message(
 327                                 "Common.Exception.UNINITIALIZED_OBJECT_EXCEPTION",
 328                                 "The object is not initialized.");
 329                     
 330                             throw CIMException(CIM_ERR_FAILED, message);
 331                         }
 332                     
 333 kumpf          1.23     if (SimpleInstanceResponseHandler::size() != 0)
 334 chip           1.9      {
 335                             MessageLoaderParms message(
 336                                 "Server.OperationResponseHandler.TOO_MANY_OBJECTS_DELIVERED",
 337                                 "Too many objects delivered.");
 338                     
 339                             throw CIMException(CIM_ERR_FAILED, message);
 340                         }
 341                     
 342 venkat.puvvada 1.26     CIMInstance localInstance(cimInstance);
 343 kumpf          1.23 #ifdef PEGASUS_ENABLE_OBJECT_NORMALIZATION
 344 chip           1.7      // The normalizer expects an object path embedded in instances even
 345                         // though it is not required by this operation. Use the requested
 346                         // object path is missing from the instance.
 347 kumpf          1.23     if (localInstance.getPath().getKeyBindings().size() == 0)
 348 chip           1.7      {
 349                             // ATTN: should clone before modification
 350 kumpf          1.23         localInstance.setPath(static_cast<CIMGetInstanceRequestMessage*>(
 351                                 getRequest())->instanceName);
 352 chip           1.7      }
 353 venkat.puvvada 1.26 #endif
 354 kumpf          1.23     SimpleInstanceResponseHandler::deliver(
 355                             _normalizer.processInstance(localInstance));
 356 chip           1.7  }
 357                     
 358 thilo.boehm    1.34 void GetInstanceResponseHandler::deliver(const SCMOInstance& cimInstance)
 359                     {
 360                         if (cimInstance.isUninitialized())
 361                         {
 362                             MessageLoaderParms message(
 363                                 "Common.Exception.UNINITIALIZED_OBJECT_EXCEPTION",
 364                                 "The object is not initialized.");
 365                     
 366                             throw CIMException(CIM_ERR_FAILED, message);
 367                         }
 368                     
 369                         if (SimpleInstanceResponseHandler::size() != 0)
 370                         {
 371                             MessageLoaderParms message(
 372                                 "Server.OperationResponseHandler.TOO_MANY_OBJECTS_DELIVERED",
 373                                 "Too many objects delivered.");
 374                     
 375                             throw CIMException(CIM_ERR_FAILED, message);
 376                         }
 377                     
 378                         SimpleInstanceResponseHandler::deliver(cimInstance);
 379 thilo.boehm    1.34 }
 380                     
 381 kumpf          1.23 void GetInstanceResponseHandler::complete()
 382 chip           1.9  {
 383 kumpf          1.23     if (SimpleInstanceResponseHandler::size() == 0)
 384 chip           1.9      {
 385                             MessageLoaderParms message(
 386                                 "Server.OperationResponseHandler.TOO_FEW_OBJECTS_DELIVERED",
 387                                 "Too few objects delivered.");
 388 venkat.puvvada 1.21         // Provider claims success, no instances returned. -V see Bug #4104
 389                             setStatus(CIM_ERR_NOT_FOUND);
 390 chip           1.9          throw CIMException(CIM_ERR_FAILED, message);
 391                         }
 392                     
 393                         SimpleInstanceResponseHandler::complete();
 394                     }
 395                     
 396 kumpf          1.23 String GetInstanceResponseHandler::getClass() const
 397 chip           1.7  {
 398 kumpf          1.23     return String("GetInstanceResponseHandler");
 399 chip           1.7  }
 400                     
 401 kumpf          1.23 void GetInstanceResponseHandler::transfer()
 402 chip           1.7  {
 403 kumpf          1.23     if (size() > 0)
 404 chip           1.7      {
 405 kumpf          1.23         CIMGetInstanceResponseMessage& msg =
 406                                 *static_cast<CIMGetInstanceResponseMessage*>(getResponse());
 407 thilo.boehm    1.34         Array<CIMInstance> cimObjs= getObjects();
 408                             Array<SCMOInstance> scmoObjs= getSCMOObjects();
 409                             if (cimObjs.size() != 0)
 410                             {
 411                                 msg.getResponseData().setInstance(cimObjs[0]);
 412                             }
 413                             else
 414                             {
 415                                 msg.getResponseData().setSCMO(scmoObjs);
 416                             }
 417 chip           1.7      }
 418                     }
 419                     
 420 kumpf          1.23 void GetInstanceResponseHandler::validate()
 421 chip           1.7  {
 422 kumpf          1.23     if (getResponseObjectTotal() == 0)
 423 chip           1.7      {
 424                             // error? provider claims success,
 425                             // but did not deliver an instance.
 426                             setStatus(CIM_ERR_NOT_FOUND);
 427                         }
 428                     }
 429                     
 430                     //
 431                     // EnumerateInstancesResponseHandler
 432                     //
 433                     
 434                     EnumerateInstancesResponseHandler::EnumerateInstancesResponseHandler(
 435 kumpf          1.14     CIMEnumerateInstancesRequestMessage* request,
 436                         CIMEnumerateInstancesResponseMessage* response,
 437                         PEGASUS_RESPONSE_CHUNK_CALLBACK_T responseChunkCallback)
 438                         : OperationResponseHandler(request, response, responseChunkCallback)
 439 chip           1.7  {
 440 venkat.puvvada 1.26     _initializeNormalizer(
 441                             request,
 442 a.dunfey       1.15         request->includeQualifiers,
 443                             request->includeClassOrigin,
 444 venkat.puvvada 1.26         _normalizer);
 445 chip           1.7  }
 446                     
 447 kumpf          1.23 void EnumerateInstancesResponseHandler::deliver(const CIMInstance& cimInstance)
 448 chip           1.7  {
 449 kumpf          1.23     if (cimInstance.isUninitialized())
 450 chip           1.7      {
 451                             MessageLoaderParms message(
 452                                 "Common.Exception.UNINITIALIZED_OBJECT_EXCEPTION",
 453                                 "The object is not initialized.");
 454                     
 455                             throw CIMException(CIM_ERR_FAILED, message);
 456                         }
 457                     
 458 kumpf          1.23     SimpleInstanceResponseHandler::deliver(
 459                             _normalizer.processInstance(cimInstance));
 460 chip           1.7  }
 461                     
 462 thilo.boehm    1.34 void EnumerateInstancesResponseHandler::deliver(
 463                         const SCMOInstance& scmoInstance)
 464                     {
 465                         if (scmoInstance.isUninitialized())
 466                         {
 467                             MessageLoaderParms message(
 468                                 "Common.Exception.UNINITIALIZED_OBJECT_EXCEPTION",
 469                                 "The object is not initialized.");
 470                     
 471                             throw CIMException(CIM_ERR_FAILED, message);
 472                         }
 473                         SimpleInstanceResponseHandler::deliver(scmoInstance);
 474                     }
 475                     
 476 kumpf          1.23 String EnumerateInstancesResponseHandler::getClass() const
 477 chip           1.7  {
 478 kumpf          1.23     return String("EnumerateInstancesResponseHandler");
 479 chip           1.7  }
 480                     
 481 kumpf          1.23 void EnumerateInstancesResponseHandler::transfer()
 482 chip           1.7  {
 483 kumpf          1.23     CIMEnumerateInstancesResponseMessage& msg =
 484                             *static_cast<CIMEnumerateInstancesResponseMessage*>(getResponse());
 485 chip           1.7  
 486 thilo.boehm    1.34     Array<CIMInstance> cimObjs= getObjects();
 487                         Array<SCMOInstance> scmoObjs= getSCMOObjects();
 488                         if (cimObjs.size() != 0)
 489                         {
 490                             msg.getResponseData().setInstances(cimObjs);
 491                         }
 492                         if (scmoObjs.size() != 0)
 493                         {
 494                             msg.getResponseData().setSCMO(scmoObjs);
 495                         }
 496 chip           1.7  }
 497                     
 498                     //
 499                     // EnumerateInstanceNamesResponseHandler
 500                     //
 501                     
 502                     EnumerateInstanceNamesResponseHandler::EnumerateInstanceNamesResponseHandler(
 503 kumpf          1.14     CIMEnumerateInstanceNamesRequestMessage* request,
 504                         CIMEnumerateInstanceNamesResponseMessage* response,
 505                         PEGASUS_RESPONSE_CHUNK_CALLBACK_T responseChunkCallback)
 506                         : OperationResponseHandler(request, response, responseChunkCallback)
 507 chip           1.7  {
 508 venkat.puvvada 1.26     _initializeNormalizer(
 509                             request,
 510 a.dunfey       1.15         false,
 511                             false,
 512 venkat.puvvada 1.26         _normalizer);
 513 chip           1.7  }
 514                     
 515 kumpf          1.23 void EnumerateInstanceNamesResponseHandler::deliver(
 516                         const CIMObjectPath& cimObjectPath)
 517 chip           1.7  {
 518 kumpf          1.23     if (cimObjectPath.getClassName().isNull())
 519 chip           1.7      {
 520                             MessageLoaderParms message(
 521                                 "Common.Exception.UNINITIALIZED_OBJECT_EXCEPTION",
 522                                 "The object is not initialized.");
 523                     
 524                             throw CIMException(CIM_ERR_FAILED, message);
 525                         }
 526                     
 527 kumpf          1.23     SimpleObjectPathResponseHandler::deliver(
 528                             _normalizer.processInstanceObjectPath(cimObjectPath));
 529 chip           1.7  }
 530                     
 531 thilo.boehm    1.34 void EnumerateInstanceNamesResponseHandler::deliver(
 532                         const SCMOInstance& scmoObjectPath)
 533                     {
 534                         if (scmoObjectPath.getClassName()==NULL)
 535                         {
 536                             MessageLoaderParms message(
 537                                 "Common.Exception.UNINITIALIZED_OBJECT_EXCEPTION",
 538                                 "The object is not initialized.");
 539                     
 540                             throw CIMException(CIM_ERR_FAILED, message);
 541                         }
 542                     
 543                         SimpleObjectPathResponseHandler::deliver(scmoObjectPath);
 544                     }
 545                     
 546 kumpf          1.23 String EnumerateInstanceNamesResponseHandler::getClass() const
 547 chip           1.7  {
 548 kumpf          1.23     return String("EnumerateInstanceNamesResponseHandler");
 549 chip           1.7  }
 550                     
 551 kumpf          1.23 void EnumerateInstanceNamesResponseHandler::transfer()
 552 chip           1.7  {
 553 kumpf          1.23     CIMEnumerateInstanceNamesResponseMessage& msg =
 554                             *static_cast<CIMEnumerateInstanceNamesResponseMessage*>(getResponse());
 555 chip           1.7  
 556 thilo.boehm    1.34     Array<CIMObjectPath> cimObjs= getObjects();
 557                         Array<SCMOInstance> scmoObjs= getSCMOObjects();
 558                         if (cimObjs.size() != 0)
 559                         {
 560                             msg.getResponseData().setInstanceNames(cimObjs);
 561                         }
 562                         if (scmoObjs.size() != 0)
 563                         {
 564                             msg.getResponseData().setSCMO(scmoObjs);
 565                         }
 566 chip           1.7  }
 567                     
 568                     //
 569                     // CreateInstanceResponseHandler
 570                     //
 571                     
 572                     CreateInstanceResponseHandler::CreateInstanceResponseHandler(
 573 kumpf          1.14     CIMCreateInstanceRequestMessage* request,
 574                         CIMCreateInstanceResponseMessage* response,
 575                         PEGASUS_RESPONSE_CHUNK_CALLBACK_T responseChunkCallback)
 576                         : OperationResponseHandler(request, response, responseChunkCallback)
 577 chip           1.7  {
 578                     }
 579                     
 580 kumpf          1.23 void CreateInstanceResponseHandler::deliver(const CIMObjectPath& cimObjectPath)
 581 chip           1.7  {
 582 kumpf          1.23     if (cimObjectPath.getClassName().isNull())
 583 chip           1.7      {
 584                             MessageLoaderParms message(
 585                                 "Common.Exception.UNINITIALIZED_OBJECT_EXCEPTION",
 586                                 "The object is not initialized.");
 587                     
 588                             throw CIMException(CIM_ERR_FAILED, message);
 589                         }
 590                     
 591 kumpf          1.23     if (SimpleObjectPathResponseHandler::size() != 0)
 592 chip           1.11     {
 593                             MessageLoaderParms message(
 594                                 "Server.OperationResponseHandler.TOO_MANY_OBJECTS_DELIVERED",
 595                                 "Too many objects delivered.");
 596                     
 597                             throw CIMException(CIM_ERR_FAILED, message);
 598                         }
 599                     
 600 chip           1.7      SimpleObjectPathResponseHandler::deliver(cimObjectPath);
 601                     }
 602                     
 603 kumpf          1.23 void CreateInstanceResponseHandler::complete()
 604 chip           1.9  {
 605 kumpf          1.23     if (SimpleObjectPathResponseHandler::size() == 0)
 606 chip           1.9      {
 607                             MessageLoaderParms message(
 608                                 "Server.OperationResponseHandler.TOO_FEW_OBJECTS_DELIVERED",
 609                                 "Too few objects delivered.");
 610                     
 611                             throw CIMException(CIM_ERR_FAILED, message);
 612                         }
 613                     
 614                         SimpleObjectPathResponseHandler::complete();
 615                     }
 616                     
 617 kumpf          1.23 String CreateInstanceResponseHandler::getClass() const
 618 chip           1.7  {
 619 kumpf          1.23     return String("CreateInstanceResponseHandler");
 620 chip           1.7  }
 621                     
 622                     #if 0
 623                     // ATTN: is it an error to not return instance name?
 624 kumpf          1.23 void CreateInstanceResponseHandler::validate()
 625 chip           1.7  {
 626 kumpf          1.23     if (getResponseObjectTotal() == 0)
 627 chip           1.7      {
 628                             setStatus(CIM_ERR_NOT_FOUND);
 629                         }
 630                     }
 631                     #endif
 632                     
 633 kumpf          1.23 void CreateInstanceResponseHandler::transfer()
 634 chip           1.7  {
 635 kumpf          1.23     if (size() > 0)
 636 chip           1.7      {
 637 kumpf          1.23         CIMCreateInstanceResponseMessage& msg =
 638                                 *static_cast<CIMCreateInstanceResponseMessage*>(getResponse());
 639 chip           1.7  
 640 thilo.boehm    1.34         Array<CIMObjectPath> cimObjs= getObjects();
 641                             Array<SCMOInstance> scmoObjs= getSCMOObjects();
 642                             if (cimObjs.size() != 0)
 643                             {
 644                                 msg.instanceName = cimObjs[0];
 645                             }
 646                             else
 647                             {
 648                                 scmoObjs[0].getCIMObjectPath(msg.instanceName);
 649                             }
 650 chip           1.7      }
 651                     }
 652                     
 653                     //
 654                     // ModifyInstanceResponseHandler
 655                     //
 656                     
 657                     ModifyInstanceResponseHandler::ModifyInstanceResponseHandler(
 658 kumpf          1.14     CIMModifyInstanceRequestMessage* request,
 659                         CIMModifyInstanceResponseMessage* response,
 660                         PEGASUS_RESPONSE_CHUNK_CALLBACK_T responseChunkCallback)
 661                         : OperationResponseHandler(request, response, responseChunkCallback)
 662 chip           1.7  {
 663                     }
 664                     
 665 kumpf          1.23 String ModifyInstanceResponseHandler::getClass() const
 666 chip           1.7  {
 667 kumpf          1.23     return String("ModifyInstanceResponseHandler");
 668 chip           1.7  }
 669                     
 670                     //
 671                     // DeleteInstanceResponseHandler
 672                     //
 673                     
 674                     DeleteInstanceResponseHandler::DeleteInstanceResponseHandler(
 675 kumpf          1.14     CIMDeleteInstanceRequestMessage* request,
 676                         CIMDeleteInstanceResponseMessage* response,
 677                         PEGASUS_RESPONSE_CHUNK_CALLBACK_T responseChunkCallback)
 678                         : OperationResponseHandler(request, response, responseChunkCallback)
 679 chip           1.7  {
 680                     }
 681                     
 682 kumpf          1.23 String DeleteInstanceResponseHandler::getClass() const
 683 chip           1.7  {
 684 kumpf          1.23     return String("DeleteInstanceResponseHandler");
 685 chip           1.7  }
 686                     
 687                     //
 688                     // GetPropertyResponseHandler
 689                     //
 690                     
 691                     GetPropertyResponseHandler::GetPropertyResponseHandler(
 692 kumpf          1.14     CIMGetPropertyRequestMessage* request,
 693                         CIMGetPropertyResponseMessage* response,
 694                         PEGASUS_RESPONSE_CHUNK_CALLBACK_T responseChunkCallback)
 695                         : OperationResponseHandler(request, response, responseChunkCallback)
 696 chip           1.7  {
 697                     }
 698                     
 699 kumpf          1.23 void GetPropertyResponseHandler::deliver(const CIMValue& cimValue)
 700 chip           1.7  {
 701 kumpf          1.23     if (cimValue.isNull())
 702 chip           1.7      {
 703                             MessageLoaderParms message(
 704                                 "Common.Exception.UNINITIALIZED_OBJECT_EXCEPTION",
 705                                 "The object is not initialized.");
 706                     
 707                             throw CIMException(CIM_ERR_FAILED, message);
 708                         }
 709                     
 710                         SimpleValueResponseHandler::deliver(cimValue);
 711                     }
 712                     
 713 kumpf          1.23 String GetPropertyResponseHandler::getClass() const
 714 chip           1.7  {
 715 kumpf          1.23     return String("GetPropertyResponseHandler");
 716 chip           1.7  }
 717                     
 718 kumpf          1.23 void GetPropertyResponseHandler::transfer()
 719 chip           1.7  {
 720 kumpf          1.23     if (size() > 0)
 721 chip           1.7      {
 722 kumpf          1.23         CIMGetPropertyResponseMessage& msg =
 723                                 *static_cast<CIMGetPropertyResponseMessage*>(getResponse());
 724 chip           1.7  
 725                             msg.value = getObjects()[0];
 726                         }
 727                     }
 728                     
 729 kumpf          1.23 void GetPropertyResponseHandler::validate()
 730 chip           1.7  {
 731                         // error? provider claims success,
 732                         // but did not deliver an instance.
 733 kumpf          1.23     if (getResponseObjectTotal() == 0)
 734 chip           1.7      {
 735                             setStatus(CIM_ERR_NOT_FOUND);
 736                         }
 737                     }
 738                     
 739                     //
 740                     // SetPropertyResponseHandler
 741                     //
 742                     
 743                     SetPropertyResponseHandler::SetPropertyResponseHandler(
 744 kumpf          1.14     CIMSetPropertyRequestMessage* request,
 745                         CIMSetPropertyResponseMessage* response,
 746                         PEGASUS_RESPONSE_CHUNK_CALLBACK_T responseChunkCallback)
 747                         : OperationResponseHandler(request, response, responseChunkCallback)
 748 chip           1.7  {
 749                     }
 750                     
 751 kumpf          1.23 String SetPropertyResponseHandler::getClass() const
 752 chip           1.7  {
 753 kumpf          1.23     return String("SetPropertyResponseHandler");
 754 chip           1.7  }
 755                     
 756                     //
 757                     // ExecQueryResponseHandler
 758                     //
 759                     
 760                     ExecQueryResponseHandler::ExecQueryResponseHandler(
 761 kumpf          1.14     CIMExecQueryRequestMessage* request,
 762                         CIMExecQueryResponseMessage* response,
 763                         PEGASUS_RESPONSE_CHUNK_CALLBACK_T responseChunkCallback)
 764                         : OperationResponseHandler(request, response, responseChunkCallback)
 765 chip           1.7  {
 766                     }
 767                     
 768 kumpf          1.23 void ExecQueryResponseHandler::deliver(const CIMInstance& cimInstance)
 769 chip           1.7  {
 770 kumpf          1.23     if (cimInstance.isUninitialized())
 771 chip           1.7      {
 772                             MessageLoaderParms message(
 773                                 "Common.Exception.UNINITIALIZED_OBJECT_EXCEPTION",
 774                                 "The object is not initialized.");
 775                     
 776                             throw CIMException(CIM_ERR_FAILED, message);
 777                         }
 778                     
 779                         SimpleInstance2ObjectResponseHandler::deliver(cimInstance);
 780                     }
 781                     
 782 thilo.boehm    1.34 void ExecQueryResponseHandler::deliver(const SCMOInstance& scmoInstance)
 783                     {
 784                         if (scmoInstance.isUninitialized())
 785                         {
 786                             MessageLoaderParms message(
 787                                 "Common.Exception.UNINITIALIZED_OBJECT_EXCEPTION",
 788                                 "The object is not initialized.");
 789                     
 790                             throw CIMException(CIM_ERR_FAILED, message);
 791                         }
 792                     
 793                         SimpleInstance2ObjectResponseHandler::deliver(scmoInstance);
 794                     }
 795                     
 796 kumpf          1.23 String ExecQueryResponseHandler::getClass() const
 797 chip           1.7  {
 798 kumpf          1.23     return String("ExecQueryResponseHandler");
 799 chip           1.7  }
 800                     
 801 kumpf          1.23 void ExecQueryResponseHandler::transfer()
 802 chip           1.7  {
 803 kumpf          1.23     CIMExecQueryResponseMessage& msg =
 804                             *static_cast<CIMExecQueryResponseMessage*>(getResponse());
 805 chip           1.7  
 806 thilo.boehm    1.34     Array<CIMObject> cimObjs= getObjects();
 807                         Array<SCMOInstance> scmoObjs= getSCMOObjects();
 808                         if (cimObjs.size() != 0)
 809                         {
 810 marek          1.35         // complete keybindings based on set property values
 811                             CIMOperationRequestMessage * reqMsg =
 812                                 (CIMOperationRequestMessage*) _request;
 813                     
 814                             Boolean clsRead=false;
 815                             for (Uint32 j = 0, m = cimObjs.size(); j < m; j++)
 816                             {
 817                                 CIMObject & co=cimObjs[j];
 818                                 CIMObjectPath op=co.getPath();
 819                                 const Array<CIMKeyBinding>& kbs=op.getKeyBindings();
 820                                 if (kbs.size()==0)
 821                                 {     // no path set why ?
 822                                     if (clsRead==false || _cimClass.isUninitialized())
 823                                     {
 824                                         SCMOClassCache * classCache = SCMOClassCache::getInstance();
 825                                         CString nsName = reqMsg->nameSpace.getString().getCString();
 826                                         CString clName = reqMsg->className.getString().getCString();
 827                                         SCMOClass theClass = classCache->getSCMOClass(
 828                                             nsName,
 829                                             strlen(nsName),
 830                                             clName,
 831 marek          1.35                         strlen(clName));
 832                                         theClass.getCIMClass(_cimClass);
 833                                         clsRead=true;
 834                                     }
 835                                     op = CIMInstance(co).buildPath(_cimClass);
 836                                 }
 837                                 op.setNameSpace(reqMsg->nameSpace);
 838                                 op.setHost(System::getHostName());
 839                                 co.setPath(op);
 840                             }
 841 thilo.boehm    1.34         msg.getResponseData().setObjects(cimObjs);
 842                         }
 843                         if (scmoObjs.size() != 0)
 844                         {
 845                             msg.getResponseData().setSCMO(scmoObjs);
 846                         }
 847 chip           1.7  }
 848                     
 849 kumpf          1.23 Boolean ExecQueryResponseHandler::isAsync() const
 850 chip           1.7  {
 851 kumpf          1.23     return false;
 852 chip           1.7  }
 853                     
 854                     //
 855                     // AssociatorsResponseHandler
 856                     //
 857                     
 858                     AssociatorsResponseHandler::AssociatorsResponseHandler(
 859 kumpf          1.14     CIMAssociatorsRequestMessage* request,
 860                         CIMAssociatorsResponseMessage* response,
 861                         PEGASUS_RESPONSE_CHUNK_CALLBACK_T responseChunkCallback)
 862                         : OperationResponseHandler(request, response, responseChunkCallback)
 863 chip           1.7  {
 864                     }
 865                     
 866 kumpf          1.23 void AssociatorsResponseHandler::deliver(const CIMObject& cimObject)
 867 chip           1.7  {
 868 kumpf          1.23     if (cimObject.isUninitialized())
 869 chip           1.7      {
 870                             MessageLoaderParms message(
 871                                 "Common.Exception.UNINITIALIZED_OBJECT_EXCEPTION",
 872                                 "The object is not initialized.");
 873                     
 874                             throw CIMException(CIM_ERR_FAILED, message);
 875                         }
 876                     
 877                         SimpleObjectResponseHandler::deliver(cimObject);
 878                     }
 879                     
 880 thilo.boehm    1.34 void AssociatorsResponseHandler::deliver(const CIMInstance& cimInstance)
 881                     {
 882                         if (cimInstance.isUninitialized())
 883                         {
 884                             MessageLoaderParms message(
 885                                 "Common.Exception.UNINITIALIZED_OBJECT_EXCEPTION",
 886                                 "The object is not initialized.");
 887                     
 888                             throw CIMException(CIM_ERR_FAILED, message);
 889                         }
 890                     
 891                         SimpleObjectResponseHandler::deliver(cimInstance);
 892                     }
 893                     
 894                     void AssociatorsResponseHandler::deliver(const SCMOInstance& scmoObject)
 895                     {
 896                         if (scmoObject.isUninitialized())
 897                         {
 898                             MessageLoaderParms message(
 899                                 "Common.Exception.UNINITIALIZED_OBJECT_EXCEPTION",
 900                                 "The object is not initialized.");
 901 thilo.boehm    1.34 
 902                             throw CIMException(CIM_ERR_FAILED, message);
 903                         }
 904                         SimpleObjectResponseHandler::deliver(scmoObject);
 905                     }
 906                     
 907 kumpf          1.23 String AssociatorsResponseHandler::getClass() const
 908 chip           1.7  {
 909 kumpf          1.23     return String("AssociatorsResponseHandler");
 910 chip           1.7  }
 911                     
 912 kumpf          1.23 void AssociatorsResponseHandler::transfer()
 913 chip           1.7  {
 914 kumpf          1.23     CIMAssociatorsResponseMessage& msg =
 915                             *static_cast<CIMAssociatorsResponseMessage*>(getResponse());
 916 chip           1.7  
 917 thilo.boehm    1.34     Array<CIMObject> cimObjs= getObjects();
 918                         Array<SCMOInstance> scmoObjs= getSCMOObjects();
 919                         if (cimObjs.size() != 0)
 920                         {
 921                             msg.getResponseData().setObjects(cimObjs);
 922                         }
 923                         if (scmoObjs.size() != 0)
 924                         {
 925                             msg.getResponseData().setSCMO(scmoObjs);
 926                         }
 927 chip           1.7  }
 928                     
 929                     //
 930                     // AssociatorNamesResponseHandler
 931                     //
 932                     
 933                     AssociatorNamesResponseHandler::AssociatorNamesResponseHandler(
 934 kumpf          1.14     CIMAssociatorNamesRequestMessage* request,
 935                         CIMAssociatorNamesResponseMessage* response,
 936                         PEGASUS_RESPONSE_CHUNK_CALLBACK_T responseChunkCallback)
 937                         : OperationResponseHandler(request, response, responseChunkCallback)
 938 chip           1.7  {
 939                     }
 940                     
 941 kumpf          1.23 void AssociatorNamesResponseHandler::deliver(const CIMObjectPath& cimObjectPath)
 942 chip           1.7  {
 943 kumpf          1.23     if (cimObjectPath.getClassName().isNull())
 944 chip           1.7      {
 945                             MessageLoaderParms message(
 946                                 "Common.Exception.UNINITIALIZED_OBJECT_EXCEPTION",
 947                                 "The object is not initialized.");
 948                     
 949                             throw CIMException(CIM_ERR_FAILED, message);
 950                         }
 951                     
 952                         SimpleObjectPathResponseHandler::deliver(cimObjectPath);
 953                     }
 954                     
 955 thilo.boehm    1.34 void AssociatorNamesResponseHandler::deliver(const SCMOInstance& scmoObjectPath)
 956                     {
 957                         SimpleObjectPathResponseHandler::deliver(scmoObjectPath);
 958                     }
 959                     
 960 kumpf          1.23 String AssociatorNamesResponseHandler::getClass() const
 961 chip           1.7  {
 962 kumpf          1.23     return String("AssociatorNamesResponseHandler");
 963 chip           1.7  }
 964                     
 965 kumpf          1.23 void AssociatorNamesResponseHandler::transfer()
 966 chip           1.7  {
 967 kumpf          1.23     CIMAssociatorNamesResponseMessage& msg =
 968                             *static_cast<CIMAssociatorNamesResponseMessage*>(getResponse());
 969 chip           1.7  
 970 thilo.boehm    1.34     Array<CIMObjectPath> cimObjs= getObjects();
 971                         Array<SCMOInstance> scmoObjs= getSCMOObjects();
 972                         if (cimObjs.size() != 0)
 973                         {
 974                             msg.getResponseData().setInstanceNames(cimObjs);
 975                         }
 976                         if (scmoObjs.size() != 0)
 977                         {
 978                             msg.getResponseData().setSCMO(scmoObjs);
 979                         }
 980 chip           1.7  }
 981                     
 982                     //
 983                     // ReferencesResponseHandler
 984                     //
 985                     
 986                     ReferencesResponseHandler::ReferencesResponseHandler(
 987 kumpf          1.14     CIMReferencesRequestMessage* request,
 988                         CIMReferencesResponseMessage* response,
 989                         PEGASUS_RESPONSE_CHUNK_CALLBACK_T responseChunkCallback)
 990                         : OperationResponseHandler(request, response, responseChunkCallback)
 991 chip           1.7  {
 992                     }
 993                     
 994 kumpf          1.23 void ReferencesResponseHandler::deliver(const CIMObject& cimObject)
 995 chip           1.7  {
 996 kumpf          1.23     if (cimObject.isUninitialized())
 997 chip           1.7      {
 998                             MessageLoaderParms message(
 999                                 "Common.Exception.UNINITIALIZED_OBJECT_EXCEPTION",
1000                                 "The object is not initialized.");
1001                     
1002                             throw CIMException(CIM_ERR_FAILED, message);
1003                         }
1004                     
1005                         SimpleObjectResponseHandler::deliver(cimObject);
1006                     }
1007                     
1008 thilo.boehm    1.34 void ReferencesResponseHandler::deliver(const SCMOInstance& scmoObject)
1009                     {
1010                         if (scmoObject.isUninitialized())
1011                         {
1012                             MessageLoaderParms message(
1013                                 "Common.Exception.UNINITIALIZED_OBJECT_EXCEPTION",
1014                                 "The object is not initialized.");
1015                     
1016                             throw CIMException(CIM_ERR_FAILED, message);
1017                         }
1018                         SimpleObjectResponseHandler::deliver(scmoObject);
1019                     }
1020                     
1021 kumpf          1.23 String ReferencesResponseHandler::getClass() const
1022 chip           1.7  {
1023 kumpf          1.23     return String("ReferencesResponseHandler");
1024 chip           1.7  }
1025                     
1026 kumpf          1.23 void ReferencesResponseHandler::transfer()
1027 chip           1.7  {
1028 kumpf          1.23     CIMReferencesResponseMessage& msg =
1029                             *static_cast<CIMReferencesResponseMessage*>(getResponse());
1030 chip           1.7  
1031 thilo.boehm    1.34     Array<CIMObject> cimObjs= getObjects();
1032                         Array<SCMOInstance> scmoObjs= getSCMOObjects();
1033                         if (cimObjs.size() != 0)
1034                         {
1035                             msg.getResponseData().setObjects(cimObjs);
1036                         }
1037                         if (scmoObjs.size() != 0)
1038                         {
1039                             msg.getResponseData().setSCMO(scmoObjs);
1040                         }
1041 chip           1.7  }
1042                     
1043                     //
1044                     // ReferenceNamesResponseHandler
1045                     //
1046                     
1047                     ReferenceNamesResponseHandler::ReferenceNamesResponseHandler(
1048 kumpf          1.14     CIMReferenceNamesRequestMessage* request,
1049                         CIMReferenceNamesResponseMessage* response,
1050                         PEGASUS_RESPONSE_CHUNK_CALLBACK_T responseChunkCallback)
1051                         : OperationResponseHandler(request, response, responseChunkCallback)
1052 chip           1.7  {
1053                     }
1054                     
1055 kumpf          1.23 void ReferenceNamesResponseHandler::deliver(const CIMObjectPath& cimObjectPath)
1056 chip           1.7  {
1057 kumpf          1.23     if (cimObjectPath.getClassName().isNull())
1058 chip           1.7      {
1059                             MessageLoaderParms message(
1060                                 "Common.Exception.UNINITIALIZED_OBJECT_EXCEPTION",
1061                                 "The object is not initialized.");
1062                     
1063                             throw CIMException(CIM_ERR_FAILED, message);
1064                         }
1065                     
1066                         SimpleObjectPathResponseHandler::deliver(cimObjectPath);
1067                     }
1068                     
1069 thilo.boehm    1.34 void ReferenceNamesResponseHandler::deliver(const SCMOInstance& scmoObjectPath)
1070                     {
1071                         SimpleObjectPathResponseHandler::deliver(scmoObjectPath);
1072                     }
1073                     
1074 kumpf          1.23 String ReferenceNamesResponseHandler::getClass() const
1075 chip           1.7  {
1076 kumpf          1.23     return String("ReferenceNamesResponseHandler");
1077 chip           1.7  }
1078                     
1079 kumpf          1.23 void ReferenceNamesResponseHandler::transfer()
1080 chip           1.7  {
1081 kumpf          1.23     CIMReferenceNamesResponseMessage& msg =
1082                             *static_cast<CIMReferenceNamesResponseMessage*>(getResponse());
1083 chip           1.7  
1084 thilo.boehm    1.34     Array<CIMObjectPath> cimObjs= getObjects();
1085                         Array<SCMOInstance> scmoObjs= getSCMOObjects();
1086                         if (cimObjs.size() != 0)
1087                         {
1088                             msg.getResponseData().setInstanceNames(cimObjs);
1089                         }
1090                         if (scmoObjs.size() != 0)
1091                         {
1092                             msg.getResponseData().setSCMO(scmoObjs);
1093                         }
1094 chip           1.7  }
1095                     
1096                     //
1097                     // InvokeMethodResponseHandler
1098                     //
1099                     
1100                     InvokeMethodResponseHandler::InvokeMethodResponseHandler(
1101 kumpf          1.14     CIMInvokeMethodRequestMessage* request,
1102                         CIMInvokeMethodResponseMessage* response,
1103                         PEGASUS_RESPONSE_CHUNK_CALLBACK_T responseChunkCallback)
1104                         : OperationResponseHandler(request, response, responseChunkCallback)
1105 chip           1.7  {
1106                     }
1107                     
1108 kumpf          1.23 void InvokeMethodResponseHandler::deliverParamValue(
1109                         const CIMParamValue& cimParamValue)
1110 chip           1.7  {
1111 kumpf          1.23     if (cimParamValue.isUninitialized())
1112 chip           1.7      {
1113                             MessageLoaderParms message(
1114                                 "Common.Exception.UNINITIALIZED_OBJECT_EXCEPTION",
1115                                 "The object is not initialized.");
1116                     
1117                             throw CIMException(CIM_ERR_FAILED, message);
1118                         }
1119                     
1120                         SimpleMethodResultResponseHandler::deliverParamValue(cimParamValue);
1121                     }
1122                     
1123 kumpf          1.23 void InvokeMethodResponseHandler::deliver(const CIMValue& cimValue)
1124 chip           1.7  {
1125 kumpf          1.23     if (cimValue.isNull())
1126 chip           1.7      {
1127                             MessageLoaderParms message(
1128                                 "Common.Exception.UNINITIALIZED_OBJECT_EXCEPTION",
1129                                 "The object is not initialized.");
1130                     
1131                             throw CIMException(CIM_ERR_FAILED, message);
1132                         }
1133                     
1134                         SimpleMethodResultResponseHandler::deliver(cimValue);
1135                     }
1136                     
1137 kumpf          1.23 String InvokeMethodResponseHandler::getClass() const
1138 chip           1.7  {
1139 kumpf          1.23     return String("InvokeMethodResponseHandler");
1140 chip           1.7  }
1141                     
1142 kumpf          1.23 void InvokeMethodResponseHandler::transfer()
1143 chip           1.7  {
1144 kumpf          1.23     CIMInvokeMethodResponseMessage& msg =
1145                             *static_cast<CIMInvokeMethodResponseMessage*>(getResponse());
1146 chip           1.7  
1147                         msg.outParameters = getParamValues();
1148                     
1149                         // ATTN-RK-20020903: Is it legal for the return value to be null?
1150                         // if not, then the check must be done here since deliver() works off the
1151                         // virtual size, which refers to out parameters!
1152                         msg.retValue = getReturnValue();
1153                     }
1154                     
1155                     //
1156                     // EnableIndicationsResponseHandler
1157                     //
1158                     
1159                     EnableIndicationsResponseHandler::EnableIndicationsResponseHandler(
1160 kumpf          1.14     CIMRequestMessage* request,
1161                         CIMResponseMessage* response,
1162 kumpf          1.17     const CIMInstance& provider,
1163 kumpf          1.14     PEGASUS_INDICATION_CALLBACK_T indicationCallback,
1164                         PEGASUS_RESPONSE_CHUNK_CALLBACK_T responseChunkCallback)
1165                         : OperationResponseHandler(request, response, responseChunkCallback),
1166                           _indicationCallback(indicationCallback)
1167 chip           1.7  {
1168                         _provider = provider;
1169                     }
1170                     
1171 kumpf          1.23 void EnableIndicationsResponseHandler::deliver(
1172                         const CIMIndication& cimIndication)
1173 chip           1.7  {
1174                         OperationContext context;
1175                     
1176                         Array<CIMObjectPath> subscriptionInstanceNames;
1177                     
1178 kumpf          1.23     context.insert(
1179                             SubscriptionInstanceNamesContainer(subscriptionInstanceNames));
1180 chip           1.7  
1181                         deliver(context, cimIndication);
1182                     }
1183                     
1184 kumpf          1.23 void EnableIndicationsResponseHandler::deliver(
1185                         const OperationContext& context,
1186                         const CIMIndication& cimIndication)
1187 chip           1.7  {
1188 kumpf          1.23     if (cimIndication.isUninitialized())
1189 chip           1.7      {
1190                             MessageLoaderParms message(
1191                                 "Common.Exception.UNINITIALIZED_OBJECT_EXCEPTION",
1192                                 "The object is not initialized.");
1193                     
1194                             throw CIMException(CIM_ERR_FAILED, message);
1195                         }
1196                     
1197                         // ATTN: temporarily convert indication to instance
1198                         CIMInstance cimInstance(cimIndication);
1199                     
1200                         //  Get list of subscription instance names from context
1201                         Array<CIMObjectPath> subscriptionInstanceNames;
1202                     
1203 kumpf          1.23     if (context.contains(SubscriptionInstanceNamesContainer::NAME))
1204 chip           1.7      {
1205                             SubscriptionInstanceNamesContainer container =
1206                                 context.get(SubscriptionInstanceNamesContainer::NAME);
1207                     
1208                             subscriptionInstanceNames = container.getInstanceNames();
1209                         }
1210 a.dunfey       1.16     else
1211 chip           1.7      {
1212                             subscriptionInstanceNames.clear();
1213                         }
1214                     
1215 kumpf          1.12     ContentLanguageList contentLangs;
1216 chip           1.7  
1217 kumpf          1.23     if (context.contains(ContentLanguageListContainer::NAME))
1218 chip           1.7      {
1219                             // Get the Content-Language for this indication.  The provider
1220                             // does not have to add specify a language for the indication.
1221                             ContentLanguageListContainer langContainer =
1222                                 context.get(ContentLanguageListContainer::NAME);
1223                     
1224                             contentLangs = langContainer.getLanguages();
1225                         }
1226 a.dunfey       1.16     else
1227 chip           1.7      {
1228                             // The provider did not explicitly set a Content-Language for
1229                             // the indication.  Fall back to the lang set in this object.
1230                             contentLangs = getLanguages();
1231                         }
1232                     
1233 karl           1.35.4.1     Uint32 timeoutMilliSec = 0;
1234                             if (context.contains(TimeoutContainer::NAME))
1235                             {
1236                                 TimeoutContainer timeoutContainer =
1237                                     context.get(TimeoutContainer::NAME);
1238                                 timeoutMilliSec = timeoutContainer.getTimeOut();
1239                             }
1240                         
1241 chip           1.7          // create message
1242 kumpf          1.23         CIMProcessIndicationRequestMessage* request =
1243 chip           1.7              new CIMProcessIndicationRequestMessage(
1244                                 XmlWriter::getNextMessageId(),
1245                                 cimInstance.getPath().getNameSpace(),
1246                                 cimInstance,
1247                                 subscriptionInstanceNames,
1248                                 _provider,
1249 karl           1.35.4.1         QueueIdStack(),  // Must be filled in by the callback function
1250                                 timeoutMilliSec);
1251 chip           1.7      
1252                             request->operationContext = context;
1253                         
1254 kumpf          1.23         if (request->operationContext.contains(ContentLanguageListContainer::NAME))
1255 chip           1.7          {
1256 kumpf          1.23             request->operationContext.set(
1257                                     ContentLanguageListContainer(contentLangs));
1258 chip           1.7          }
1259 a.dunfey       1.16         else
1260 chip           1.7          {
1261 kumpf          1.23             request->operationContext.insert(
1262                                     ContentLanguageListContainer(contentLangs));
1263 chip           1.7          }
1264                         
1265                             _indicationCallback(request);
1266                         }
1267                         
1268 kumpf          1.23     void EnableIndicationsResponseHandler::deliver(
1269                             const Array<CIMIndication>& cimIndications)
1270 chip           1.7      {
1271                             OperationContext context;
1272                         
1273                             deliver(context, cimIndications);
1274                         }
1275                         
1276 kumpf          1.23     void EnableIndicationsResponseHandler::deliver(
1277                             const OperationContext& context,
1278                             const Array<CIMIndication>& cimIndications)
1279 chip           1.7      {
1280 kumpf          1.23         for (Uint32 i = 0, n = cimIndications.size(); i < n; i++)
1281 chip           1.7          {
1282                                 deliver(context, cimIndications[i]);
1283                             }
1284                         }
1285                         
1286 kumpf          1.23     String EnableIndicationsResponseHandler::getClass() const
1287 chip           1.7      {
1288 kumpf          1.23         return String("EnableIndicationsResponseHandler");
1289 chip           1.7      }
1290                         
1291 kumpf          1.23     Boolean EnableIndicationsResponseHandler::isAsync() const
1292 chip           1.7      {
1293 kumpf          1.23         return false;
1294 chip           1.7      }
1295                         
1296 schuur         1.1      PEGASUS_NAMESPACE_END

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2