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

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2