(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 r.kieninger    1.33.2.2 void GetInstanceResponseHandler::deliver(const SCMOInstance& cimInstance)
 322                         {
 323                             if (cimInstance.isUninitialized())
 324                             {
 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                             if (SimpleInstanceResponseHandler::size() != 0)
 333                             {
 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                             SCMOInstance localInstance(cimInstance);
 342 r.kieninger    1.33.2.2 #ifdef PEGASUS_ENABLE_OBJECT_NORMALIZATION
 343                             // 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                             if (localInstance.getPath().getKeyBindings().size() == 0)
 347                             {
 348                                 // ATTN: should clone before modification
 349                                 localInstance.setPath(static_cast<CIMGetInstanceRequestMessage*>(
 350                                     getRequest())->instanceName);
 351                             }
 352                         #endif
 353                             SimpleInstanceResponseHandler::deliver(localInstance);
 354                             // TBD
 355                             //_normalizer.processInstance(localInstance));
 356                         }
 357                         
 358 kumpf          1.23     void GetInstanceResponseHandler::deliver(const CIMInstance& cimInstance)
 359 chip           1.7      {
 360 kumpf          1.23         if (cimInstance.isUninitialized())
 361 chip           1.7          {
 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 kumpf          1.23         if (SimpleInstanceResponseHandler::size() != 0)
 370 chip           1.9          {
 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 venkat.puvvada 1.26         CIMInstance localInstance(cimInstance);
 379 kumpf          1.23     #ifdef PEGASUS_ENABLE_OBJECT_NORMALIZATION
 380 chip           1.7          // The normalizer expects an object path embedded in instances even
 381                             // though it is not required by this operation. Use the requested
 382                             // object path is missing from the instance.
 383 kumpf          1.23         if (localInstance.getPath().getKeyBindings().size() == 0)
 384 chip           1.7          {
 385                                 // ATTN: should clone before modification
 386 kumpf          1.23             localInstance.setPath(static_cast<CIMGetInstanceRequestMessage*>(
 387                                     getRequest())->instanceName);
 388 chip           1.7          }
 389 venkat.puvvada 1.26     #endif
 390 kumpf          1.23         SimpleInstanceResponseHandler::deliver(
 391                                 _normalizer.processInstance(localInstance));
 392 chip           1.7      }
 393                         
 394 kumpf          1.23     void GetInstanceResponseHandler::complete()
 395 chip           1.9      {
 396 kumpf          1.23         if (SimpleInstanceResponseHandler::size() == 0)
 397 chip           1.9          {
 398                                 MessageLoaderParms message(
 399                                     "Server.OperationResponseHandler.TOO_FEW_OBJECTS_DELIVERED",
 400                                     "Too few objects delivered.");
 401 venkat.puvvada 1.21             // Provider claims success, no instances returned. -V see Bug #4104
 402                                 setStatus(CIM_ERR_NOT_FOUND);
 403 chip           1.9              throw CIMException(CIM_ERR_FAILED, message);
 404                             }
 405                         
 406                             SimpleInstanceResponseHandler::complete();
 407                         }
 408                         
 409 kumpf          1.23     String GetInstanceResponseHandler::getClass() const
 410 chip           1.7      {
 411 kumpf          1.23         return String("GetInstanceResponseHandler");
 412 chip           1.7      }
 413                         
 414 kumpf          1.23     void GetInstanceResponseHandler::transfer()
 415 chip           1.7      {
 416 kumpf          1.23         if (size() > 0)
 417 chip           1.7          {
 418 kumpf          1.23             CIMGetInstanceResponseMessage& msg =
 419                                     *static_cast<CIMGetInstanceResponseMessage*>(getResponse());
 420 chip           1.7      
 421 r.kieninger    1.33.2.2         msg.getResponseData().setSCMOInstance(getSCMOObjects()[0]);
 422                                 // TODO --RK--> enable for C++ Providers again
 423                                 // msg.getResponseData().setCimInstance(getObjects()[0]);
 424 chip           1.7          }
 425                         }
 426                         
 427 kumpf          1.23     void GetInstanceResponseHandler::validate()
 428 chip           1.7      {
 429 kumpf          1.23         if (getResponseObjectTotal() == 0)
 430 chip           1.7          {
 431                                 // error? provider claims success,
 432                                 // but did not deliver an instance.
 433                                 setStatus(CIM_ERR_NOT_FOUND);
 434                             }
 435                         }
 436                         
 437                         //
 438                         // EnumerateInstancesResponseHandler
 439                         //
 440                         
 441                         EnumerateInstancesResponseHandler::EnumerateInstancesResponseHandler(
 442 kumpf          1.14         CIMEnumerateInstancesRequestMessage* request,
 443                             CIMEnumerateInstancesResponseMessage* response,
 444                             PEGASUS_RESPONSE_CHUNK_CALLBACK_T responseChunkCallback)
 445                             : OperationResponseHandler(request, response, responseChunkCallback)
 446 chip           1.7      {
 447 venkat.puvvada 1.26         _initializeNormalizer(
 448                                 request,
 449 a.dunfey       1.15             request->includeQualifiers,
 450                                 request->includeClassOrigin,
 451 venkat.puvvada 1.26             _normalizer);
 452 chip           1.7      }
 453                         
 454 kumpf          1.23     void EnumerateInstancesResponseHandler::deliver(const CIMInstance& cimInstance)
 455 chip           1.7      {
 456 kumpf          1.23         if (cimInstance.isUninitialized())
 457 chip           1.7          {
 458                                 MessageLoaderParms message(
 459                                     "Common.Exception.UNINITIALIZED_OBJECT_EXCEPTION",
 460                                     "The object is not initialized.");
 461                         
 462                                 throw CIMException(CIM_ERR_FAILED, message);
 463                             }
 464                         
 465 kumpf          1.23         SimpleInstanceResponseHandler::deliver(
 466                                 _normalizer.processInstance(cimInstance));
 467 chip           1.7      }
 468                         
 469 r.kieninger    1.33.2.1 void EnumerateInstancesResponseHandler::deliver(const SCMOInstance& cimInstance)
 470                         {
 471 r.kieninger    1.33.2.2     if (cimInstance.isUninitialized())
 472 r.kieninger    1.33.2.1     {
 473                                 MessageLoaderParms message(
 474                                     "Common.Exception.UNINITIALIZED_OBJECT_EXCEPTION",
 475                                     "The object is not initialized.");
 476                         
 477                                 throw CIMException(CIM_ERR_FAILED, message);
 478 r.kieninger    1.33.2.2     }
 479 r.kieninger    1.33.2.1 
 480                             SimpleInstanceResponseHandler::deliver(cimInstance);
 481 r.kieninger    1.33.2.2     // TBD
 482 r.kieninger    1.33.2.1     //    _normalizer.processInstance(cimInstance));
 483                         }
 484                         
 485 kumpf          1.23     String EnumerateInstancesResponseHandler::getClass() const
 486 chip           1.7      {
 487 kumpf          1.23         return String("EnumerateInstancesResponseHandler");
 488 chip           1.7      }
 489                         
 490 kumpf          1.23     void EnumerateInstancesResponseHandler::transfer()
 491 chip           1.7      {
 492 kumpf          1.23         CIMEnumerateInstancesResponseMessage& msg =
 493                                 *static_cast<CIMEnumerateInstancesResponseMessage*>(getResponse());
 494 chip           1.7      
 495 r.kieninger    1.33.2.2     // TBD --RK--> enable for C++ Providers again
 496 r.kieninger    1.33.2.1     msg.getResponseData().setSCMOInstances(getSCMOObjects());
 497 chip           1.7      }
 498                         
 499                         //
 500                         // EnumerateInstanceNamesResponseHandler
 501                         //
 502                         
 503                         EnumerateInstanceNamesResponseHandler::EnumerateInstanceNamesResponseHandler(
 504 kumpf          1.14         CIMEnumerateInstanceNamesRequestMessage* request,
 505                             CIMEnumerateInstanceNamesResponseMessage* response,
 506                             PEGASUS_RESPONSE_CHUNK_CALLBACK_T responseChunkCallback)
 507                             : OperationResponseHandler(request, response, responseChunkCallback)
 508 chip           1.7      {
 509 venkat.puvvada 1.26         _initializeNormalizer(
 510                                 request,
 511 a.dunfey       1.15             false,
 512                                 false,
 513 venkat.puvvada 1.26             _normalizer);
 514 chip           1.7      }
 515                         
 516 kumpf          1.23     void EnumerateInstanceNamesResponseHandler::deliver(
 517                             const CIMObjectPath& cimObjectPath)
 518 chip           1.7      {
 519 kumpf          1.23         if (cimObjectPath.getClassName().isNull())
 520 chip           1.7          {
 521                                 MessageLoaderParms message(
 522                                     "Common.Exception.UNINITIALIZED_OBJECT_EXCEPTION",
 523                                     "The object is not initialized.");
 524                         
 525                                 throw CIMException(CIM_ERR_FAILED, message);
 526                             }
 527                         
 528 kumpf          1.23         SimpleObjectPathResponseHandler::deliver(
 529                                 _normalizer.processInstanceObjectPath(cimObjectPath));
 530 chip           1.7      }
 531                         
 532 r.kieninger    1.33.2.1 void EnumerateInstanceNamesResponseHandler::deliver(
 533                             const SCMOInstance& scmoObjectPath)
 534                         {
 535                             if (scmoObjectPath.getClassName()==NULL)
 536                             {
 537                                 MessageLoaderParms message(
 538                                     "Common.Exception.UNINITIALIZED_OBJECT_EXCEPTION",
 539                                     "The object is not initialized.");
 540                         
 541                                 throw CIMException(CIM_ERR_FAILED, message);
 542                             }
 543                         
 544                             SimpleObjectPathResponseHandler::deliver(scmoObjectPath);
 545 r.kieninger    1.33.2.2     // TBD
 546                             //        _normalizer.processInstanceObjectPath(cimObjectPath));
 547 r.kieninger    1.33.2.1 }
 548                         
 549 kumpf          1.23     String EnumerateInstanceNamesResponseHandler::getClass() const
 550 chip           1.7      {
 551 kumpf          1.23         return String("EnumerateInstanceNamesResponseHandler");
 552 chip           1.7      }
 553                         
 554 kumpf          1.23     void EnumerateInstanceNamesResponseHandler::transfer()
 555 chip           1.7      {
 556 kumpf          1.23         CIMEnumerateInstanceNamesResponseMessage& msg =
 557                                 *static_cast<CIMEnumerateInstanceNamesResponseMessage*>(getResponse());
 558 chip           1.7      
 559 r.kieninger    1.33.2.2     // TODO --RK--> enable for C++ Providers again
 560 r.kieninger    1.33.2.1     msg.getResponseData().setSCMOInstanceNames(getSCMOObjects());
 561 chip           1.7      }
 562                         
 563                         //
 564                         // CreateInstanceResponseHandler
 565                         //
 566                         
 567                         CreateInstanceResponseHandler::CreateInstanceResponseHandler(
 568 kumpf          1.14         CIMCreateInstanceRequestMessage* request,
 569                             CIMCreateInstanceResponseMessage* response,
 570                             PEGASUS_RESPONSE_CHUNK_CALLBACK_T responseChunkCallback)
 571                             : OperationResponseHandler(request, response, responseChunkCallback)
 572 chip           1.7      {
 573                         }
 574                         
 575 kumpf          1.23     void CreateInstanceResponseHandler::deliver(const CIMObjectPath& cimObjectPath)
 576 chip           1.7      {
 577 kumpf          1.23         if (cimObjectPath.getClassName().isNull())
 578 chip           1.7          {
 579                                 MessageLoaderParms message(
 580                                     "Common.Exception.UNINITIALIZED_OBJECT_EXCEPTION",
 581                                     "The object is not initialized.");
 582                         
 583                                 throw CIMException(CIM_ERR_FAILED, message);
 584                             }
 585                         
 586 kumpf          1.23         if (SimpleObjectPathResponseHandler::size() != 0)
 587 chip           1.11         {
 588                                 MessageLoaderParms message(
 589                                     "Server.OperationResponseHandler.TOO_MANY_OBJECTS_DELIVERED",
 590                                     "Too many objects delivered.");
 591                         
 592                                 throw CIMException(CIM_ERR_FAILED, message);
 593                             }
 594                         
 595 chip           1.7          SimpleObjectPathResponseHandler::deliver(cimObjectPath);
 596                         }
 597                         
 598 r.kieninger    1.33.2.2 void CreateInstanceResponseHandler::deliver(const SCMOInstance& cimObjectPath)
 599                         {
 600                             if (cimObjectPath.getClassName() == 0)
 601                             {
 602                                 MessageLoaderParms message(
 603                                     "Common.Exception.UNINITIALIZED_OBJECT_EXCEPTION",
 604                                     "The object is not initialized.");
 605                         
 606                                 throw CIMException(CIM_ERR_FAILED, message);
 607                             }
 608                         
 609                             if (SimpleObjectPathResponseHandler::size() != 0)
 610                             {
 611                                 MessageLoaderParms message(
 612                                     "Server.OperationResponseHandler.TOO_MANY_OBJECTS_DELIVERED",
 613                                     "Too many objects delivered.");
 614                         
 615                                 throw CIMException(CIM_ERR_FAILED, message);
 616                             }
 617                         
 618                             SimpleObjectPathResponseHandler::deliver(cimObjectPath);
 619 r.kieninger    1.33.2.2 }
 620                         
 621 kumpf          1.23     void CreateInstanceResponseHandler::complete()
 622 chip           1.9      {
 623 kumpf          1.23         if (SimpleObjectPathResponseHandler::size() == 0)
 624 chip           1.9          {
 625                                 MessageLoaderParms message(
 626                                     "Server.OperationResponseHandler.TOO_FEW_OBJECTS_DELIVERED",
 627                                     "Too few objects delivered.");
 628                         
 629                                 throw CIMException(CIM_ERR_FAILED, message);
 630                             }
 631                         
 632                             SimpleObjectPathResponseHandler::complete();
 633                         }
 634                         
 635 kumpf          1.23     String CreateInstanceResponseHandler::getClass() const
 636 chip           1.7      {
 637 kumpf          1.23         return String("CreateInstanceResponseHandler");
 638 chip           1.7      }
 639                         
 640                         #if 0
 641                         // ATTN: is it an error to not return instance name?
 642 kumpf          1.23     void CreateInstanceResponseHandler::validate()
 643 chip           1.7      {
 644 kumpf          1.23         if (getResponseObjectTotal() == 0)
 645 chip           1.7          {
 646                                 setStatus(CIM_ERR_NOT_FOUND);
 647                             }
 648                         }
 649                         #endif
 650                         
 651 kumpf          1.23     void CreateInstanceResponseHandler::transfer()
 652 chip           1.7      {
 653 kumpf          1.23         if (size() > 0)
 654 chip           1.7          {
 655 kumpf          1.23             CIMCreateInstanceResponseMessage& msg =
 656                                     *static_cast<CIMCreateInstanceResponseMessage*>(getResponse());
 657 chip           1.7      
 658                                 msg.instanceName = getObjects()[0];
 659                             }
 660                         }
 661                         
 662                         //
 663                         // ModifyInstanceResponseHandler
 664                         //
 665                         
 666                         ModifyInstanceResponseHandler::ModifyInstanceResponseHandler(
 667 kumpf          1.14         CIMModifyInstanceRequestMessage* request,
 668                             CIMModifyInstanceResponseMessage* response,
 669                             PEGASUS_RESPONSE_CHUNK_CALLBACK_T responseChunkCallback)
 670                             : OperationResponseHandler(request, response, responseChunkCallback)
 671 chip           1.7      {
 672                         }
 673                         
 674 kumpf          1.23     String ModifyInstanceResponseHandler::getClass() const
 675 chip           1.7      {
 676 kumpf          1.23         return String("ModifyInstanceResponseHandler");
 677 chip           1.7      }
 678                         
 679                         //
 680                         // DeleteInstanceResponseHandler
 681                         //
 682                         
 683                         DeleteInstanceResponseHandler::DeleteInstanceResponseHandler(
 684 kumpf          1.14         CIMDeleteInstanceRequestMessage* request,
 685                             CIMDeleteInstanceResponseMessage* response,
 686                             PEGASUS_RESPONSE_CHUNK_CALLBACK_T responseChunkCallback)
 687                             : OperationResponseHandler(request, response, responseChunkCallback)
 688 chip           1.7      {
 689                         }
 690                         
 691 kumpf          1.23     String DeleteInstanceResponseHandler::getClass() const
 692 chip           1.7      {
 693 kumpf          1.23         return String("DeleteInstanceResponseHandler");
 694 chip           1.7      }
 695                         
 696                         //
 697                         // GetPropertyResponseHandler
 698                         //
 699                         
 700                         GetPropertyResponseHandler::GetPropertyResponseHandler(
 701 kumpf          1.14         CIMGetPropertyRequestMessage* request,
 702                             CIMGetPropertyResponseMessage* response,
 703                             PEGASUS_RESPONSE_CHUNK_CALLBACK_T responseChunkCallback)
 704                             : OperationResponseHandler(request, response, responseChunkCallback)
 705 chip           1.7      {
 706                         }
 707                         
 708 kumpf          1.23     void GetPropertyResponseHandler::deliver(const CIMValue& cimValue)
 709 chip           1.7      {
 710 kumpf          1.23         if (cimValue.isNull())
 711 chip           1.7          {
 712                                 MessageLoaderParms message(
 713                                     "Common.Exception.UNINITIALIZED_OBJECT_EXCEPTION",
 714                                     "The object is not initialized.");
 715                         
 716                                 throw CIMException(CIM_ERR_FAILED, message);
 717                             }
 718                         
 719                             SimpleValueResponseHandler::deliver(cimValue);
 720                         }
 721                         
 722 kumpf          1.23     String GetPropertyResponseHandler::getClass() const
 723 chip           1.7      {
 724 kumpf          1.23         return String("GetPropertyResponseHandler");
 725 chip           1.7      }
 726                         
 727 kumpf          1.23     void GetPropertyResponseHandler::transfer()
 728 chip           1.7      {
 729 kumpf          1.23         if (size() > 0)
 730 chip           1.7          {
 731 kumpf          1.23             CIMGetPropertyResponseMessage& msg =
 732                                     *static_cast<CIMGetPropertyResponseMessage*>(getResponse());
 733 chip           1.7      
 734                                 msg.value = getObjects()[0];
 735                             }
 736                         }
 737                         
 738 kumpf          1.23     void GetPropertyResponseHandler::validate()
 739 chip           1.7      {
 740                             // error? provider claims success,
 741                             // but did not deliver an instance.
 742 kumpf          1.23         if (getResponseObjectTotal() == 0)
 743 chip           1.7          {
 744                                 setStatus(CIM_ERR_NOT_FOUND);
 745                             }
 746                         }
 747                         
 748                         //
 749                         // SetPropertyResponseHandler
 750                         //
 751                         
 752                         SetPropertyResponseHandler::SetPropertyResponseHandler(
 753 kumpf          1.14         CIMSetPropertyRequestMessage* request,
 754                             CIMSetPropertyResponseMessage* response,
 755                             PEGASUS_RESPONSE_CHUNK_CALLBACK_T responseChunkCallback)
 756                             : OperationResponseHandler(request, response, responseChunkCallback)
 757 chip           1.7      {
 758                         }
 759                         
 760 kumpf          1.23     String SetPropertyResponseHandler::getClass() const
 761 chip           1.7      {
 762 kumpf          1.23         return String("SetPropertyResponseHandler");
 763 chip           1.7      }
 764                         
 765                         //
 766                         // ExecQueryResponseHandler
 767                         //
 768                         
 769                         ExecQueryResponseHandler::ExecQueryResponseHandler(
 770 kumpf          1.14         CIMExecQueryRequestMessage* request,
 771                             CIMExecQueryResponseMessage* response,
 772                             PEGASUS_RESPONSE_CHUNK_CALLBACK_T responseChunkCallback)
 773                             : OperationResponseHandler(request, response, responseChunkCallback)
 774 chip           1.7      {
 775                         }
 776                         
 777 kumpf          1.23     void ExecQueryResponseHandler::deliver(const CIMInstance& cimInstance)
 778 chip           1.7      {
 779 kumpf          1.23         if (cimInstance.isUninitialized())
 780 chip           1.7          {
 781                                 MessageLoaderParms message(
 782                                     "Common.Exception.UNINITIALIZED_OBJECT_EXCEPTION",
 783                                     "The object is not initialized.");
 784                         
 785                                 throw CIMException(CIM_ERR_FAILED, message);
 786                             }
 787                         
 788                             SimpleInstance2ObjectResponseHandler::deliver(cimInstance);
 789                         }
 790                         
 791 r.kieninger    1.33.2.1 void ExecQueryResponseHandler::deliver(const SCMOInstance& cimInstance)
 792                         {
 793 r.kieninger    1.33.2.2     if (cimInstance.isUninitialized())
 794 r.kieninger    1.33.2.1     {
 795                                 MessageLoaderParms message(
 796                                     "Common.Exception.UNINITIALIZED_OBJECT_EXCEPTION",
 797                                     "The object is not initialized.");
 798                         
 799                                 throw CIMException(CIM_ERR_FAILED, message);
 800 r.kieninger    1.33.2.2     }
 801 r.kieninger    1.33.2.1 
 802                             SimpleInstance2ObjectResponseHandler::deliver(cimInstance);
 803                         }
 804                         
 805 kumpf          1.23     String ExecQueryResponseHandler::getClass() const
 806 chip           1.7      {
 807 kumpf          1.23         return String("ExecQueryResponseHandler");
 808 chip           1.7      }
 809                         
 810 kumpf          1.23     void ExecQueryResponseHandler::transfer()
 811 chip           1.7      {
 812 kumpf          1.23         CIMExecQueryResponseMessage& msg =
 813                                 *static_cast<CIMExecQueryResponseMessage*>(getResponse());
 814 chip           1.7      
 815 r.kieninger    1.33         msg.getResponseData().setCIMObjects(getObjects());
 816 chip           1.7      }
 817                         
 818 kumpf          1.23     Boolean ExecQueryResponseHandler::isAsync() const
 819 chip           1.7      {
 820 kumpf          1.23         return false;
 821 chip           1.7      }
 822                         
 823                         //
 824                         // AssociatorsResponseHandler
 825                         //
 826                         
 827                         AssociatorsResponseHandler::AssociatorsResponseHandler(
 828 kumpf          1.14         CIMAssociatorsRequestMessage* request,
 829                             CIMAssociatorsResponseMessage* response,
 830                             PEGASUS_RESPONSE_CHUNK_CALLBACK_T responseChunkCallback)
 831                             : OperationResponseHandler(request, response, responseChunkCallback)
 832 chip           1.7      {
 833                         }
 834                         
 835 kumpf          1.23     void AssociatorsResponseHandler::deliver(const CIMObject& cimObject)
 836 chip           1.7      {
 837 kumpf          1.23         if (cimObject.isUninitialized())
 838 chip           1.7          {
 839                                 MessageLoaderParms message(
 840                                     "Common.Exception.UNINITIALIZED_OBJECT_EXCEPTION",
 841                                     "The object is not initialized.");
 842                         
 843                                 throw CIMException(CIM_ERR_FAILED, message);
 844                             }
 845                         
 846                             SimpleObjectResponseHandler::deliver(cimObject);
 847                         }
 848                         
 849 r.kieninger    1.33.2.2 void AssociatorsResponseHandler::deliver(const SCMOInstance& cimObject)
 850                         {
 851                             if (cimObject.isUninitialized())
 852                             {
 853                                 MessageLoaderParms message(
 854                                     "Common.Exception.UNINITIALIZED_OBJECT_EXCEPTION",
 855                                     "The object is not initialized.");
 856                         
 857                                 throw CIMException(CIM_ERR_FAILED, message);
 858                             }
 859                         
 860                             SimpleObjectResponseHandler::deliver(cimObject);
 861                         }
 862                         
 863 kumpf          1.23     String AssociatorsResponseHandler::getClass() const
 864 chip           1.7      {
 865 kumpf          1.23         return String("AssociatorsResponseHandler");
 866 chip           1.7      }
 867                         
 868 kumpf          1.23     void AssociatorsResponseHandler::transfer()
 869 chip           1.7      {
 870 kumpf          1.23         CIMAssociatorsResponseMessage& msg =
 871                                 *static_cast<CIMAssociatorsResponseMessage*>(getResponse());
 872 chip           1.7      
 873 r.kieninger    1.33.2.2     // TODO --RK--> enable for C++ Providers again
 874 r.kieninger    1.33         msg.getResponseData().setCIMObjects(getObjects());
 875 chip           1.7      }
 876                         
 877                         //
 878                         // AssociatorNamesResponseHandler
 879                         //
 880                         
 881                         AssociatorNamesResponseHandler::AssociatorNamesResponseHandler(
 882 kumpf          1.14         CIMAssociatorNamesRequestMessage* request,
 883                             CIMAssociatorNamesResponseMessage* response,
 884                             PEGASUS_RESPONSE_CHUNK_CALLBACK_T responseChunkCallback)
 885                             : OperationResponseHandler(request, response, responseChunkCallback)
 886 chip           1.7      {
 887                         }
 888                         
 889 kumpf          1.23     void AssociatorNamesResponseHandler::deliver(const CIMObjectPath& cimObjectPath)
 890 chip           1.7      {
 891 kumpf          1.23         if (cimObjectPath.getClassName().isNull())
 892 chip           1.7          {
 893                                 MessageLoaderParms message(
 894                                     "Common.Exception.UNINITIALIZED_OBJECT_EXCEPTION",
 895                                     "The object is not initialized.");
 896                         
 897                                 throw CIMException(CIM_ERR_FAILED, message);
 898                             }
 899                         
 900                             SimpleObjectPathResponseHandler::deliver(cimObjectPath);
 901                         }
 902                         
 903 r.kieninger    1.33.2.2 void AssociatorNamesResponseHandler::deliver(const SCMOInstance& cimObjectPath)
 904                         {
 905                             if (cimObjectPath.getClassName() == 0)
 906                             {
 907                                 MessageLoaderParms message(
 908                                     "Common.Exception.UNINITIALIZED_OBJECT_EXCEPTION",
 909                                     "The object is not initialized.");
 910                         
 911                                 throw CIMException(CIM_ERR_FAILED, message);
 912                             }
 913                         
 914                             SimpleObjectPathResponseHandler::deliver(cimObjectPath);
 915                         }
 916                         
 917 kumpf          1.23     String AssociatorNamesResponseHandler::getClass() const
 918 chip           1.7      {
 919 kumpf          1.23         return String("AssociatorNamesResponseHandler");
 920 chip           1.7      }
 921                         
 922 kumpf          1.23     void AssociatorNamesResponseHandler::transfer()
 923 chip           1.7      {
 924 kumpf          1.23         CIMAssociatorNamesResponseMessage& msg =
 925                                 *static_cast<CIMAssociatorNamesResponseMessage*>(getResponse());
 926 chip           1.7      
 927                             msg.objectNames = getObjects();
 928                         }
 929                         
 930                         //
 931                         // ReferencesResponseHandler
 932                         //
 933                         
 934                         ReferencesResponseHandler::ReferencesResponseHandler(
 935 kumpf          1.14         CIMReferencesRequestMessage* request,
 936                             CIMReferencesResponseMessage* response,
 937                             PEGASUS_RESPONSE_CHUNK_CALLBACK_T responseChunkCallback)
 938                             : OperationResponseHandler(request, response, responseChunkCallback)
 939 chip           1.7      {
 940                         }
 941                         
 942 kumpf          1.23     void ReferencesResponseHandler::deliver(const CIMObject& cimObject)
 943 chip           1.7      {
 944 kumpf          1.23         if (cimObject.isUninitialized())
 945 chip           1.7          {
 946                                 MessageLoaderParms message(
 947                                     "Common.Exception.UNINITIALIZED_OBJECT_EXCEPTION",
 948                                     "The object is not initialized.");
 949                         
 950                                 throw CIMException(CIM_ERR_FAILED, message);
 951                             }
 952                         
 953                             SimpleObjectResponseHandler::deliver(cimObject);
 954                         }
 955                         
 956 r.kieninger    1.33.2.2 void ReferencesResponseHandler::deliver(const SCMOInstance& cimObject)
 957                         {
 958                             if (cimObject.isUninitialized())
 959                             {
 960                                 MessageLoaderParms message(
 961                                     "Common.Exception.UNINITIALIZED_OBJECT_EXCEPTION",
 962                                     "The object is not initialized.");
 963                         
 964                                 throw CIMException(CIM_ERR_FAILED, message);
 965                             }
 966                         
 967                             SimpleObjectResponseHandler::deliver(cimObject);
 968                         }
 969                         
 970 kumpf          1.23     String ReferencesResponseHandler::getClass() const
 971 chip           1.7      {
 972 kumpf          1.23         return String("ReferencesResponseHandler");
 973 chip           1.7      }
 974                         
 975 kumpf          1.23     void ReferencesResponseHandler::transfer()
 976 chip           1.7      {
 977 kumpf          1.23         CIMReferencesResponseMessage& msg =
 978                                 *static_cast<CIMReferencesResponseMessage*>(getResponse());
 979 chip           1.7      
 980                             msg.cimObjects = getObjects();
 981                         }
 982                         
 983                         //
 984                         // ReferenceNamesResponseHandler
 985                         //
 986                         
 987                         ReferenceNamesResponseHandler::ReferenceNamesResponseHandler(
 988 kumpf          1.14         CIMReferenceNamesRequestMessage* request,
 989                             CIMReferenceNamesResponseMessage* response,
 990                             PEGASUS_RESPONSE_CHUNK_CALLBACK_T responseChunkCallback)
 991                             : OperationResponseHandler(request, response, responseChunkCallback)
 992 chip           1.7      {
 993                         }
 994                         
 995 kumpf          1.23     void ReferenceNamesResponseHandler::deliver(const CIMObjectPath& cimObjectPath)
 996 chip           1.7      {
 997 kumpf          1.23         if (cimObjectPath.getClassName().isNull())
 998 chip           1.7          {
 999                                 MessageLoaderParms message(
1000                                     "Common.Exception.UNINITIALIZED_OBJECT_EXCEPTION",
1001                                     "The object is not initialized.");
1002                         
1003                                 throw CIMException(CIM_ERR_FAILED, message);
1004                             }
1005                         
1006                             SimpleObjectPathResponseHandler::deliver(cimObjectPath);
1007                         }
1008                         
1009 r.kieninger    1.33.2.2 void ReferenceNamesResponseHandler::deliver(const SCMOInstance& cimObjectPath)
1010                         {
1011                             if (cimObjectPath.getClassName() == 0)
1012                             {
1013                                 MessageLoaderParms message(
1014                                     "Common.Exception.UNINITIALIZED_OBJECT_EXCEPTION",
1015                                     "The object is not initialized.");
1016                         
1017                                 throw CIMException(CIM_ERR_FAILED, message);
1018                             }
1019                         
1020                             SimpleObjectPathResponseHandler::deliver(cimObjectPath);
1021                         }
1022                         
1023 kumpf          1.23     String ReferenceNamesResponseHandler::getClass() const
1024 chip           1.7      {
1025 kumpf          1.23         return String("ReferenceNamesResponseHandler");
1026 chip           1.7      }
1027                         
1028 kumpf          1.23     void ReferenceNamesResponseHandler::transfer()
1029 chip           1.7      {
1030 kumpf          1.23         CIMReferenceNamesResponseMessage& msg =
1031                                 *static_cast<CIMReferenceNamesResponseMessage*>(getResponse());
1032 chip           1.7      
1033                             msg.objectNames = getObjects();
1034                         }
1035                         
1036                         //
1037                         // InvokeMethodResponseHandler
1038                         //
1039                         
1040                         InvokeMethodResponseHandler::InvokeMethodResponseHandler(
1041 kumpf          1.14         CIMInvokeMethodRequestMessage* request,
1042                             CIMInvokeMethodResponseMessage* response,
1043                             PEGASUS_RESPONSE_CHUNK_CALLBACK_T responseChunkCallback)
1044                             : OperationResponseHandler(request, response, responseChunkCallback)
1045 chip           1.7      {
1046                         }
1047                         
1048 kumpf          1.23     void InvokeMethodResponseHandler::deliverParamValue(
1049                             const CIMParamValue& cimParamValue)
1050 chip           1.7      {
1051 kumpf          1.23         if (cimParamValue.isUninitialized())
1052 chip           1.7          {
1053                                 MessageLoaderParms message(
1054                                     "Common.Exception.UNINITIALIZED_OBJECT_EXCEPTION",
1055                                     "The object is not initialized.");
1056                         
1057                                 throw CIMException(CIM_ERR_FAILED, message);
1058                             }
1059                         
1060                             SimpleMethodResultResponseHandler::deliverParamValue(cimParamValue);
1061                         }
1062                         
1063 kumpf          1.23     void InvokeMethodResponseHandler::deliver(const CIMValue& cimValue)
1064 chip           1.7      {
1065 kumpf          1.23         if (cimValue.isNull())
1066 chip           1.7          {
1067                                 MessageLoaderParms message(
1068                                     "Common.Exception.UNINITIALIZED_OBJECT_EXCEPTION",
1069                                     "The object is not initialized.");
1070                         
1071                                 throw CIMException(CIM_ERR_FAILED, message);
1072                             }
1073                         
1074                             SimpleMethodResultResponseHandler::deliver(cimValue);
1075                         }
1076                         
1077 kumpf          1.23     String InvokeMethodResponseHandler::getClass() const
1078 chip           1.7      {
1079 kumpf          1.23         return String("InvokeMethodResponseHandler");
1080 chip           1.7      }
1081                         
1082 kumpf          1.23     void InvokeMethodResponseHandler::transfer()
1083 chip           1.7      {
1084 kumpf          1.23         CIMInvokeMethodResponseMessage& msg =
1085                                 *static_cast<CIMInvokeMethodResponseMessage*>(getResponse());
1086 chip           1.7      
1087                             msg.outParameters = getParamValues();
1088                         
1089                             // ATTN-RK-20020903: Is it legal for the return value to be null?
1090                             // if not, then the check must be done here since deliver() works off the
1091                             // virtual size, which refers to out parameters!
1092                             msg.retValue = getReturnValue();
1093                         }
1094                         
1095                         //
1096                         // EnableIndicationsResponseHandler
1097                         //
1098                         
1099                         EnableIndicationsResponseHandler::EnableIndicationsResponseHandler(
1100 kumpf          1.14         CIMRequestMessage* request,
1101                             CIMResponseMessage* response,
1102 kumpf          1.17         const CIMInstance& provider,
1103 kumpf          1.14         PEGASUS_INDICATION_CALLBACK_T indicationCallback,
1104                             PEGASUS_RESPONSE_CHUNK_CALLBACK_T responseChunkCallback)
1105                             : OperationResponseHandler(request, response, responseChunkCallback),
1106                               _indicationCallback(indicationCallback)
1107 chip           1.7      {
1108                             _provider = provider;
1109                         }
1110                         
1111 kumpf          1.23     void EnableIndicationsResponseHandler::deliver(
1112                             const CIMIndication& cimIndication)
1113 chip           1.7      {
1114                             OperationContext context;
1115                         
1116                             Array<CIMObjectPath> subscriptionInstanceNames;
1117                         
1118 kumpf          1.23         context.insert(
1119                                 SubscriptionInstanceNamesContainer(subscriptionInstanceNames));
1120 chip           1.7      
1121                             deliver(context, cimIndication);
1122                         }
1123                         
1124 kumpf          1.23     void EnableIndicationsResponseHandler::deliver(
1125                             const OperationContext& context,
1126                             const CIMIndication& cimIndication)
1127 chip           1.7      {
1128 kumpf          1.23         if (cimIndication.isUninitialized())
1129 chip           1.7          {
1130                                 MessageLoaderParms message(
1131                                     "Common.Exception.UNINITIALIZED_OBJECT_EXCEPTION",
1132                                     "The object is not initialized.");
1133                         
1134                                 throw CIMException(CIM_ERR_FAILED, message);
1135                             }
1136                         
1137                             // ATTN: temporarily convert indication to instance
1138                             CIMInstance cimInstance(cimIndication);
1139                         
1140                             //  Get list of subscription instance names from context
1141                             Array<CIMObjectPath> subscriptionInstanceNames;
1142                         
1143 kumpf          1.23         if (context.contains(SubscriptionInstanceNamesContainer::NAME))
1144 chip           1.7          {
1145                                 SubscriptionInstanceNamesContainer container =
1146                                     context.get(SubscriptionInstanceNamesContainer::NAME);
1147                         
1148                                 subscriptionInstanceNames = container.getInstanceNames();
1149                             }
1150 a.dunfey       1.16         else
1151 chip           1.7          {
1152                                 subscriptionInstanceNames.clear();
1153                             }
1154                         
1155 kumpf          1.12         ContentLanguageList contentLangs;
1156 chip           1.7      
1157 kumpf          1.23         if (context.contains(ContentLanguageListContainer::NAME))
1158 chip           1.7          {
1159                                 // Get the Content-Language for this indication.  The provider
1160                                 // does not have to add specify a language for the indication.
1161                                 ContentLanguageListContainer langContainer =
1162                                     context.get(ContentLanguageListContainer::NAME);
1163                         
1164                                 contentLangs = langContainer.getLanguages();
1165                             }
1166 a.dunfey       1.16         else
1167 chip           1.7          {
1168                                 // The provider did not explicitly set a Content-Language for
1169                                 // the indication.  Fall back to the lang set in this object.
1170                                 contentLangs = getLanguages();
1171                             }
1172                         
1173                             // create message
1174 kumpf          1.23         CIMProcessIndicationRequestMessage* request =
1175 chip           1.7              new CIMProcessIndicationRequestMessage(
1176                                 XmlWriter::getNextMessageId(),
1177                                 cimInstance.getPath().getNameSpace(),
1178                                 cimInstance,
1179                                 subscriptionInstanceNames,
1180                                 _provider,
1181                                 QueueIdStack());  // Must be filled in by the callback function
1182                         
1183                             request->operationContext = context;
1184                         
1185 kumpf          1.23         if (request->operationContext.contains(ContentLanguageListContainer::NAME))
1186 chip           1.7          {
1187 kumpf          1.23             request->operationContext.set(
1188                                     ContentLanguageListContainer(contentLangs));
1189 chip           1.7          }
1190 a.dunfey       1.16         else
1191 chip           1.7          {
1192 kumpf          1.23             request->operationContext.insert(
1193                                     ContentLanguageListContainer(contentLangs));
1194 chip           1.7          }
1195                         
1196                             _indicationCallback(request);
1197                         }
1198                         
1199 kumpf          1.23     void EnableIndicationsResponseHandler::deliver(
1200                             const Array<CIMIndication>& cimIndications)
1201 chip           1.7      {
1202                             OperationContext context;
1203                         
1204                             deliver(context, cimIndications);
1205                         }
1206                         
1207 kumpf          1.23     void EnableIndicationsResponseHandler::deliver(
1208                             const OperationContext& context,
1209                             const Array<CIMIndication>& cimIndications)
1210 chip           1.7      {
1211 kumpf          1.23         for (Uint32 i = 0, n = cimIndications.size(); i < n; i++)
1212 chip           1.7          {
1213                                 deliver(context, cimIndications[i]);
1214                             }
1215                         }
1216                         
1217 kumpf          1.23     String EnableIndicationsResponseHandler::getClass() const
1218 chip           1.7      {
1219 kumpf          1.23         return String("EnableIndicationsResponseHandler");
1220 chip           1.7      }
1221                         
1222 kumpf          1.23     Boolean EnableIndicationsResponseHandler::isAsync() const
1223 chip           1.7      {
1224 kumpf          1.23         return false;
1225 chip           1.7      }
1226                         
1227 schuur         1.1      PEGASUS_NAMESPACE_END

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2