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

   1 martin 1.149 //%LICENSE////////////////////////////////////////////////////////////////
   2 martin 1.150 //
   3 martin 1.149 // 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.150 //
  10 martin 1.149 // 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.150 //
  17 martin 1.149 // The above copyright notice and this permission notice shall be included
  18              // in all copies or substantial portions of the Software.
  19 martin 1.150 //
  20 martin 1.149 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  21 martin 1.150 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  22 martin 1.149 // 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.150 //
  28 martin 1.149 //////////////////////////////////////////////////////////////////////////
  29 marek  1.63  //
  30              //%/////////////////////////////////////////////////////////////////////////////
  31              
  32              #include "CMPI_Version.h"
  33              
  34              #include "CMPIProviderManager.h"
  35              
  36              #include "CMPI_Object.h"
  37              #include "CMPI_Instance.h"
  38              #include "CMPI_ObjectPath.h"
  39              #include "CMPI_Result.h"
  40              #include "CMPI_SelectExp.h"
  41              
  42              #include <Pegasus/Common/CIMMessage.h>
  43              #include <Pegasus/Common/OperationContext.h>
  44 a.dunfey 1.85  #include <Pegasus/Common/OperationContextInternal.h>
  45 marek    1.63  #include <Pegasus/Common/Tracer.h>
  46                #include <Pegasus/Common/StatisticalData.h>
  47                #include <Pegasus/Common/Logger.h>
  48 kumpf    1.79  #include <Pegasus/Common/LanguageParser.h>
  49 marek    1.63  #include <Pegasus/Common/MessageLoader.h> //l10n
  50                #include <Pegasus/Common/Constants.h>
  51 thilo.boehm 1.89  #include <Pegasus/Common/FileSystem.h>
  52 marek       1.63  
  53                   #include <Pegasus/Config/ConfigManager.h>
  54                   
  55                   #include <Pegasus/Provider/CIMOMHandleQueryContext.h>
  56 a.dunfey    1.85  #include <Pegasus/ProviderManager2/CIMOMHandleContext.h>
  57 marek       1.63  #include <Pegasus/ProviderManager2/ProviderName.h>
  58 kumpf       1.93  #include <Pegasus/ProviderManager2/AutoPThreadSecurity.h>
  59 marek       1.63  #include <Pegasus/ProviderManager2/CMPI/CMPIProviderModule.h>
  60                   #include <Pegasus/ProviderManager2/CMPI/CMPIProvider.h>
  61 venkat.puvvada 1.145 #include <Pegasus/Query/QueryExpression/QueryExpression.h>
  62                      #include <Pegasus/Query/QueryCommon/QueryException.h>
  63 marek          1.63  
  64 kumpf          1.93  PEGASUS_USING_STD;
  65 marek          1.63  
  66                      PEGASUS_NAMESPACE_BEGIN
  67                      
  68 dave.sudlik    1.96  
  69 marek          1.95  ReadWriteSem    CMPIProviderManager::rwSemProvTab;
  70                      ReadWriteSem    CMPIProviderManager::rwSemSelxTab;
  71 marek          1.63  CMPIProviderManager::IndProvTab    CMPIProviderManager::provTab;
  72                      CMPIProviderManager::IndSelectTab  CMPIProviderManager::selxTab;
  73 marek          1.95  
  74 venkat.puvvada 1.108 class CMPIPropertyList
  75                      {
  76                          char **props;
  77                          int pCount;
  78                      public:
  79                          CMPIPropertyList(CIMPropertyList &propertyList) : props(0), pCount(0)
  80                          {
  81 ms.aruran      1.115         PEG_METHOD_ENTER(
  82                                  TRC_PROVIDERMANAGER,
  83                                  "CMPIPropertyList::CMPIPropertyList()");
  84 venkat.puvvada 1.108         if (!propertyList.isNull())
  85                              {
  86                                  Array<CIMName> p=propertyList.getPropertyNameArray();
  87                                  pCount=p.size();
  88                                  props = new char*[1+pCount];
  89                                  for (int i=0; i<pCount; i++)
  90                                  {
  91                                      props[i]=strdup(p[i].getString().getCString());
  92                                  }
  93                                  props[pCount]=NULL;
  94                              }
  95                              else props=NULL;
  96 ms.aruran      1.115         PEG_METHOD_EXIT();
  97 venkat.puvvada 1.108     }
  98                          ~CMPIPropertyList()
  99                          {
 100 ms.aruran      1.115         PEG_METHOD_ENTER(
 101                                  TRC_PROVIDERMANAGER,
 102                                  "CMPIPropertyList::~CMPIPropertyList()");
 103 venkat.puvvada 1.108         if (props)
 104                              {
 105                                  for (int i=0; i<pCount; i++)
 106                                      free(props[i]);
 107                                  delete [] props;
 108                              }
 109 ms.aruran      1.115         PEG_METHOD_EXIT();
 110 venkat.puvvada 1.108     }
 111                          char  **getList()
 112                          {
 113                              return props;
 114                          }
 115 marek          1.63  };
 116                      
 117 marek          1.127 CMPIProviderManager::CMPIProviderManager()
 118 marek          1.63  {
 119 ms.aruran      1.115     PEG_METHOD_ENTER(
 120                              TRC_PROVIDERMANAGER,
 121                              "CMPIProviderManager::CMPIProviderManager()");
 122                      
 123 venkat.puvvada 1.108     _subscriptionInitComplete = false;
 124 ms.aruran      1.115     PEG_TRACE_CSTRING (
 125                              TRC_PROVIDERMANAGER,
 126                              Tracer::LEVEL2,
 127                              "-- CMPI Provider Manager activated");
 128                          PEG_METHOD_EXIT();
 129 marek          1.63  }
 130                      
 131 venkat.puvvada 1.108 CMPIProviderManager::~CMPIProviderManager()
 132 marek          1.63  {
 133 ms.aruran      1.115     PEG_METHOD_ENTER(
 134                              TRC_PROVIDERMANAGER,
 135                              "CMPIProviderManager::~CMPIProviderManager()");
 136 venkat.puvvada 1.108     /* Clean up the hash-tables */
 137 marek          1.63      indProvRecord *prec=NULL;
 138 marek          1.95      {
 139                              WriteLock writeLock(rwSemProvTab);
 140 venkat.puvvada 1.108         for (IndProvTab::Iterator i = provTab.start(); i; i++)
 141                              {
 142                                  provTab.lookup(i.key(),prec);
 143                                  if (prec->handler)
 144                                      delete prec->handler;
 145                                  delete prec;
 146 kumpf          1.151             //Remove is not neccessary, since the hashtable destructor takes
 147                                  //care of this already. But instead removing entries while
 148 venkat.puvvada 1.108             //iterating the hashtable sometimes causes a segmentation fault!!!
 149                                  //provTab.remove(i.key());
 150                                  prec=NULL;
 151                              }
 152 marek          1.95      }
 153                      
 154 venkat.puvvada 1.108     indSelectRecord *selx=NULL;
 155 marek          1.95      {
 156                              WriteLock writeLock(rwSemSelxTab);
 157 venkat.puvvada 1.108         for (IndSelectTab::Iterator i = selxTab.start(); i; i++)
 158                              {
 159                                  selxTab.lookup(i.key(), selx);
 160                                  if (selx->eSelx)
 161                                      delete selx->eSelx;
 162                                  if (selx->qContext)
 163                                      delete selx->qContext;
 164                                  delete selx;
 165                                  //Same as above!
 166                                  //selxTab.remove(i.key());
 167                                  selx=NULL;
 168                              }
 169 marek          1.95      }
 170 ms.aruran      1.115     PEG_METHOD_EXIT();
 171 marek          1.63  }
 172                      
 173                      Message * CMPIProviderManager::processMessage(Message * request)
 174                      {
 175 ms.aruran      1.115     PEG_METHOD_ENTER(
 176                              TRC_PROVIDERMANAGER,
 177 marek          1.63          "CMPIProviderManager::processMessage()");
 178                      
 179                          Message * response = 0;
 180                      
 181                          // pass the request message to a handler method based on message type
 182 venkat.puvvada 1.108     switch (request->getType())
 183 marek          1.63      {
 184 venkat.puvvada 1.108         case CIM_GET_INSTANCE_REQUEST_MESSAGE:
 185                                  response = handleGetInstanceRequest(request);
 186 marek          1.63  
 187 venkat.puvvada 1.108             break;
 188                              case CIM_ENUMERATE_INSTANCES_REQUEST_MESSAGE:
 189                                  response = handleEnumerateInstancesRequest(request);
 190                      
 191                                  break;
 192                              case CIM_ENUMERATE_INSTANCE_NAMES_REQUEST_MESSAGE:
 193                                  response = handleEnumerateInstanceNamesRequest(request);
 194                      
 195                                  break;
 196                              case CIM_CREATE_INSTANCE_REQUEST_MESSAGE:
 197                                  response = handleCreateInstanceRequest(request);
 198                      
 199                                  break;
 200                              case CIM_MODIFY_INSTANCE_REQUEST_MESSAGE:
 201                                  response = handleModifyInstanceRequest(request);
 202                      
 203                                  break;
 204                              case CIM_DELETE_INSTANCE_REQUEST_MESSAGE:
 205                                  response = handleDeleteInstanceRequest(request);
 206                      
 207                                  break;
 208 venkat.puvvada 1.108         case CIM_EXEC_QUERY_REQUEST_MESSAGE:
 209                                  response = handleExecQueryRequest(request);
 210                      
 211                                  break;
 212                              case CIM_ASSOCIATORS_REQUEST_MESSAGE:
 213                                  response = handleAssociatorsRequest(request);
 214                      
 215                                  break;
 216                              case CIM_ASSOCIATOR_NAMES_REQUEST_MESSAGE:
 217                                  response = handleAssociatorNamesRequest(request);
 218                      
 219                                  break;
 220                              case CIM_REFERENCES_REQUEST_MESSAGE:
 221                                  response = handleReferencesRequest(request);
 222                      
 223                                  break;
 224                              case CIM_REFERENCE_NAMES_REQUEST_MESSAGE:
 225                                  response = handleReferenceNamesRequest(request);
 226                      
 227                                  break;
 228                              case CIM_INVOKE_METHOD_REQUEST_MESSAGE:
 229 venkat.puvvada 1.108             response = handleInvokeMethodRequest(request);
 230                      
 231                                  break;
 232                              case CIM_CREATE_SUBSCRIPTION_REQUEST_MESSAGE:
 233                                  response = handleCreateSubscriptionRequest(request);
 234 marek          1.63  
 235 venkat.puvvada 1.108             break;
 236 marek          1.63  /*    case CIM_MODIFY_SUBSCRIPTION_REQUEST_MESSAGE:
 237                              response = handleModifySubscriptionRequest(request);
 238                      
 239                              break;
 240 venkat.puvvada 1.108 */
 241                              case CIM_DELETE_SUBSCRIPTION_REQUEST_MESSAGE:
 242                                  response = handleDeleteSubscriptionRequest(request);
 243 marek          1.63  
 244 venkat.puvvada 1.108             break;
 245 marek          1.63  /*    case CIM_EXPORT_INDICATION_REQUEST_MESSAGE:
 246                              response = handleExportIndicationRequest(request);
 247                              break;
 248                      */
 249 venkat.puvvada 1.108         case CIM_DISABLE_MODULE_REQUEST_MESSAGE:
 250                                  response = handleDisableModuleRequest(request);
 251 marek          1.63  
 252 venkat.puvvada 1.108             break;
 253                              case CIM_ENABLE_MODULE_REQUEST_MESSAGE:
 254                                  response = handleEnableModuleRequest(request);
 255                      
 256                                  break;
 257                              case CIM_STOP_ALL_PROVIDERS_REQUEST_MESSAGE:
 258                                  response = handleStopAllProvidersRequest(request);
 259                      
 260                                  break;
 261                              case CIM_SUBSCRIPTION_INIT_COMPLETE_REQUEST_MESSAGE:
 262                                  response = handleSubscriptionInitCompleteRequest (request);
 263                      
 264                                  break;
 265                              case CIM_GET_PROPERTY_REQUEST_MESSAGE:
 266                                  response = handleGetPropertyRequest(request);
 267                      
 268                                  break;
 269                              case CIM_SET_PROPERTY_REQUEST_MESSAGE:
 270                                  response = handleSetPropertyRequest(request);
 271                      
 272                                  break;
 273 venkat.puvvada 1.108         default:
 274                                  response = handleUnsupportedRequest(request);
 275 marek          1.63  
 276 venkat.puvvada 1.108             break;
 277 marek          1.63      }
 278                      
 279                          PEG_METHOD_EXIT();
 280                      
 281                          return(response);
 282                      }
 283                      
 284                      Boolean CMPIProviderManager::hasActiveProviders()
 285                      {
 286 venkat.puvvada 1.108     return providerManager.hasActiveProviders();
 287 marek          1.63  }
 288                      
 289                      void CMPIProviderManager::unloadIdleProviders()
 290                      {
 291 venkat.puvvada 1.108     providerManager.unloadIdleProviders();
 292 marek          1.63  }
 293                      
 294                      
 295                      #define CHARS(cstring) (char*)(strlen(cstring)?(const char*)cstring:NULL)
 296                      
 297                      
 298 kumpf          1.92  #define HandlerIntroBase(type,type1,message,request,response,handler) \
 299 marek          1.63      CIM##type##RequestMessage * request = \
 300 venkat.puvvada 1.108         dynamic_cast<CIM##type##RequestMessage *>(const_cast<Message *> \
 301                              (message)); \
 302 marek          1.63      PEGASUS_ASSERT(request != 0); \
 303                          CIM##type##ResponseMessage * response = \
 304 kumpf          1.92          dynamic_cast<CIM##type##ResponseMessage*>(request->buildResponse()); \
 305 marek          1.63      PEGASUS_ASSERT(response != 0); \
 306 kumpf          1.84      type1##ResponseHandler handler(request, response, _responseChunkCallback);
 307 marek          1.63  
 308                      #define HandlerIntroInd(type,message,request,response,handler) \
 309 kumpf          1.92       HandlerIntroBase(type,Operation,message,request,response,handler)
 310 marek          1.63  
 311                      #define HandlerIntroInit(type,message,request,response,handler) \
 312 kumpf          1.92       HandlerIntroBase(type,Operation,message,request,response,handler)
 313 marek          1.63  
 314 kumpf          1.92  #define HandlerIntro(type,message,request,response,handler) \
 315                           HandlerIntroBase(type,type,message,request,response,handler)
 316 marek          1.63  
 317                      #define HandlerCatch(handler) \
 318 konrad.r       1.64      catch(const CIMException & e)  \
 319 thilo.boehm    1.138     { PEG_TRACE((TRC_PROVIDERMANAGER, Tracer::LEVEL1, \
 320                                "CIMException: %s",(const char*)e.getMessage().getCString())); \
 321 dave.sudlik    1.103         handler.setCIMException(e); \
 322 marek          1.63      } \
 323 konrad.r       1.64      catch(const Exception & e) \
 324 thilo.boehm    1.138     { PEG_TRACE((TRC_PROVIDERMANAGER, Tracer::LEVEL1, \
 325                                "Exception: %s",(const char*)e.getMessage().getCString())); \
 326 venkat.puvvada 1.108         handler.setStatus(CIM_ERR_FAILED, e.getContentLanguages(), \
 327                              e.getMessage()); \
 328 marek          1.63      } \
 329                          catch(...) \
 330 marek          1.131     { PEG_TRACE_CSTRING(TRC_PROVIDERMANAGER, Tracer::LEVEL1, \
 331 marek          1.63                  "Exception: Unknown"); \
 332                              handler.setStatus(CIM_ERR_FAILED, "Unknown error."); \
 333                          }
 334                      
 335 marek          1.124 void CMPIProviderManager::_setupCMPIContexts(
 336                          CMPI_ContextOnStack * eCtx,
 337                          OperationContext * context,
 338                          ProviderIdContainer * pidc,
 339                          const String &nameSpace,
 340                          Boolean remote,
 341                          Boolean includeQualifiers,
 342                          Boolean includeClassOrigin,
 343                          Boolean setFlags)
 344                      {
 345                          if (setFlags)
 346                          {
 347                              // set CMPI invocation flags
 348 kumpf          1.125         CMPIValue value;
 349                              value.uint32 = 0;
 350                              if (includeQualifiers) value.uint32 |= CMPI_FLAG_IncludeQualifiers;
 351                              if (includeClassOrigin) value.uint32 |= CMPI_FLAG_IncludeClassOrigin;
 352 marek          1.124         eCtx->ft->addEntry(
 353                                  eCtx,
 354                                  CMPIInvocationFlags,
 355 kumpf          1.125             &value,
 356 marek          1.124             CMPI_uint32);
 357                          }
 358                      
 359                          // add identity context
 360                          const IdentityContainer container =
 361                          context->get(IdentityContainer::NAME);
 362                          eCtx->ft->addEntry(
 363                              eCtx,
 364                              CMPIPrincipal,
 365                              (CMPIValue*)(const char*)container.getUserName().getCString(),
 366                              CMPI_chars);
 367                      
 368                          // add AcceptLanguages to CMPI context
 369 kumpf          1.151     const AcceptLanguageListContainer accept_language=
 370                          context->get(AcceptLanguageListContainer::NAME);
 371 marek          1.124     const AcceptLanguageList acceptLangs = accept_language.getLanguages();
 372                      
 373                          eCtx->ft->addEntry(
 374                              eCtx,
 375                              CMPIAcceptLanguage,
 376                              (CMPIValue*)(const char*)
 377                                  LanguageParser::buildAcceptLanguageHeader(acceptLangs).getCString(),
 378                              CMPI_chars);
 379                      
 380                          // add initial namespace to context
 381                          eCtx->ft->addEntry(
 382                          eCtx,
 383                          CMPIInitNameSpace,
 384                          (CMPIValue*)(const char*)nameSpace.getCString(),
 385                          CMPI_chars);
 386                      
 387                          // add remote info to context
 388                          if (remote)
 389                          {
 390                              CString info=pidc->getRemoteInfo().getCString();
 391                              eCtx->ft->addEntry(
 392 marek          1.124             eCtx,
 393                                  "CMPIRRemoteInfo",(CMPIValue*)(const char*)info,
 394                                  CMPI_chars);
 395                          }
 396                      }
 397                      
 398 venkat.puvvada 1.108 Message * CMPIProviderManager::handleGetInstanceRequest(
 399                          const Message * message)
 400 marek          1.63  {
 401 ms.aruran      1.115     PEG_METHOD_ENTER(
 402                              TRC_PROVIDERMANAGER,
 403                              "CMPIProviderManager::handleGetInstanceRequest()");
 404 marek          1.63  
 405 kumpf          1.92      HandlerIntro(GetInstance,message,request,response,handler);
 406 marek          1.63  
 407 venkat.puvvada 1.108     try
 408                          {
 409 thilo.boehm    1.138         PEG_TRACE((TRC_PROVIDERMANAGER,Tracer::LEVEL3,
 410 marek          1.129             "CMPIProviderManager::handleGetInstanceRequest - Host name:"
 411                                  " %s  Name space: %s  Class name: %s",
 412                                  (const char*) System::getHostName().getCString(),
 413                                  (const char*) request->nameSpace.getString().getCString(),
 414                                  (const char*)
 415                                      request->instanceName.getClassName().getString().getCString()));
 416 kumpf          1.151 
 417 marek          1.63          // make target object path
 418                              CIMObjectPath objectPath(
 419                                  System::getHostName(),
 420                                  request->nameSpace,
 421                                  request->instanceName.getClassName(),
 422                                  request->instanceName.getKeyBindings());
 423                      
 424                              Boolean remote=false;
 425 venkat.puvvada 1.132         OpProviderHolder ph;
 426 marek          1.63  
 427                              // resolve provider name
 428 kumpf          1.151         ProviderIdContainer pidc =
 429 venkat.puvvada 1.108             request->operationContext.get(ProviderIdContainer::NAME);
 430                      
 431 marek          1.63          ProviderName name = _resolveProviderName(pidc);
 432                      
 433 venkat.puvvada 1.108         if ((remote=pidc.isRemoteNameSpace()))
 434                              {
 435                                  ph = providerManager.getRemoteProvider(
 436                                      name.getLocation(), name.getLogicalName());
 437 a.dunfey       1.85          }
 438 venkat.puvvada 1.108         else
 439                              {
 440 a.dunfey       1.85              // get cached or load new provider module
 441 venkat.puvvada 1.108             ph = providerManager.getProvider(
 442                                      name.getPhysicalName(), name.getLogicalName());
 443 marek          1.63          }
 444                      
 445                              // convert arguments
 446                              OperationContext context;
 447                      
 448                              context.insert(request->operationContext.get(IdentityContainer::NAME));
 449 venkat.puvvada 1.108         context.insert(
 450                                  request->operationContext.get(AcceptLanguageListContainer::NAME));
 451                              context.insert(
 452                                  request->operationContext.get(ContentLanguageListContainer::NAME));
 453 marek          1.63          // forward request
 454                              CMPIProvider & pr=ph.GetProvider();
 455                      
 456                              CMPIStatus rc={CMPI_RC_OK,NULL};
 457                              CMPI_ContextOnStack eCtx(context);
 458                              CMPI_ObjectPathOnStack eRef(objectPath);
 459 venkat.puvvada 1.132         CMPI_ResultOnStack eRes(handler,pr.getBroker());
 460                              CMPI_ThreadContext thr(pr.getBroker(),&eCtx);
 461 marek          1.63  
 462                              CMPIPropertyList props(request->propertyList);
 463 kumpf          1.151 
 464 marek          1.124         _setupCMPIContexts(
 465 venkat.puvvada 1.108             &eCtx,
 466 marek          1.124             &context,
 467                                  &pidc,
 468                                  request->nameSpace.getString(),
 469                                  remote,
 470                                  request->includeQualifiers,
 471                                  request->includeClassOrigin,
 472                                  true);
 473 marek          1.63  
 474                              CMPIProvider::pm_service_op_lock op_lock(&pr);
 475                      
 476 thilo.boehm    1.143         PEG_TRACE((
 477                                  TRC_PROVIDERMANAGER,
 478                                  Tracer::LEVEL2,
 479                                  "Calling provider.getInstance: %s",
 480                                  (const char*)pr.getName().getCString()));
 481                      
 482 kumpf          1.92          {
 483 thilo.boehm    1.144             AutoPThreadSecurity threadLevelSecurity(request->operationContext);
 484                      
 485 kumpf          1.92              StatProviderTimeMeasurement providerTime(response);
 486 marek          1.63  
 487 venkat.puvvada 1.132             rc = pr.getInstMI()->ft->getInstance(
 488                                      pr.getInstMI(),
 489 venkat.puvvada 1.108                 &eCtx,
 490                                      &eRes,
 491                                      &eRef,
 492 kumpf          1.92                  (const char **)props.getList());
 493                              }
 494 marek          1.63  
 495 thilo.boehm    1.143         PEG_TRACE((
 496                                  TRC_PROVIDERMANAGER,
 497                                  Tracer::LEVEL2,
 498                                  "Returning from provider.getInstance: %s",
 499                                  (const char*)pr.getName().getCString()));
 500                      
 501 dave.sudlik    1.99  //      Need to save ContentLanguage value into operation context of response
 502 kumpf          1.151 //      Do this before checking rc from provider to throw exception in case
 503 dave.sudlik    1.99  //      rc.msg is also localized.
 504                              CMPIStatus tmprc={CMPI_RC_OK,NULL};
 505 kumpf          1.151         CMPIData cldata =
 506 venkat.puvvada 1.108             eCtx.ft->getEntry (&eCtx, CMPIContentLanguage, &tmprc);
 507 dave.sudlik    1.99          if (tmprc.rc == CMPI_RC_OK)
 508                              {
 509                                  response->operationContext.set(
 510                                      ContentLanguageListContainer(
 511 venkat.puvvada 1.108                 ContentLanguageList(
 512                                      LanguageParser::parseContentLanguageHeader(
 513 s.kodali       1.137                 CMGetCharsPtr(cldata.value.string, NULL)))));
 514 dave.sudlik    1.103             handler.setContext(response->operationContext);
 515 dave.sudlik    1.99          }
 516                      
 517 marek          1.63          if (rc.rc!=CMPI_RC_OK)
 518 dave.sudlik    1.102         {
 519 venkat.puvvada 1.108             CIMException cimException(
 520                                      (CIMStatusCode)rc.rc,
 521 s.kodali       1.137                 rc.msg ? CMGetCharsPtr(rc.msg, NULL) : String::EMPTY);
 522 venkat.puvvada 1.108 
 523                                  if (eRes.resError)
 524                                  {
 525 kumpf          1.151                 for (CMPI_Error* currErr=eRes.resError;
 526                                          currErr!=NULL;
 527 dave.sudlik    1.102                     currErr=currErr->nextError)
 528 venkat.puvvada 1.108                 {
 529                                          cimException.addError(
 530                                              ((CIMError*)currErr->hdl)->getInstance());
 531                                      }
 532                                  }
 533                                  throw cimException;
 534 dave.sudlik    1.102         }
 535 marek          1.63      }
 536                          HandlerCatch(handler);
 537                      
 538                          PEG_METHOD_EXIT();
 539                      
 540                          return(response);
 541                      }
 542                      
 543 venkat.puvvada 1.108 Message * CMPIProviderManager::handleEnumerateInstancesRequest(
 544                          const Message * message)
 545 marek          1.63  {
 546 ms.aruran      1.115     PEG_METHOD_ENTER(
 547                              TRC_PROVIDERMANAGER,
 548                              "CMPIProviderManager::handleEnumerateInstanceRequest()");
 549 marek          1.63  
 550 kumpf          1.92      HandlerIntro(EnumerateInstances,message,request,response,handler);
 551 venkat.puvvada 1.108     try
 552                          {
 553 thilo.boehm    1.138         PEG_TRACE((TRC_PROVIDERMANAGER,Tracer::LEVEL3,
 554 venkat.puvvada 1.108             "CMPIProviderManager::handleEnumerateInstancesRequest - Host name:"
 555 marek          1.129             " %s  Name space: %s  Class name: %s",
 556                                  (const char*) System::getHostName().getCString(),
 557                                  (const char*) request->nameSpace.getString().getCString(),
 558                                  (const char*) request->className.getString().getCString()));
 559 marek          1.63  
 560                              // make target object path
 561                              CIMObjectPath objectPath(
 562                                  System::getHostName(),
 563                                  request->nameSpace,
 564                                  request->className);
 565                      
 566                              Boolean remote=false;
 567 venkat.puvvada 1.132         OpProviderHolder ph;
 568 marek          1.63  
 569                              // resolve provider name
 570 kumpf          1.151         ProviderIdContainer pidc =
 571 venkat.puvvada 1.108             request->operationContext.get(ProviderIdContainer::NAME);
 572 marek          1.63          ProviderName name = _resolveProviderName(pidc);
 573                      
 574 venkat.puvvada 1.108         if ((remote=pidc.isRemoteNameSpace()))
 575                              {
 576                                  ph = providerManager.getRemoteProvider(
 577                                      name.getLocation(), name.getLogicalName());
 578                              }
 579                              else
 580                              {
 581                                  // get cached or load new provider module
 582                                  ph = providerManager.getProvider(
 583                                      name.getPhysicalName(), name.getLogicalName());
 584 marek          1.63          }
 585                      
 586                              // convert arguments
 587                              OperationContext context;
 588                      
 589                              context.insert(request->operationContext.get(IdentityContainer::NAME));
 590 venkat.puvvada 1.108         context.insert(
 591                                  request->operationContext.get(AcceptLanguageListContainer::NAME));
 592                              context.insert(
 593                                  request->operationContext.get(ContentLanguageListContainer::NAME));
 594 marek          1.63  
 595                              CIMPropertyList propertyList(request->propertyList);
 596                      
 597                              // forward request
 598                              CMPIProvider & pr=ph.GetProvider();
 599                      
 600                              CMPIStatus rc={CMPI_RC_OK,NULL};
 601                              CMPI_ContextOnStack eCtx(context);
 602                              CMPI_ObjectPathOnStack eRef(objectPath);
 603 venkat.puvvada 1.132         CMPI_ResultOnStack eRes(handler,pr.getBroker());
 604                              CMPI_ThreadContext thr(pr.getBroker(),&eCtx);
 605 marek          1.63  
 606                              CMPIPropertyList props(propertyList);
 607                      
 608 marek          1.124         _setupCMPIContexts(
 609 venkat.puvvada 1.108             &eCtx,
 610 marek          1.124             &context,
 611                                  &pidc,
 612                                  request->nameSpace.getString(),
 613                                  remote,
 614                                  request->includeQualifiers,
 615                                  request->includeClassOrigin,
 616                                  true);
 617 marek          1.63  
 618                              CMPIProvider::pm_service_op_lock op_lock(&pr);
 619                      
 620 thilo.boehm    1.143         PEG_TRACE((
 621                                  TRC_PROVIDERMANAGER,
 622                                  Tracer::LEVEL2,
 623                                  "Calling provider.enumerateInstances: %s",
 624                                   (const char*)pr.getName().getCString()));
 625                      
 626 kumpf          1.92          {
 627 thilo.boehm    1.144             AutoPThreadSecurity threadLevelSecurity(request->operationContext);
 628                      
 629 kumpf          1.92              StatProviderTimeMeasurement providerTime(response);
 630 marek          1.63  
 631 venkat.puvvada 1.132             rc = pr.getInstMI()->ft->enumerateInstances(
 632                                      pr.getInstMI(),
 633 venkat.puvvada 1.108                 &eCtx,
 634                                      &eRes,
 635                                      &eRef,
 636 kumpf          1.92                  (const char **)props.getList());
 637                              }
 638 marek          1.63  
 639 thilo.boehm    1.143         PEG_TRACE((
 640                                  TRC_PROVIDERMANAGER,
 641                                  Tracer::LEVEL2,
 642                                  "Returning from provider.enumerateInstances: %s",
 643                                   (const char*)pr.getName().getCString()));
 644                      
 645 dave.sudlik    1.99  //      Need to save ContentLanguage value into operation context of response
 646 kumpf          1.151 //      Do this before checking rc from provider to throw exception in case
 647 dave.sudlik    1.99  //      rc.msg is also localized.
 648                              CMPIStatus tmprc={CMPI_RC_OK,NULL};
 649 kumpf          1.151         CMPIData cldata =
 650 venkat.puvvada 1.108             eCtx.ft->getEntry(&eCtx, CMPIContentLanguage, &tmprc);
 651 dave.sudlik    1.99          if (tmprc.rc == CMPI_RC_OK)
 652                              {
 653                                  response->operationContext.set(
 654                                      ContentLanguageListContainer(
 655 venkat.puvvada 1.108                 ContentLanguageList(
 656                                      LanguageParser::parseContentLanguageHeader(
 657 s.kodali       1.137                 CMGetCharsPtr(cldata.value.string, NULL)))));
 658 dave.sudlik    1.103             handler.setContext(response->operationContext);
 659 dave.sudlik    1.99          }
 660                      
 661 marek          1.63          if (rc.rc!=CMPI_RC_OK)
 662 dave.sudlik    1.102         {
 663 venkat.puvvada 1.108             CIMException cimException(
 664                                      (CIMStatusCode)rc.rc,
 665 s.kodali       1.137                 rc.msg ? CMGetCharsPtr(rc.msg, NULL) : String::EMPTY);
 666 venkat.puvvada 1.108 
 667                                  if (eRes.resError)
 668                                  {
 669 kumpf          1.151                 for (CMPI_Error* currErr=eRes.resError;
 670                                          currErr!=NULL;
 671 dave.sudlik    1.102                     currErr=currErr->nextError)
 672 venkat.puvvada 1.108                 {
 673                                          cimException.addError(
 674                                              ((CIMError*)currErr->hdl)->getInstance());
 675                                      }
 676                                  }
 677                                  throw cimException;
 678 dave.sudlik    1.102         }
 679                      
 680 marek          1.63      }
 681                          HandlerCatch(handler);
 682                      
 683                          PEG_METHOD_EXIT();
 684                      
 685                          return(response);
 686                      }
 687                      
 688 venkat.puvvada 1.108 Message * CMPIProviderManager::handleEnumerateInstanceNamesRequest(
 689                          const Message * message)
 690 marek          1.63  {
 691 ms.aruran      1.115     PEG_METHOD_ENTER(
 692                              TRC_PROVIDERMANAGER,
 693                              "CMPIProviderManager::handleEnumerateInstanceNamesRequest()");
 694 marek          1.63  
 695 kumpf          1.92      HandlerIntro(EnumerateInstanceNames,message,request,response,handler);
 696 venkat.puvvada 1.108     try
 697                          {
 698 thilo.boehm    1.138         PEG_TRACE((TRC_PROVIDERMANAGER,Tracer::LEVEL3,
 699 marek          1.129             "CMPIProviderManager::handleEnumerateInstanceNamesRequest"
 700                                  " - Host name: %s  Name space: %s  Class name: %s",
 701                                  (const char*) System::getHostName().getCString(),
 702                                  (const char*) request->nameSpace.getString().getCString(),
 703                                  (const char*) request->className.getString().getCString()));
 704 marek          1.63  
 705 venkat.puvvada 1.108         // make target object path
 706 marek          1.63          CIMObjectPath objectPath(
 707                                  System::getHostName(),
 708                                  request->nameSpace,
 709                                  request->className);
 710                      
 711                              Boolean remote=false;
 712 venkat.puvvada 1.132         OpProviderHolder ph;
 713 marek          1.63  
 714                              // resolve provider name
 715 kumpf          1.151         ProviderIdContainer pidc =
 716 venkat.puvvada 1.108             request->operationContext.get(ProviderIdContainer::NAME);
 717 marek          1.63          ProviderName name = _resolveProviderName(pidc);
 718                      
 719 venkat.puvvada 1.108         if ((remote=pidc.isRemoteNameSpace()))
 720                              {
 721                                  ph = providerManager.getRemoteProvider(
 722                                      name.getLocation(), name.getLogicalName());
 723 marek          1.63          }
 724 venkat.puvvada 1.108         else
 725                              {
 726                                  // get cached or load new provider module
 727                                  ph = providerManager.getProvider(
 728                                      name.getPhysicalName(), name.getLogicalName());
 729 marek          1.63          }
 730                      
 731                              // convert arguments
 732                              OperationContext context;
 733                      
 734                              context.insert(request->operationContext.get(IdentityContainer::NAME));
 735 venkat.puvvada 1.108         context.insert(
 736                                  request->operationContext.get(AcceptLanguageListContainer::NAME));
 737                              context.insert(
 738                                  request->operationContext.get(ContentLanguageListContainer::NAME));
 739 marek          1.63          CMPIProvider & pr=ph.GetProvider();
 740                      
 741                              CMPIStatus rc={CMPI_RC_OK,NULL};
 742                              CMPI_ContextOnStack eCtx(context);
 743                              CMPI_ObjectPathOnStack eRef(objectPath);
 744 venkat.puvvada 1.132         CMPI_ResultOnStack eRes(handler,pr.getBroker());
 745                              CMPI_ThreadContext thr(pr.getBroker(),&eCtx);
 746 marek          1.63  
 747 marek          1.124         _setupCMPIContexts(
 748 venkat.puvvada 1.108             &eCtx,
 749 marek          1.124             &context,
 750                                  &pidc,
 751                                  request->nameSpace.getString(),
 752                                  remote,
 753                                  false,
 754                                  false,
 755                                  true);
 756 marek          1.63  
 757                              CMPIProvider::pm_service_op_lock op_lock(&pr);
 758                      
 759 thilo.boehm    1.143         PEG_TRACE((
 760                                  TRC_PROVIDERMANAGER,
 761                                  Tracer::LEVEL2,
 762                                  "Calling provider.enumerateInstanceNames: %s",
 763                                  (const char*)pr.getName().getCString()));
 764                      
 765 kumpf          1.92          {
 766 thilo.boehm    1.144             AutoPThreadSecurity threadLevelSecurity(request->operationContext);
 767                      
 768 kumpf          1.92              StatProviderTimeMeasurement providerTime(response);
 769 marek          1.63  
 770 venkat.puvvada 1.132             rc = pr.getInstMI()->ft->enumerateInstanceNames(
 771                                      pr.getInstMI(),
 772                                      &eCtx,
 773                                      &eRes,
 774                                      &eRef);
 775 kumpf          1.92          }
 776 marek          1.63  
 777 thilo.boehm    1.143         PEG_TRACE((
 778                                  TRC_PROVIDERMANAGER,
 779                                  Tracer::LEVEL2,
 780                                  "Returning from provider.enumerateInstanceNames: %s",
 781                                  (const char*)pr.getName().getCString()));
 782                      
 783 dave.sudlik    1.99  //      Need to save ContentLanguage value into operation context of response
 784 kumpf          1.151 //      Do this before checking rc from provider to throw exception in case
 785 dave.sudlik    1.99  //      rc.msg is also localized.
 786                              CMPIStatus tmprc={CMPI_RC_OK,NULL};
 787 kumpf          1.151         CMPIData cldata =
 788 venkat.puvvada 1.108             eCtx.ft->getEntry (&eCtx, CMPIContentLanguage, &tmprc);
 789 dave.sudlik    1.99          if (tmprc.rc == CMPI_RC_OK)
 790                              {
 791                                  response->operationContext.set(
 792                                      ContentLanguageListContainer(
 793 venkat.puvvada 1.108                 ContentLanguageList(
 794                                      LanguageParser::parseContentLanguageHeader(
 795 s.kodali       1.137                 CMGetCharsPtr(cldata.value.string, NULL)))));
 796 dave.sudlik    1.103             handler.setContext(response->operationContext);
 797 dave.sudlik    1.99          }
 798                      
 799 marek          1.63          if (rc.rc!=CMPI_RC_OK)
 800 dave.sudlik    1.102         {
 801 venkat.puvvada 1.108             CIMException cimException(
 802                                      (CIMStatusCode)rc.rc,
 803 s.kodali       1.137                 rc.msg ? CMGetCharsPtr(rc.msg, NULL) : String::EMPTY);
 804 venkat.puvvada 1.108 
 805                                  if (eRes.resError)
 806                                  {
 807 kumpf          1.151                 for (CMPI_Error* currErr=eRes.resError;
 808                                          currErr!=NULL;
 809 dave.sudlik    1.102                     currErr=currErr->nextError)
 810 venkat.puvvada 1.108                 {
 811                                          cimException.addError(
 812                                              ((CIMError*)currErr->hdl)->getInstance());
 813                                      }
 814                                  }
 815                                  throw cimException;
 816 dave.sudlik    1.102         }
 817 marek          1.63      }
 818                          HandlerCatch(handler);
 819                      
 820                          PEG_METHOD_EXIT();
 821                      
 822                          return(response);
 823                      }
 824                      
 825 venkat.puvvada 1.108 Message * CMPIProviderManager::handleCreateInstanceRequest(
 826                          const Message * message)
 827 marek          1.63  {
 828 ms.aruran      1.115     PEG_METHOD_ENTER(
 829                              TRC_PROVIDERMANAGER,
 830                              "CMPIProviderManager::handleCreateInstanceRequest()");
 831 marek          1.63  
 832 kumpf          1.92      HandlerIntro(CreateInstance,message,request,response,handler);
 833 venkat.puvvada 1.108     try
 834                          {
 835 thilo.boehm    1.138         PEG_TRACE((TRC_PROVIDERMANAGER,Tracer::LEVEL3,
 836 marek          1.129             "CMPIProviderManager::handleCreateInstanceRequest"
 837                                  " - Host name: %s  Name space: %s  Class name: %s",
 838                                  (const char*) System::getHostName().getCString(),
 839                                  (const char*) request->nameSpace.getString().getCString(),
 840                                  (const char*)
 841                                request->newInstance.getPath().getClassName().getString().getCString()
 842                              ));
 843 marek          1.63  
 844                              // make target object path
 845                              CIMObjectPath objectPath(
 846                                  System::getHostName(),
 847                                  request->nameSpace,
 848                                  request->newInstance.getPath().getClassName(),
 849                                  request->newInstance.getPath().getKeyBindings());
 850 venkat.puvvada 1.108         request->newInstance.setPath(objectPath);
 851 marek          1.63  
 852                              Boolean remote=false;
 853 venkat.puvvada 1.132         OpProviderHolder ph;
 854 marek          1.63  
 855                              // resolve provider name
 856 kumpf          1.151         ProviderIdContainer pidc =
 857 venkat.puvvada 1.108             request->operationContext.get(ProviderIdContainer::NAME);
 858 marek          1.63          ProviderName name = _resolveProviderName(pidc);
 859                      
 860 venkat.puvvada 1.108         if ((remote=pidc.isRemoteNameSpace()))
 861                              {
 862                                  ph = providerManager.getRemoteProvider(
 863                                      name.getLocation(), name.getLogicalName());
 864                              }
 865                              else
 866                              {
 867                                  // get cached or load new provider module
 868                                  ph = providerManager.getProvider(
 869                                      name.getPhysicalName(), name.getLogicalName());
 870 marek          1.63          }
 871                      
 872                              // convert arguments
 873                              OperationContext context;
 874                      
 875                              context.insert(request->operationContext.get(IdentityContainer::NAME));
 876 venkat.puvvada 1.108         context.insert(
 877                                  request->operationContext.get(AcceptLanguageListContainer::NAME));
 878                              context.insert(
 879                                  request->operationContext.get(ContentLanguageListContainer::NAME));
 880 marek          1.63          // forward request
 881                              CMPIProvider & pr=ph.GetProvider();
 882                      
 883                              CMPIStatus rc={CMPI_RC_OK,NULL};
 884                              CMPI_ContextOnStack eCtx(context);
 885                              CMPI_ObjectPathOnStack eRef(objectPath);
 886 venkat.puvvada 1.132         CMPI_ResultOnStack eRes(handler,pr.getBroker());
 887 marek          1.63          CMPI_InstanceOnStack eInst(request->newInstance);
 888 venkat.puvvada 1.132         CMPI_ThreadContext thr(pr.getBroker(),&eCtx);
 889 marek          1.63  
 890 marek          1.124         _setupCMPIContexts(
 891 venkat.puvvada 1.108             &eCtx,
 892 marek          1.124             &context,
 893                                  &pidc,
 894                                  request->nameSpace.getString(),
 895                                  remote,
 896                                  false,
 897                                  false,
 898                                  true);
 899 marek          1.63  
 900                              CMPIProvider::pm_service_op_lock op_lock(&pr);
 901                      
 902 thilo.boehm    1.143         PEG_TRACE((
 903                                  TRC_PROVIDERMANAGER,
 904                                  Tracer::LEVEL2,
 905                                  "Calling provider.createInstance: %s",
 906                                  (const char*)ph.GetProvider().getName().getCString()));
 907                      
 908 kumpf          1.92          {
 909 thilo.boehm    1.144             AutoPThreadSecurity threadLevelSecurity(request->operationContext);
 910                      
 911 kumpf          1.92              StatProviderTimeMeasurement providerTime(response);
 912 marek          1.63  
 913 venkat.puvvada 1.132             rc = pr.getInstMI()->ft->createInstance(
 914                                      pr.getInstMI(),
 915                                      &eCtx,
 916                                      &eRes,
 917                                      &eRef,
 918                                      &eInst);
 919 kumpf          1.92          }
 920 marek          1.63  
 921 thilo.boehm    1.143         PEG_TRACE((
 922                                  TRC_PROVIDERMANAGER,
 923                                  Tracer::LEVEL2,
 924                                  "Returning from provider.createInstance: %s",
 925                                  (const char*)ph.GetProvider().getName().getCString()));
 926                      
 927 dave.sudlik    1.99  //      Need to save ContentLanguage value into operation context of response
 928 kumpf          1.151 //      Do this before checking rc from provider to throw exception in case
 929 dave.sudlik    1.99  //      rc.msg is also localized.
 930                              CMPIStatus tmprc={CMPI_RC_OK,NULL};
 931 kumpf          1.151         CMPIData cldata =
 932 venkat.puvvada 1.108             eCtx.ft->getEntry (&eCtx, CMPIContentLanguage, &tmprc);
 933 dave.sudlik    1.99          if (tmprc.rc == CMPI_RC_OK)
 934                              {
 935                                  response->operationContext.set(
 936                                      ContentLanguageListContainer(
 937 venkat.puvvada 1.108                 ContentLanguageList(
 938                                      LanguageParser::parseContentLanguageHeader(
 939 s.kodali       1.137                 CMGetCharsPtr(cldata.value.string, NULL)))));
 940 dave.sudlik    1.103             handler.setContext(response->operationContext);
 941 dave.sudlik    1.99          }
 942                      
 943 marek          1.63          if (rc.rc!=CMPI_RC_OK)
 944 dave.sudlik    1.102         {
 945 venkat.puvvada 1.108             CIMException cimException(
 946                                      (CIMStatusCode)rc.rc,
 947 s.kodali       1.137                 rc.msg ? CMGetCharsPtr(rc.msg, NULL) : String::EMPTY);
 948 venkat.puvvada 1.108 
 949                                  if (eRes.resError)
 950                                  {
 951 kumpf          1.151                 for (CMPI_Error* currErr=eRes.resError;
 952                                          currErr!=NULL;
 953 dave.sudlik    1.102                     currErr=currErr->nextError)
 954 venkat.puvvada 1.108                 {
 955                                          cimException.addError(
 956                                              ((CIMError*)currErr->hdl)->getInstance());
 957                                      }
 958                                  }
 959                                  throw cimException;
 960 dave.sudlik    1.102         }
 961 marek          1.63      }
 962                          HandlerCatch(handler);
 963                      
 964                          PEG_METHOD_EXIT();
 965                      
 966                          return(response);
 967                      }
 968                      
 969 venkat.puvvada 1.108 Message * CMPIProviderManager::handleModifyInstanceRequest(
 970                          const Message * message)
 971 marek          1.63  {
 972 ms.aruran      1.115     PEG_METHOD_ENTER(
 973                              TRC_PROVIDERMANAGER,
 974                              "CMPIProviderManager::handleModifyInstanceRequest()");
 975 marek          1.63  
 976 kumpf          1.92      HandlerIntro(ModifyInstance,message,request,response,handler);
 977 venkat.puvvada 1.108     try
 978                          {
 979 thilo.boehm    1.138         PEG_TRACE((TRC_PROVIDERMANAGER,Tracer::LEVEL3,
 980 marek          1.129             "CMPIProviderManager::handleModifyInstanceRequest"
 981                                  " - Host name: %s  Name space: %s  Class name: %s",
 982                                  (const char*) System::getHostName().getCString(),
 983                                  (const char*) request->nameSpace.getString().getCString(),
 984                                  (const char*) request->modifiedInstance.\
 985                                      getPath().getClassName().getString().getCString()));
 986 marek          1.63  
 987                              // make target object path
 988                              CIMObjectPath objectPath(
 989                                  System::getHostName(),
 990                                  request->nameSpace,
 991                                  request->modifiedInstance.getPath ().getClassName(),
 992                                  request->modifiedInstance.getPath ().getKeyBindings());
 993                      
 994                              Boolean remote=false;
 995 venkat.puvvada 1.132         OpProviderHolder ph;
 996 marek          1.63  
 997                              // resolve provider name
 998 kumpf          1.151         ProviderIdContainer pidc =
 999 venkat.puvvada 1.108             request->operationContext.get(ProviderIdContainer::NAME);
1000 marek          1.63          ProviderName name = _resolveProviderName(pidc);
1001                      
1002 venkat.puvvada 1.108         if ((remote=pidc.isRemoteNameSpace()))
1003                              {
1004                                  ph = providerManager.getRemoteProvider(
1005                                      name.getLocation(), name.getLogicalName());
1006 marek          1.63          }
1007 venkat.puvvada 1.108         else
1008                              {
1009                                  // get cached or load new provider module
1010                                  ph = providerManager.getProvider(
1011                                      name.getPhysicalName(), name.getLogicalName());
1012 marek          1.63          }
1013                      
1014                              // convert arguments
1015                              OperationContext context;
1016                      
1017                              context.insert(request->operationContext.get(IdentityContainer::NAME));
1018 venkat.puvvada 1.108         context.insert(
1019                                  request->operationContext.get(AcceptLanguageListContainer::NAME));
1020                              context.insert(
1021                                  request->operationContext.get(ContentLanguageListContainer::NAME));
1022 marek          1.63          // forward request
1023                              CMPIProvider & pr=ph.GetProvider();
1024                      
1025                              CMPIStatus rc={CMPI_RC_OK,NULL};
1026                              CMPI_ContextOnStack eCtx(context);
1027                              CMPI_ObjectPathOnStack eRef(objectPath);
1028 venkat.puvvada 1.132         CMPI_ResultOnStack eRes(handler,pr.getBroker());
1029 marek          1.63          CMPI_InstanceOnStack eInst(request->modifiedInstance);
1030 venkat.puvvada 1.132         CMPI_ThreadContext thr(pr.getBroker(),&eCtx);
1031 marek          1.63  
1032                              CMPIPropertyList props(request->propertyList);
1033                      
1034 marek          1.124         _setupCMPIContexts(
1035 venkat.puvvada 1.108             &eCtx,
1036 marek          1.124             &context,
1037                                  &pidc,
1038                                  request->nameSpace.getString(),
1039                                  remote,
1040                                  request->includeQualifiers,
1041                                  false,
1042                                  true);
1043 marek          1.63  
1044                              CMPIProvider::pm_service_op_lock op_lock(&pr);
1045                      
1046 thilo.boehm    1.143         PEG_TRACE((
1047                                  TRC_PROVIDERMANAGER,
1048                                  Tracer::LEVEL2,
1049                                  "Calling provider.modifyInstance: %s",
1050                                  (const char*)pr.getName().getCString()));
1051                      
1052 kumpf          1.92          {
1053 thilo.boehm    1.144             AutoPThreadSecurity threadLevelSecurity(request->operationContext);
1054                      
1055 kumpf          1.92              StatProviderTimeMeasurement providerTime(response);
1056 marek          1.63  
1057 venkat.puvvada 1.132             rc = pr.getInstMI()->ft->modifyInstance(
1058                                      pr.getInstMI(),
1059                                      &eCtx,
1060                                      &eRes,
1061                                      &eRef,
1062                                      &eInst,
1063 kumpf          1.92                  (const char **)props.getList());
1064                              }
1065 marek          1.63  
1066 thilo.boehm    1.143         PEG_TRACE((
1067                                  TRC_PROVIDERMANAGER,
1068                                  Tracer::LEVEL2,
1069                                  "Returning from provider.modifyInstance: %s",
1070                                  (const char*)pr.getName().getCString()));
1071                      
1072 dave.sudlik    1.99  //      Need to save ContentLanguage value into operation context of response
1073 kumpf          1.151 //      Do this before checking rc from provider to throw exception in case
1074 dave.sudlik    1.99  //      rc.msg is also localized.
1075                              CMPIStatus tmprc={CMPI_RC_OK,NULL};
1076 kumpf          1.151         CMPIData cldata =
1077 venkat.puvvada 1.108             eCtx.ft->getEntry (&eCtx, CMPIContentLanguage, &tmprc);
1078 dave.sudlik    1.99          if (tmprc.rc == CMPI_RC_OK)
1079                              {
1080                                  response->operationContext.set(
1081                                      ContentLanguageListContainer(
1082 venkat.puvvada 1.108                 ContentLanguageList(
1083                                      LanguageParser::parseContentLanguageHeader(
1084 s.kodali       1.137                 CMGetCharsPtr(cldata.value.string, NULL)))));
1085 dave.sudlik    1.103             handler.setContext(response->operationContext);
1086 dave.sudlik    1.99          }
1087                      
1088 marek          1.63          if (rc.rc!=CMPI_RC_OK)
1089 dave.sudlik    1.102         {
1090 venkat.puvvada 1.108             CIMException cimException(
1091                                      (CIMStatusCode)rc.rc,
1092 s.kodali       1.137                 rc.msg ? CMGetCharsPtr(rc.msg, NULL) : String::EMPTY);
1093 venkat.puvvada 1.108 
1094                                  if (eRes.resError)
1095                                  {
1096 kumpf          1.151                 for (CMPI_Error* currErr=eRes.resError;
1097                                          currErr!=NULL;
1098 dave.sudlik    1.102                     currErr=currErr->nextError)
1099 venkat.puvvada 1.108                 {
1100                                          cimException.addError(
1101                                              ((CIMError*)currErr->hdl)->getInstance());
1102                                      }
1103                                  }
1104                                  throw cimException;
1105 dave.sudlik    1.102         }
1106 marek          1.63      }
1107                          HandlerCatch(handler);
1108                      
1109                          PEG_METHOD_EXIT();
1110                      
1111                          return(response);
1112                      }
1113                      
1114 venkat.puvvada 1.108 Message * CMPIProviderManager::handleDeleteInstanceRequest(
1115                          const Message * message)
1116 marek          1.63  {
1117 ms.aruran      1.115     PEG_METHOD_ENTER(
1118                              TRC_PROVIDERMANAGER,
1119                              "CMPIProviderManager::handleDeleteInstanceRequest()");
1120 marek          1.63  
1121 kumpf          1.92      HandlerIntro(DeleteInstance,message,request,response,handler);
1122 venkat.puvvada 1.108     try
1123                          {
1124 thilo.boehm    1.138         PEG_TRACE((TRC_PROVIDERMANAGER,Tracer::LEVEL3,
1125 marek          1.129             "CMPIProviderManager::handleDeleteInstanceRequest"
1126                                  " - Host name: %s  Name space: %s  Class name: %s",
1127                                  (const char*) System::getHostName().getCString(),
1128                                  (const char*) request->nameSpace.getString().getCString(),
1129                                  (const char*)
1130                                      request->instanceName.getClassName().getString().getCString()));
1131 kumpf          1.151 
1132 marek          1.63          // make target object path
1133                              CIMObjectPath objectPath(
1134                                  System::getHostName(),
1135                                  request->nameSpace,
1136                                  request->instanceName.getClassName(),
1137                                  request->instanceName.getKeyBindings());
1138                      
1139                              Boolean remote=false;
1140 venkat.puvvada 1.132         OpProviderHolder ph;
1141 marek          1.63  
1142                              // resolve provider name
1143 kumpf          1.151         ProviderIdContainer pidc =
1144 venkat.puvvada 1.108             request->operationContext.get(ProviderIdContainer::NAME);
1145 marek          1.63          ProviderName name = _resolveProviderName(pidc);
1146                      
1147 venkat.puvvada 1.108         if ((remote=pidc.isRemoteNameSpace()))
1148                              {
1149                                  ph = providerManager.getRemoteProvider(
1150                                      name.getLocation(), name.getLogicalName());
1151 marek          1.63          }
1152 venkat.puvvada 1.108         else
1153                              {
1154                                  // get cached or load new provider module
1155                                  ph = providerManager.getProvider(
1156                                      name.getPhysicalName(), name.getLogicalName());
1157 marek          1.63          }
1158                      
1159                              // convert arguments
1160                              OperationContext context;
1161                      
1162                              context.insert(request->operationContext.get(IdentityContainer::NAME));
1163 venkat.puvvada 1.108         context.insert(
1164                                  request->operationContext.get(AcceptLanguageListContainer::NAME));
1165                              context.insert(
1166                                  request->operationContext.get(ContentLanguageListContainer::NAME));
1167 marek          1.63          // forward request
1168                              CMPIProvider & pr=ph.GetProvider();
1169                      
1170                              CMPIStatus rc={CMPI_RC_OK,NULL};
1171                              CMPI_ContextOnStack eCtx(context);
1172                              CMPI_ObjectPathOnStack eRef(objectPath);
1173 venkat.puvvada 1.132         CMPI_ResultOnStack eRes(handler,pr.getBroker());
1174                              CMPI_ThreadContext thr(pr.getBroker(),&eCtx);
1175 marek          1.63  
1176 marek          1.124         _setupCMPIContexts(
1177 venkat.puvvada 1.108             &eCtx,
1178 marek          1.124             &context,
1179                                  &pidc,
1180                                  request->nameSpace.getString(),
1181                                  remote,
1182                                  false,
1183                                  false,
1184                                  true);
1185 marek          1.63  
1186                              CMPIProvider::pm_service_op_lock op_lock(&pr);
1187                      
1188 thilo.boehm    1.143         PEG_TRACE((
1189                                  TRC_PROVIDERMANAGER,
1190                                  Tracer::LEVEL2,
1191                                  "Calling provider.deleteInstance: %s",
1192                                  (const char*)pr.getName().getCString()));
1193                      
1194 kumpf          1.92          {
1195 thilo.boehm    1.144             AutoPThreadSecurity threadLevelSecurity(request->operationContext);
1196                      
1197 kumpf          1.92              StatProviderTimeMeasurement providerTime(response);
1198 marek          1.63  
1199 venkat.puvvada 1.132             rc = pr.getInstMI()->ft->deleteInstance(
1200                                      pr.getInstMI(),
1201                                      &eCtx,
1202                                      &eRes,
1203                                      &eRef);
1204 kumpf          1.92          }
1205 marek          1.63  
1206 thilo.boehm    1.143         PEG_TRACE((
1207                                  TRC_PROVIDERMANAGER,
1208                                  Tracer::LEVEL2,
1209                                  "Returning from provider.deleteInstance: %s",
1210                                  (const char*)pr.getName().getCString()));
1211                      
1212 dave.sudlik    1.99  //      Need to save ContentLanguage value into operation context of response
1213 kumpf          1.151 //      Do this before checking rc from provider to throw exception in case
1214 dave.sudlik    1.99  //      rc.msg is also localized.
1215                              CMPIStatus tmprc={CMPI_RC_OK,NULL};
1216 kumpf          1.151         CMPIData cldata =
1217 venkat.puvvada 1.108             eCtx.ft->getEntry (&eCtx, CMPIContentLanguage, &tmprc);
1218 dave.sudlik    1.99          if (tmprc.rc == CMPI_RC_OK)
1219                              {
1220                                  response->operationContext.set(
1221                                      ContentLanguageListContainer(
1222 venkat.puvvada 1.108                 ContentLanguageList(
1223                                      LanguageParser::parseContentLanguageHeader(
1224 s.kodali       1.137                 CMGetCharsPtr(cldata.value.string, NULL)))));
1225 dave.sudlik    1.103             handler.setContext(response->operationContext);
1226 dave.sudlik    1.99          }
1227                      
1228 marek          1.63          if (rc.rc!=CMPI_RC_OK)
1229 dave.sudlik    1.102         {
1230 venkat.puvvada 1.108             CIMException cimException(
1231                                      (CIMStatusCode)rc.rc,
1232 s.kodali       1.137                 rc.msg ? CMGetCharsPtr(rc.msg, NULL) : String::EMPTY);
1233 venkat.puvvada 1.108 
1234                                  if (eRes.resError)
1235                                  {
1236 kumpf          1.151                 for (CMPI_Error* currErr=eRes.resError;
1237                                          currErr!=NULL;
1238 dave.sudlik    1.102                     currErr=currErr->nextError)
1239 venkat.puvvada 1.108                 {
1240                                          cimException.addError(
1241                                              ((CIMError*)currErr->hdl)->getInstance());
1242                                      }
1243                                  }
1244                                  throw cimException;
1245 dave.sudlik    1.102         }
1246 marek          1.63      }
1247                          HandlerCatch(handler);
1248                      
1249                          PEG_METHOD_EXIT();
1250                      
1251                          return(response);
1252                      }
1253                      
1254                      Message * CMPIProviderManager::handleExecQueryRequest(const Message * message)
1255                      {
1256 ms.aruran      1.115     PEG_METHOD_ENTER(
1257                              TRC_PROVIDERMANAGER,
1258                              "CMPIProviderManager::handleExecQueryRequest()");
1259 marek          1.63  
1260 kumpf          1.92      HandlerIntro(ExecQuery,message,request,response,handler);
1261 marek          1.63  
1262 venkat.puvvada 1.108     try
1263                          {
1264 thilo.boehm    1.138         PEG_TRACE((TRC_PROVIDERMANAGER,Tracer::LEVEL3,
1265 marek          1.129             "CMPIProviderManager::ExecQueryRequest"
1266                                  " - Host name: %s  Name space: %s  Class name: %s",
1267                                  (const char*) System::getHostName().getCString(),
1268                                  (const char*) request->nameSpace.getString().getCString(),
1269                                  (const char*) request->className.getString().getCString()));
1270 marek          1.63  
1271                              // make target object path
1272                              CIMObjectPath objectPath(
1273                                  System::getHostName(),
1274                                  request->nameSpace,
1275                                  request->className);
1276                      
1277                              Boolean remote=false;
1278                      
1279 venkat.puvvada 1.132         OpProviderHolder ph;
1280 marek          1.63  
1281                              // resolve provider name
1282 kumpf          1.151         ProviderIdContainer pidc =
1283 venkat.puvvada 1.108             request->operationContext.get(ProviderIdContainer::NAME);
1284 marek          1.63          ProviderName name = _resolveProviderName(pidc);
1285                      
1286 venkat.puvvada 1.108         if ((remote=pidc.isRemoteNameSpace()))
1287                              {
1288                                  ph = providerManager.getRemoteProvider(
1289                                      name.getLocation(), name.getLogicalName());
1290 marek          1.63          }
1291 venkat.puvvada 1.108         else
1292                              {
1293                                  // get cached or load new provider module
1294                                  ph = providerManager.getProvider(
1295                                      name.getPhysicalName(), name.getLogicalName());
1296 marek          1.63          }
1297                      
1298                              // convert arguments
1299                              OperationContext context;
1300                      
1301                              context.insert(request->operationContext.get(IdentityContainer::NAME));
1302 venkat.puvvada 1.108         context.insert(
1303                                  request->operationContext.get(AcceptLanguageListContainer::NAME));
1304                              context.insert(
1305                                  request->operationContext.get(ContentLanguageListContainer::NAME));
1306 marek          1.63  
1307                              // forward request
1308                              CMPIProvider & pr=ph.GetProvider();
1309                      
1310                              const char **props=NULL;
1311                      
1312                              CMPIStatus rc={CMPI_RC_OK,NULL};
1313                              CMPI_ContextOnStack eCtx(context);
1314                              CMPI_ObjectPathOnStack eRef(objectPath);
1315 venkat.puvvada 1.132         CMPI_ResultOnStack eRes(handler,pr.getBroker());
1316                              CMPI_ThreadContext thr(pr.getBroker(),&eCtx);
1317 marek          1.63  
1318                              const CString queryLan=request->queryLanguage.getCString();
1319                              const CString query=request->query.getCString();
1320                      
1321 marek          1.124         _setupCMPIContexts(
1322 venkat.puvvada 1.108             &eCtx,
1323 marek          1.124             &context,
1324                                  &pidc,
1325                                  request->nameSpace.getString(),
1326                                  remote,
1327                                  false,
1328                                  false,
1329                                  true);
1330 marek          1.63  
1331                              CMPIProvider::pm_service_op_lock op_lock(&pr);
1332                      
1333 thilo.boehm    1.143         PEG_TRACE((
1334                                  TRC_PROVIDERMANAGER,
1335                                  Tracer::LEVEL2,
1336                                  "Calling provider.execQuery: %s",
1337                                  (const char*)pr.getName().getCString()));
1338                      
1339 kumpf          1.92          {
1340 thilo.boehm    1.144             AutoPThreadSecurity threadLevelSecurity(request->operationContext);
1341                      
1342 kumpf          1.92              StatProviderTimeMeasurement providerTime(response);
1343 marek          1.63  
1344 venkat.puvvada 1.132             rc = pr.getInstMI()->ft->execQuery(
1345                                      pr.getInstMI(),
1346                                      &eCtx,
1347                                      &eRes,
1348                                      &eRef,
1349                                      CHARS(queryLan),
1350                                      CHARS(query));
1351 kumpf          1.92          }
1352 marek          1.63  
1353 thilo.boehm    1.143         PEG_TRACE((
1354                                  TRC_PROVIDERMANAGER,
1355                                  Tracer::LEVEL2,
1356                                  "Returning from provider.execQuery: %s",
1357                                  (const char*)pr.getName().getCString()));
1358                      
1359 dave.sudlik    1.99  //      Need to save ContentLanguage value into operation context of response
1360 kumpf          1.151 //      Do this before checking rc from provider to throw exception in case
1361 dave.sudlik    1.99  //      rc.msg is also localized.
1362                              CMPIStatus tmprc={CMPI_RC_OK,NULL};
1363 kumpf          1.151         CMPIData cldata =
1364 venkat.puvvada 1.108             eCtx.ft->getEntry (&eCtx, CMPIContentLanguage, &tmprc);
1365 dave.sudlik    1.99          if (tmprc.rc == CMPI_RC_OK)
1366                              {
1367                                  response->operationContext.set(
1368                                      ContentLanguageListContainer(
1369 venkat.puvvada 1.108                 ContentLanguageList(
1370                                      LanguageParser::parseContentLanguageHeader(
1371 s.kodali       1.137                 CMGetCharsPtr(cldata.value.string, NULL)))));
1372 dave.sudlik    1.103             handler.setContext(response->operationContext);
1373 dave.sudlik    1.99          }
1374                      
1375 marek          1.63          if (rc.rc!=CMPI_RC_OK)
1376 dave.sudlik    1.102         {
1377 venkat.puvvada 1.108             CIMException cimException(
1378                                      (CIMStatusCode)rc.rc,
1379 s.kodali       1.137                 rc.msg ? CMGetCharsPtr(rc.msg, NULL) : String::EMPTY);
1380 venkat.puvvada 1.108 
1381                                  if (eRes.resError)
1382                                  {
1383 kumpf          1.151                 for (CMPI_Error* currErr=eRes.resError;
1384                                          currErr!=NULL;
1385 dave.sudlik    1.102                     currErr=currErr->nextError)
1386 venkat.puvvada 1.108                 {
1387                                          cimException.addError(
1388                                              ((CIMError*)currErr->hdl)->getInstance());
1389                                      }
1390                                  }
1391                                  throw cimException;
1392 dave.sudlik    1.102         }
1393                      
1394 marek          1.63      }
1395                          HandlerCatch(handler);
1396                      
1397                          PEG_METHOD_EXIT();
1398                      
1399                          return(response);
1400                      }
1401                      
1402                      Message * CMPIProviderManager::handleAssociatorsRequest(const Message * message)
1403                      {
1404 ms.aruran      1.115     PEG_METHOD_ENTER(
1405                              TRC_PROVIDERMANAGER,
1406                              "CMPIProviderManager::handleAssociatorsRequest()");
1407 marek          1.63  
1408 kumpf          1.92      HandlerIntro(Associators,message,request,response,handler);
1409 venkat.puvvada 1.108     try
1410                          {
1411 thilo.boehm    1.138         PEG_TRACE((TRC_PROVIDERMANAGER,Tracer::LEVEL3,
1412 marek          1.129             "CMPIProviderManager::handleAssociatorsRequest"
1413                                  " - Host name: %s  Name space: %s  Class name: %s",
1414                                  (const char*) System::getHostName().getCString(),
1415                                  (const char*) request->nameSpace.getString().getCString(),
1416                                  (const char*)
1417                                      request->objectName.getClassName().getString().getCString()));
1418 marek          1.63  
1419                              // make target object path
1420                              CIMObjectPath objectPath(
1421                                  System::getHostName(),
1422                                  request->nameSpace,
1423                                  request->objectName.getClassName());
1424                      
1425                              objectPath.setKeyBindings(request->objectName.getKeyBindings());
1426                      
1427                              CIMObjectPath assocPath(
1428                                  System::getHostName(),
1429                                  request->nameSpace,
1430                                  request->assocClass.getString());
1431                      
1432                              Boolean remote=false;
1433                      
1434 venkat.puvvada 1.132         OpProviderHolder ph;
1435 marek          1.63  
1436                              // resolve provider name
1437 kumpf          1.151         ProviderIdContainer pidc =
1438 venkat.puvvada 1.108             request->operationContext.get(ProviderIdContainer::NAME);
1439 marek          1.63          ProviderName name = _resolveProviderName(pidc);
1440                      
1441 venkat.puvvada 1.108         if ((remote=pidc.isRemoteNameSpace()))
1442                              {
1443                                  ph = providerManager.getRemoteProvider(
1444                                      name.getLocation(), name.getLogicalName());
1445 marek          1.63          }
1446 venkat.puvvada 1.108         else
1447                              {
1448                                  // get cached or load new provider module
1449                                  ph = providerManager.getProvider(
1450                                      name.getPhysicalName(), name.getLogicalName());
1451 marek          1.63          }
1452                      
1453 venkat.puvvada 1.108         // convert arguments
1454 marek          1.63          OperationContext context;
1455                      
1456                              context.insert(request->operationContext.get(IdentityContainer::NAME));
1457 venkat.puvvada 1.108         context.insert(
1458                                  request->operationContext.get(AcceptLanguageListContainer::NAME));
1459                              context.insert(
1460                                  request->operationContext.get(ContentLanguageListContainer::NAME));
1461 marek          1.63  
1462                              // forward request
1463                              CMPIProvider & pr=ph.GetProvider();
1464                      
1465 thilo.boehm    1.138         PEG_TRACE((TRC_PROVIDERMANAGER,Tracer::LEVEL4,
1466                                  "--- CMPIProviderManager::associators < role: > %s%s",
1467                                  (const char*)request->role.getCString(),
1468                                  (const char*)request->assocClass.getString().getCString()));
1469 marek          1.63  
1470                              CMPIStatus rc={CMPI_RC_OK,NULL};
1471                              CMPI_ContextOnStack eCtx(context);
1472                              CMPI_ObjectPathOnStack eRef(objectPath);
1473 venkat.puvvada 1.132         CMPI_ResultOnStack eRes(handler,pr.getBroker());
1474                              CMPI_ThreadContext thr(pr.getBroker(),&eCtx);
1475 marek          1.63          const CString aClass=request->assocClass.getString().getCString();
1476                              const CString rClass=request->resultClass.getString().getCString();
1477                              const CString rRole=request->role.getCString();
1478                              const CString resRole=request->resultRole.getCString();
1479                      
1480                              CMPIPropertyList props(request->propertyList);
1481                      
1482 marek          1.124         _setupCMPIContexts(
1483 venkat.puvvada 1.108             &eCtx,
1484 marek          1.124             &context,
1485                                  &pidc,
1486                                  request->nameSpace.getString(),
1487                                  remote,
1488                                  request->includeQualifiers,
1489                                  request->includeClassOrigin,
1490                                  true);
1491 marek          1.63  
1492                              CMPIProvider::pm_service_op_lock op_lock(&pr);
1493                      
1494 thilo.boehm    1.143         PEG_TRACE((
1495                                  TRC_PROVIDERMANAGER,
1496                                  Tracer::LEVEL2,
1497                                  "Calling provider.associators: %s",
1498                                  (const char*)pr.getName().getCString()));
1499                      
1500 kumpf          1.92          {
1501 thilo.boehm    1.144             AutoPThreadSecurity threadLevelSecurity(request->operationContext);
1502                      
1503 kumpf          1.92              StatProviderTimeMeasurement providerTime(response);
1504 marek          1.63  
1505 venkat.puvvada 1.132             rc = pr.getAssocMI()->ft->associators(
1506                                      pr.getAssocMI(),
1507                                      &eCtx,
1508                                      &eRes,
1509                                      &eRef,
1510                                      CHARS(aClass),
1511                                      CHARS(rClass),
1512                                      CHARS(rRole),
1513                                      CHARS(resRole),
1514 kumpf          1.92                  (const char **)props.getList());
1515                              }
1516 marek          1.63  
1517 thilo.boehm    1.143         PEG_TRACE((
1518                                  TRC_PROVIDERMANAGER,
1519                                  Tracer::LEVEL2,
1520                                  "Returning from provider.associators: %s",
1521                                  (const char*)pr.getName().getCString()));
1522                      
1523 dave.sudlik    1.99  //      Need to save ContentLanguage value into operation context of response
1524 kumpf          1.151 //      Do this before checking rc from provider to throw exception in case
1525 dave.sudlik    1.99  //      rc.msg is also localized.
1526                              CMPIStatus tmprc={CMPI_RC_OK,NULL};
1527 venkat.puvvada 1.108         CMPIData cldata = eCtx.ft->getEntry (
1528 kumpf          1.151             &eCtx,
1529                                  CMPIContentLanguage,
1530 venkat.puvvada 1.108             &tmprc);
1531 dave.sudlik    1.99          if (tmprc.rc == CMPI_RC_OK)
1532                              {
1533                                  response->operationContext.set(
1534                                      ContentLanguageListContainer(
1535 venkat.puvvada 1.108                 ContentLanguageList(
1536                                      LanguageParser::parseContentLanguageHeader(
1537 s.kodali       1.137                 CMGetCharsPtr(cldata.value.string, NULL)))));
1538 dave.sudlik    1.103             handler.setContext(response->operationContext);
1539 dave.sudlik    1.99          }
1540                      
1541 marek          1.63          if (rc.rc!=CMPI_RC_OK)
1542 dave.sudlik    1.102         {
1543 venkat.puvvada 1.108             CIMException cimException(
1544                                      (CIMStatusCode)rc.rc,
1545 s.kodali       1.137                 rc.msg ? CMGetCharsPtr(rc.msg, NULL) : String::EMPTY);
1546 venkat.puvvada 1.108 
1547                                  if (eRes.resError)
1548                                  {
1549 kumpf          1.151                 for (CMPI_Error* currErr=eRes.resError;
1550                                          currErr!=NULL;
1551 dave.sudlik    1.102                     currErr=currErr->nextError)
1552 venkat.puvvada 1.108                 {
1553                                          cimException.addError(
1554                                              ((CIMError*)currErr->hdl)->getInstance());
1555                                      }
1556                                  }
1557                                  throw cimException;
1558 dave.sudlik    1.102         }
1559 marek          1.63      }
1560                          HandlerCatch(handler);
1561                      
1562                          PEG_METHOD_EXIT();
1563                      
1564                          return(response);
1565                      }
1566                      
1567 venkat.puvvada 1.108 Message * CMPIProviderManager::handleAssociatorNamesRequest(
1568                          const Message * message)
1569 marek          1.63  {
1570 ms.aruran      1.115     PEG_METHOD_ENTER(
1571                              TRC_PROVIDERMANAGER,
1572                              "CMPIProviderManager::handleAssociatorNamesRequest()");
1573 marek          1.63  
1574 kumpf          1.92      HandlerIntro(AssociatorNames,message,request,response,handler);
1575 venkat.puvvada 1.108     try
1576                          {
1577 thilo.boehm    1.138         PEG_TRACE((TRC_PROVIDERMANAGER,Tracer::LEVEL3,
1578 marek          1.129             "CMPIProviderManager::handleAssociatorNamesRequest"
1579                                  " - Host name: %s  Name space: %s  Class name: %s",
1580                                  (const char*) System::getHostName().getCString(),
1581                                  (const char*) request->nameSpace.getString().getCString(),
1582                                  (const char*)
1583                                      request->objectName.getClassName().getString().getCString()));
1584 marek          1.63  
1585                              // make target object path
1586                              CIMObjectPath objectPath(
1587                                  System::getHostName(),
1588                                  request->nameSpace,
1589                                  request->objectName.getClassName());
1590                      
1591                              objectPath.setKeyBindings(request->objectName.getKeyBindings());
1592                      
1593                              CIMObjectPath assocPath(
1594                                  System::getHostName(),
1595                                  request->nameSpace,
1596                                  request->assocClass.getString());
1597                      
1598                              Boolean remote=false;
1599 venkat.puvvada 1.132         OpProviderHolder ph;
1600 marek          1.63  
1601                              // resolve provider name
1602 kumpf          1.151         ProviderIdContainer pidc =
1603 venkat.puvvada 1.108             request->operationContext.get(ProviderIdContainer::NAME);
1604 marek          1.63          ProviderName name = _resolveProviderName(pidc);
1605                      
1606 venkat.puvvada 1.108         if ((remote=pidc.isRemoteNameSpace()))
1607                              {
1608                                  ph = providerManager.getRemoteProvider(
1609                                      name.getLocation(), name.getLogicalName());
1610 marek          1.63          }
1611 venkat.puvvada 1.108         else
1612                              {
1613                                  // get cached or load new provider module
1614                                  ph = providerManager.getProvider(
1615                                      name.getPhysicalName(), name.getLogicalName());
1616 marek          1.63          }
1617                      
1618                              // convert arguments
1619                              OperationContext context;
1620                      
1621                              context.insert(request->operationContext.get(IdentityContainer::NAME));
1622 venkat.puvvada 1.108         context.insert(
1623                                  request->operationContext.get(AcceptLanguageListContainer::NAME));
1624                              context.insert(
1625                                  request->operationContext.get(ContentLanguageListContainer::NAME));
1626 marek          1.63  
1627                              // forward request
1628                              CMPIProvider & pr=ph.GetProvider();
1629                      
1630 thilo.boehm    1.138         PEG_TRACE((TRC_PROVIDERMANAGER,Tracer::LEVEL4,
1631 kumpf          1.151             "--- CMPIProviderManager::associatorNames --  role: %s< aCls %s",
1632 thilo.boehm    1.138             (const char*)request->role.getCString(),
1633                                  (const char*)request->assocClass.getString().getCString()));
1634 marek          1.63  
1635                              CMPIStatus rc={CMPI_RC_OK,NULL};
1636                              CMPI_ContextOnStack eCtx(context);
1637                              CMPI_ObjectPathOnStack eRef(objectPath);
1638 venkat.puvvada 1.132         CMPI_ResultOnStack eRes(handler,pr.getBroker());
1639                              CMPI_ThreadContext thr(pr.getBroker(),&eCtx);
1640 marek          1.63          const CString aClass=request->assocClass.getString().getCString();
1641                              const CString rClass=request->resultClass.getString().getCString();
1642                              const CString rRole=request->role.getCString();
1643                              const CString resRole=request->resultRole.getCString();
1644                      
1645 marek          1.124         _setupCMPIContexts(
1646 venkat.puvvada 1.108             &eCtx,
1647 marek          1.124             &context,
1648                                  &pidc,
1649                                  request->nameSpace.getString(),
1650                                  remote,
1651                                  false,
1652                                  false,
1653                                  true);
1654 marek          1.63  
1655                              CMPIProvider::pm_service_op_lock op_lock(&pr);
1656                      
1657 thilo.boehm    1.143         PEG_TRACE((
1658                                  TRC_PROVIDERMANAGER,
1659                                  Tracer::LEVEL2,
1660                                  "Calling provider.associatorNames: %s",
1661                                  (const char*)pr.getName().getCString()));
1662                      
1663 kumpf          1.92          {
1664 thilo.boehm    1.144             AutoPThreadSecurity threadLevelSecurity(request->operationContext);
1665                      
1666 kumpf          1.92              StatProviderTimeMeasurement providerTime(response);
1667 marek          1.63  
1668 venkat.puvvada 1.132             rc = pr.getAssocMI()->ft->associatorNames(
1669                                      pr.getAssocMI(),
1670                                      &eCtx,
1671                                      &eRes,
1672                                      &eRef,
1673                                      CHARS(aClass),
1674                                      CHARS(rClass),
1675                                      CHARS(rRole),
1676                                      CHARS(resRole));
1677 kumpf          1.92          }
1678 marek          1.63  
1679 thilo.boehm    1.143         PEG_TRACE((
1680                                  TRC_PROVIDERMANAGER,
1681                                  Tracer::LEVEL2,
1682                                  "Returning from provider.associatorNames: %s",
1683                                  (const char*)pr.getName().getCString()));
1684                      
1685 dave.sudlik    1.99  //      Need to save ContentLanguage value into operation context of response
1686 kumpf          1.151 //      Do this before checking rc from provider to throw exception in case
1687 dave.sudlik    1.99  //      rc.msg is also localized.
1688                              CMPIStatus tmprc={CMPI_RC_OK,NULL};
1689 kumpf          1.151         CMPIData cldata =
1690 venkat.puvvada 1.108             eCtx.ft->getEntry (&eCtx, CMPIContentLanguage, &tmprc);
1691 dave.sudlik    1.99          if (tmprc.rc == CMPI_RC_OK)
1692                              {
1693                                  response->operationContext.set(
1694                                      ContentLanguageListContainer(
1695 venkat.puvvada 1.108                 ContentLanguageList(
1696                                      LanguageParser::parseContentLanguageHeader(
1697 s.kodali       1.137                 CMGetCharsPtr(cldata.value.string, NULL)))));
1698 dave.sudlik    1.103             handler.setContext(response->operationContext);
1699 dave.sudlik    1.99          }
1700                      
1701 marek          1.63          if (rc.rc!=CMPI_RC_OK)
1702 dave.sudlik    1.102         {
1703 venkat.puvvada 1.108             CIMException cimException(
1704                                      (CIMStatusCode)rc.rc,
1705 s.kodali       1.137                 rc.msg ? CMGetCharsPtr(rc.msg, NULL) : String::EMPTY);
1706 venkat.puvvada 1.108 
1707                                  if (eRes.resError)
1708                                  {
1709 kumpf          1.151                 for (CMPI_Error* currErr=eRes.resError;
1710                                          currErr!=NULL;
1711 dave.sudlik    1.102                     currErr=currErr->nextError)
1712 venkat.puvvada 1.108                 {
1713                                          cimException.addError(
1714                                              ((CIMError*)currErr->hdl)->getInstance());
1715                                      }
1716                                  }
1717                                  throw cimException;
1718 dave.sudlik    1.102         }
1719 marek          1.63      }
1720                          HandlerCatch(handler);
1721                      
1722                          PEG_METHOD_EXIT();
1723                      
1724                          return(response);
1725                      }
1726                      
1727                      Message * CMPIProviderManager::handleReferencesRequest(const Message * message)
1728                      {
1729 ms.aruran      1.115     PEG_METHOD_ENTER(
1730                              TRC_PROVIDERMANAGER,
1731                              "CMPIProviderManager::handleReferencesRequest()");
1732 marek          1.63  
1733 kumpf          1.92      HandlerIntro(References,message,request,response,handler);
1734 venkat.puvvada 1.108     try
1735                          {
1736 thilo.boehm    1.138         PEG_TRACE((TRC_PROVIDERMANAGER,Tracer::LEVEL3,
1737 marek          1.129             "CMPIProviderManager::handleReferencesRequest"
1738                                  " - Host name: %s  Name space: %s  Class name: %s",
1739                                  (const char*) System::getHostName().getCString(),
1740                                  (const char*) request->nameSpace.getString().getCString(),
1741                                  (const char*)
1742                                      request->objectName.getClassName().getString().getCString()));
1743 marek          1.63  
1744                              // make target object path
1745                              CIMObjectPath objectPath(
1746                                  System::getHostName(),
1747                                  request->nameSpace,
1748                                  request->objectName.getClassName());
1749                      
1750                              objectPath.setKeyBindings(request->objectName.getKeyBindings());
1751                      
1752                              CIMObjectPath resultPath(
1753                                  System::getHostName(),
1754                                  request->nameSpace,
1755                                  request->resultClass.getString());
1756                      
1757                              Boolean remote=false;
1758 venkat.puvvada 1.132         OpProviderHolder ph;
1759 marek          1.63  
1760                              // resolve provider name
1761 kumpf          1.151         ProviderIdContainer pidc =
1762 venkat.puvvada 1.108             request->operationContext.get(ProviderIdContainer::NAME);
1763 marek          1.63          ProviderName name = _resolveProviderName(pidc);
1764                      
1765 venkat.puvvada 1.108         if ((remote=pidc.isRemoteNameSpace()))
1766                              {
1767                                  ph = providerManager.getRemoteProvider(
1768                                      name.getLocation(), name.getLogicalName());
1769 marek          1.63          }
1770 venkat.puvvada 1.108         else
1771                              {
1772                                  // get cached or load new provider module
1773                                  ph = providerManager.getProvider(
1774                                      name.getPhysicalName(), name.getLogicalName());
1775 marek          1.63          }
1776                      
1777                              // convert arguments
1778                              OperationContext context;
1779                      
1780                              context.insert(request->operationContext.get(IdentityContainer::NAME));
1781 venkat.puvvada 1.108         context.insert(
1782                                  request->operationContext.get(AcceptLanguageListContainer::NAME));
1783                              context.insert(
1784                                  request->operationContext.get(ContentLanguageListContainer::NAME));
1785 marek          1.63          // forward request
1786                              CMPIProvider & pr=ph.GetProvider();
1787                      
1788 thilo.boehm    1.138         PEG_TRACE((TRC_PROVIDERMANAGER,Tracer::LEVEL4,
1789                                  "--- CMPIProviderManager::references -- role:%s< aCls %s",
1790                                  (const char*)request->role.getCString(),
1791                                  (const char*)request->resultClass.getString().getCString()));
1792 marek          1.63  
1793                              CMPIStatus rc={CMPI_RC_OK,NULL};
1794                              CMPI_ContextOnStack eCtx(context);
1795                              CMPI_ObjectPathOnStack eRef(objectPath);
1796 venkat.puvvada 1.132         CMPI_ResultOnStack eRes(handler,pr.getBroker());
1797                              CMPI_ThreadContext thr(pr.getBroker(),&eCtx);
1798 marek          1.63          const CString rClass=request->resultClass.getString().getCString();
1799                              const CString rRole=request->role.getCString();
1800                      
1801                              CMPIPropertyList props(request->propertyList);
1802                      
1803 marek          1.124         _setupCMPIContexts(
1804 venkat.puvvada 1.108             &eCtx,
1805 marek          1.124             &context,
1806                                  &pidc,
1807                                  request->nameSpace.getString(),
1808                                  remote,
1809                                  request->includeQualifiers,
1810                                  request->includeClassOrigin,
1811                                  true);
1812 marek          1.63  
1813                              CMPIProvider::pm_service_op_lock op_lock(&pr);
1814                      
1815 thilo.boehm    1.143         PEG_TRACE((
1816                                  TRC_PROVIDERMANAGER,
1817                                  Tracer::LEVEL2,
1818                                  "Calling provider.references: %s",
1819                                  (const char*)pr.getName().getCString()));
1820                      
1821 kumpf          1.92          {
1822 thilo.boehm    1.144             AutoPThreadSecurity threadLevelSecurity(request->operationContext);
1823                      
1824 kumpf          1.92              StatProviderTimeMeasurement providerTime(response);
1825 marek          1.63  
1826 venkat.puvvada 1.132             rc = pr.getAssocMI()->ft->references(
1827                                      pr.getAssocMI(),
1828                                      &eCtx,
1829                                      &eRes,
1830                                      &eRef,
1831                                      CHARS(rClass),
1832                                      CHARS(rRole),
1833                                      (const char **)props.getList());
1834 kumpf          1.92          }
1835 marek          1.63  
1836 thilo.boehm    1.143         PEG_TRACE((
1837                                  TRC_PROVIDERMANAGER,
1838                                  Tracer::LEVEL2,
1839                                  "Returning from provider.references: %s",
1840                                  (const char*)pr.getName().getCString()));
1841                      
1842 dave.sudlik    1.99  //      Need to save ContentLanguage value into operation context of response
1843 kumpf          1.151 //      Do this before checking rc from provider to throw exception in case
1844 dave.sudlik    1.99  //      rc.msg is also localized.
1845                              CMPIStatus tmprc={CMPI_RC_OK,NULL};
1846 kumpf          1.151         CMPIData cldata =
1847 venkat.puvvada 1.108             eCtx.ft->getEntry (&eCtx, CMPIContentLanguage, &tmprc);
1848 dave.sudlik    1.99          if (tmprc.rc == CMPI_RC_OK)
1849                              {
1850                                  response->operationContext.set(
1851                                      ContentLanguageListContainer(
1852 venkat.puvvada 1.108                 ContentLanguageList(
1853                                      LanguageParser::parseContentLanguageHeader(
1854 s.kodali       1.137                 CMGetCharsPtr(cldata.value.string, NULL)))));
1855 dave.sudlik    1.103             handler.setContext(response->operationContext);
1856 dave.sudlik    1.99          }
1857                      
1858 marek          1.63          if (rc.rc!=CMPI_RC_OK)
1859 dave.sudlik    1.102         {
1860 venkat.puvvada 1.108             CIMException cimException(
1861                                      (CIMStatusCode)rc.rc,
1862 s.kodali       1.137                 rc.msg ? CMGetCharsPtr(rc.msg, NULL) : String::EMPTY);
1863 venkat.puvvada 1.108 
1864                                  if (eRes.resError)
1865                                  {
1866 kumpf          1.151                 for (CMPI_Error* currErr=eRes.resError;
1867                                          currErr!=NULL;
1868 dave.sudlik    1.102                     currErr=currErr->nextError)
1869 venkat.puvvada 1.108                 {
1870                                          cimException.addError(
1871                                              ((CIMError*)currErr->hdl)->getInstance());
1872                                      }
1873                                  }
1874                                  throw cimException;
1875 dave.sudlik    1.102         }
1876 marek          1.63      }
1877                          HandlerCatch(handler);
1878                      
1879                          PEG_METHOD_EXIT();
1880                      
1881                          return(response);
1882                      }
1883                      
1884 venkat.puvvada 1.108 Message * CMPIProviderManager::handleReferenceNamesRequest(
1885                          const Message * message)
1886 marek          1.63  {
1887 ms.aruran      1.115     PEG_METHOD_ENTER(
1888                              TRC_PROVIDERMANAGER,
1889                              "CMPIProviderManager::handleReferenceNamesRequest()");
1890 marek          1.63  
1891 kumpf          1.92      HandlerIntro(ReferenceNames,message,request,response,handler);
1892 venkat.puvvada 1.108     try
1893                          {
1894 thilo.boehm    1.138         PEG_TRACE((TRC_PROVIDERMANAGER,Tracer::LEVEL3,
1895 marek          1.129             "CMPIProviderManager::handleReferenceNamesRequest"
1896                                  " - Host name: %s  Name space: %s  Class name: %s",
1897                                  (const char*) System::getHostName().getCString(),
1898                                  (const char*) request->nameSpace.getString().getCString(),
1899                                  (const char*)
1900                                      request->objectName.getClassName().getString().getCString()));
1901 kumpf          1.151 
1902 marek          1.63          // make target object path
1903                              CIMObjectPath objectPath(
1904                                  System::getHostName(),
1905                                  request->nameSpace,
1906                                  request->objectName.getClassName());
1907                      
1908                              objectPath.setKeyBindings(request->objectName.getKeyBindings());
1909                      
1910                              CIMObjectPath resultPath(
1911                                  System::getHostName(),
1912                                  request->nameSpace,
1913                                  request->resultClass.getString());
1914                      
1915                              Boolean remote=false;
1916 venkat.puvvada 1.132         OpProviderHolder ph;
1917 marek          1.63  
1918                              // resolve provider name
1919 kumpf          1.151         ProviderIdContainer pidc =
1920 venkat.puvvada 1.108             request->operationContext.get(ProviderIdContainer::NAME);
1921 marek          1.63          ProviderName name = _resolveProviderName(pidc);
1922                      
1923 venkat.puvvada 1.108         if ((remote=pidc.isRemoteNameSpace()))
1924                              {
1925                                  ph = providerManager.getRemoteProvider(
1926                                      name.getLocation(), name.getLogicalName());
1927 marek          1.63          }
1928 venkat.puvvada 1.108         else
1929                              {
1930                                  // get cached or load new provider module
1931                                  ph = providerManager.getProvider(
1932                                      name.getPhysicalName(), name.getLogicalName());
1933 marek          1.63          }
1934                      
1935                              // convert arguments
1936                              OperationContext context;
1937                      
1938 venkat.puvvada 1.108         context.insert(request->operationContext.get(IdentityContainer::NAME));
1939                              context.insert(
1940                                  request->operationContext.get(AcceptLanguageListContainer::NAME));
1941                              context.insert(
1942                                  request->operationContext.get(ContentLanguageListContainer::NAME));
1943 marek          1.63          CMPIProvider & pr=ph.GetProvider();
1944                      
1945 thilo.boehm    1.138         PEG_TRACE((TRC_PROVIDERMANAGER,Tracer::LEVEL4,
1946                                  "--- CMPIProviderManager::referenceNames -- role: %s< aCls %s",
1947                                  (const char*)request->role.getCString(),
1948                                  (const char*)request->resultClass.getString().getCString()));
1949 marek          1.63  
1950                              CMPIStatus rc={CMPI_RC_OK,NULL};
1951                              CMPI_ContextOnStack eCtx(context);
1952                              CMPI_ObjectPathOnStack eRef(objectPath);
1953 venkat.puvvada 1.132         CMPI_ResultOnStack eRes(handler,pr.getBroker());
1954                              CMPI_ThreadContext thr(pr.getBroker(),&eCtx);
1955 marek          1.63          const CString rClass=request->resultClass.getString().getCString();
1956                              const CString rRole=request->role.getCString();
1957                      
1958 marek          1.124         _setupCMPIContexts(
1959 venkat.puvvada 1.108             &eCtx,
1960 marek          1.124             &context,
1961                                  &pidc,
1962                                  request->nameSpace.getString(),
1963                                  remote,
1964                                  false,
1965                                  false,
1966                                  true);
1967 marek          1.63  
1968                              CMPIProvider::pm_service_op_lock op_lock(&pr);
1969                      
1970 thilo.boehm    1.143         PEG_TRACE((
1971                                  TRC_PROVIDERMANAGER,
1972                                  Tracer::LEVEL2,
1973                                  "Calling provider.referenceNames: %s",
1974                                  (const char*)pr.getName().getCString()));
1975                      
1976 kumpf          1.92          {
1977 thilo.boehm    1.144             AutoPThreadSecurity threadLevelSecurity(request->operationContext);
1978                      
1979 kumpf          1.92              StatProviderTimeMeasurement providerTime(response);
1980 marek          1.63  
1981 venkat.puvvada 1.132             rc = pr.getAssocMI()->ft->referenceNames(
1982                                      pr.getAssocMI(),
1983                                      &eCtx,
1984                                      &eRes,
1985                                      &eRef,
1986                                      CHARS(rClass),
1987                                      CHARS(rRole));
1988 kumpf          1.92          }
1989 marek          1.63  
1990 thilo.boehm    1.143         PEG_TRACE((
1991                                  TRC_PROVIDERMANAGER,
1992                                  Tracer::LEVEL2,
1993                                  "Returning from provider.referenceNames: %s",
1994                                  (const char*)pr.getName().getCString()));
1995                      
1996 dave.sudlik    1.99  //      Need to save ContentLanguage value into operation context of response
1997 kumpf          1.151 //      Do this before checking rc from provider to throw exception in case
1998 dave.sudlik    1.99  //      rc.msg is also localized.
1999                              CMPIStatus tmprc={CMPI_RC_OK,NULL};
2000 kumpf          1.151         CMPIData cldata =
2001 venkat.puvvada 1.108              eCtx.ft->getEntry (&eCtx, CMPIContentLanguage, &tmprc);
2002 dave.sudlik    1.99          if (tmprc.rc == CMPI_RC_OK)
2003                              {
2004                                  response->operationContext.set(
2005                                      ContentLanguageListContainer(
2006 venkat.puvvada 1.108                 ContentLanguageList(
2007                                      LanguageParser::parseContentLanguageHeader(
2008 s.kodali       1.137                 CMGetCharsPtr(cldata.value.string, NULL)))));
2009 dave.sudlik    1.103             handler.setContext(response->operationContext);
2010 dave.sudlik    1.99          }
2011                      
2012 marek          1.63          if (rc.rc!=CMPI_RC_OK)
2013 dave.sudlik    1.102         {
2014 venkat.puvvada 1.108             CIMException cimException(
2015                                      (CIMStatusCode)rc.rc,
2016 s.kodali       1.137                 rc.msg ? CMGetCharsPtr(rc.msg, NULL) : String::EMPTY);
2017 venkat.puvvada 1.108 
2018                                  if (eRes.resError)
2019                                  {
2020 kumpf          1.151                 for (CMPI_Error* currErr=eRes.resError;
2021                                          currErr!=NULL;
2022 dave.sudlik    1.102                     currErr=currErr->nextError)
2023 venkat.puvvada 1.108                 {
2024                                          cimException.addError(
2025                                              ((CIMError*)currErr->hdl)->getInstance());
2026                                      }
2027                                  }
2028                                  throw cimException;
2029 dave.sudlik    1.102         }
2030 marek          1.63      }
2031                          HandlerCatch(handler);
2032                      
2033                          PEG_METHOD_EXIT();
2034                      
2035                          return(response);
2036                      }
2037                      
2038 venkat.puvvada 1.108 Message * CMPIProviderManager::handleInvokeMethodRequest(
2039                          const Message * message)
2040 marek          1.63  {
2041 ms.aruran      1.115     PEG_METHOD_ENTER(
2042                              TRC_PROVIDERMANAGER,
2043                              "CMPIProviderManager::handleInvokeMethodRequest()");
2044 marek          1.63  
2045 kumpf          1.92      HandlerIntro(InvokeMethod,message,request,response,handler);
2046 venkat.puvvada 1.108     try
2047                          {
2048 thilo.boehm    1.138         PEG_TRACE((TRC_PROVIDERMANAGER,Tracer::LEVEL3,
2049 marek          1.129             "CMPIProviderManager::handleInvokeMethodRequest"
2050                                  " - Host name: %s  Name space: %s  Class name: %s",
2051                                  (const char*) System::getHostName().getCString(),
2052                                  (const char*) request->nameSpace.getString().getCString(),
2053                                  (const char*)
2054                                      request->instanceName.getClassName().getString().getCString()));
2055 marek          1.63  
2056                              // make target object path
2057                              CIMObjectPath objectPath(
2058                                  System::getHostName(),
2059                                  request->nameSpace,
2060                                  request->instanceName.getClassName(),
2061                                  request->instanceName.getKeyBindings());
2062                      
2063                              Boolean remote=false;
2064 venkat.puvvada 1.132         OpProviderHolder ph;
2065 marek          1.63  
2066                              // resolve provider name
2067 kumpf          1.151         ProviderIdContainer pidc =
2068 venkat.puvvada 1.108             request->operationContext.get(ProviderIdContainer::NAME);
2069 marek          1.63          ProviderName name = _resolveProviderName(pidc);
2070                      
2071 venkat.puvvada 1.108         if ((remote=pidc.isRemoteNameSpace()))
2072                              {
2073                                  ph = providerManager.getRemoteProvider(
2074                                      name.getLocation(), name.getLogicalName());
2075 marek          1.63          }
2076 venkat.puvvada 1.108         else
2077                              {
2078                                  // get cached or load new provider module
2079                                  ph = providerManager.getProvider(
2080                                      name.getPhysicalName(), name.getLogicalName());
2081 marek          1.63          }
2082                      
2083                              // convert arguments
2084                              OperationContext context;
2085                      
2086                              context.insert(request->operationContext.get(IdentityContainer::NAME));
2087 venkat.puvvada 1.108         context.insert(
2088                                  request->operationContext.get(AcceptLanguageListContainer::NAME));
2089                              context.insert(
2090                                  request->operationContext.get(ContentLanguageListContainer::NAME));
2091 marek          1.63  
2092                              CIMObjectPath instanceReference(request->instanceName);
2093                      
2094                              // ATTN: propagate namespace
2095                              instanceReference.setNameSpace(request->nameSpace);
2096                      
2097                              // forward request
2098                              CMPIProvider & pr=ph.GetProvider();
2099                      
2100                              CMPIStatus rc={CMPI_RC_OK,NULL};
2101                              CMPI_ContextOnStack eCtx(context);
2102                              CMPI_ObjectPathOnStack eRef(objectPath);
2103 venkat.puvvada 1.132         CMPI_ResultOnStack eRes(handler,pr.getBroker());
2104                              CMPI_ThreadContext thr(pr.getBroker(),&eCtx);
2105 marek          1.63          CMPI_ArgsOnStack eArgsIn(request->inParameters);
2106                              Array<CIMParamValue> outArgs;
2107                              CMPI_ArgsOnStack eArgsOut(outArgs);
2108                              CString mName=request->methodName.getString().getCString();
2109                      
2110 marek          1.124         _setupCMPIContexts(
2111 venkat.puvvada 1.108             &eCtx,
2112 marek          1.124             &context,
2113                                  &pidc,
2114                                  request->nameSpace.getString(),
2115                                  remote,
2116                                  false,
2117                                  false,
2118                                  true);
2119 marek          1.63  
2120                              CMPIProvider::pm_service_op_lock op_lock(&pr);
2121                      
2122 thilo.boehm    1.143         PEG_TRACE((
2123                                  TRC_PROVIDERMANAGER,
2124                                  Tracer::LEVEL2,
2125                                  "Calling provider.invokeMethod: %s",
2126                                  (const char*)pr.getName().getCString()));
2127                      
2128 kumpf          1.92          {
2129 thilo.boehm    1.144             AutoPThreadSecurity threadLevelSecurity(request->operationContext);
2130                      
2131 kumpf          1.92              StatProviderTimeMeasurement providerTime(response);
2132 marek          1.63  
2133 venkat.puvvada 1.132             rc = pr.getMethMI()->ft->invokeMethod(
2134                                      pr.getMethMI(),
2135                                      &eCtx,
2136                                      &eRes,
2137                                      &eRef,
2138                                      CHARS(mName),
2139                                      &eArgsIn,
2140                                      &eArgsOut);
2141 kumpf          1.92          }
2142 marek          1.63  
2143 thilo.boehm    1.143         PEG_TRACE((
2144                                  TRC_PROVIDERMANAGER,
2145                                  Tracer::LEVEL2,
2146                                  "Returning from provider.invokeMethod: %s",
2147                                  (const char*)pr.getName().getCString()));
2148                      
2149 dave.sudlik    1.99  //      Need to save ContentLanguage value into operation context of response
2150 kumpf          1.151 //      Do this before checking rc from provider to throw exception in case
2151 dave.sudlik    1.99  //      rc.msg is also localized.
2152                              CMPIStatus tmprc={CMPI_RC_OK,NULL};
2153 kumpf          1.151         CMPIData cldata =
2154 venkat.puvvada 1.108             eCtx.ft->getEntry (&eCtx, CMPIContentLanguage, &tmprc);
2155 dave.sudlik    1.99          if (tmprc.rc == CMPI_RC_OK)
2156                              {
2157                                  response->operationContext.set(
2158                                      ContentLanguageListContainer(
2159 venkat.puvvada 1.108                 ContentLanguageList(
2160                                      LanguageParser::parseContentLanguageHeader(
2161 s.kodali       1.137                 CMGetCharsPtr(cldata.value.string, NULL)))));
2162 dave.sudlik    1.103             handler.setContext(response->operationContext);
2163 dave.sudlik    1.99          }
2164                      
2165 marek          1.63          if (rc.rc!=CMPI_RC_OK)
2166 dave.sudlik    1.102         {
2167 venkat.puvvada 1.108             CIMException cimException(
2168                                      (CIMStatusCode)rc.rc,
2169 s.kodali       1.137                 rc.msg ? CMGetCharsPtr(rc.msg, NULL) : String::EMPTY);
2170 venkat.puvvada 1.108 
2171                                  if (eRes.resError)
2172                                  {
2173 kumpf          1.151                 for (CMPI_Error* currErr=eRes.resError;
2174                                          currErr!=NULL;
2175 dave.sudlik    1.102                     currErr=currErr->nextError)
2176 venkat.puvvada 1.108                 {
2177                                          cimException.addError(
2178                                              ((CIMError*)currErr->hdl)->getInstance());
2179                                      }
2180                                  }
2181                                  throw cimException;
2182 dave.sudlik    1.102         }
2183                      
2184 kumpf          1.151         // Even if external normalization is enabled we don't normalize the
2185 venkat.puvvada 1.121         // Embedded instances present in output args. Normalize them here.
2186 a.dunfey       1.85          {
2187                                  // There is no try catch here because if there is no external
2188                                  // normalization, then these containers were added by this method.
2189                                  const CachedClassDefinitionContainer * classCont =
2190                                      dynamic_cast<const CachedClassDefinitionContainer *>(
2191 venkat.puvvada 1.108                 &request->operationContext.get(
2192                                      CachedClassDefinitionContainer::NAME));
2193 kumpf          1.106             PEGASUS_ASSERT(classCont != 0);
2194                      
2195 mike           1.148             CIMConstClass classDef(classCont->getClass());
2196 a.dunfey       1.85              Uint32 methodIndex = classDef.findMethod(request->methodName);
2197 venkat.puvvada 1.152             CIMConstMethod methodDef;
2198 kavita.gupta   1.153             if (methodIndex != PEG_NOT_FOUND)
2199 venkat.puvvada 1.152             {
2200                                      methodDef = classDef.getMethod(methodIndex);
2201                                  }
2202 venkat.puvvada 1.108             for (unsigned int i = 0, n = outArgs.size(); i < n; ++i)
2203 a.dunfey       1.85              {
2204                                      CIMParamValue currentParam(outArgs[i]);
2205                                      CIMValue paramValue(currentParam.getValue());
2206                                      // If the parameter value is an EmbeddedObject type, we have
2207                                      // to check against the type of the parameter definition.
2208                                      // CMPI does not distinguish between EmbeddedObjects and
2209                                      // EmbeddedInstances, so if the parameter definition has a type
2210                                      // of EmbeddedInstance, the type of the output parameter must
2211                                      // be changed.
2212 venkat.puvvada 1.152                 if (paramValue.getType() == CIMTYPE_OBJECT && 
2213                                          methodIndex != PEG_NOT_FOUND)
2214 a.dunfey       1.85                  {
2215                                          String currentParamName(currentParam.getParameterName());
2216                                          Uint32 paramIndex = methodDef.findParameter(
2217                                              CIMName(currentParamName));
2218 venkat.puvvada 1.108                     if (paramIndex == PEG_NOT_FOUND)
2219 a.dunfey       1.85                      {
2220                                              MessageLoaderParms msg("ProviderManager.CMPI."
2221                                                  "CMPIProviderManager.PARAMETER_NOT_FOUND",
2222 dave.sudlik    1.117                             "Parameter $0 not found in definition for "
2223                                                  "method $1.", currentParamName,
2224 a.dunfey       1.85                              request->methodName.getString());
2225 thilo.boehm    1.138 
2226                                              PEG_TRACE((TRC_PROVIDERMANAGER, Tracer::LEVEL1,
2227                                                  "Parameter %s not found in definition for "
2228                                                  "method %s.",
2229                                                  (const char*)currentParamName.getCString(),
2230                                                  (const char*)
2231                                                      request->methodName.getString().getCString()));
2232                      
2233 a.dunfey       1.85                          handler.setStatus(CIM_ERR_FAILED,
2234 dave.sudlik    1.117                             MessageLoader::getMessage(msg));
2235 a.dunfey       1.85                      }
2236                                          else
2237                                          {
2238                                              CIMConstParameter paramDef(
2239                                                  methodDef.getParameter(paramIndex));
2240 thilo.boehm    1.135                         if (paramDef.findQualifier(
2241                                                      PEGASUS_QUALIFIERNAME_EMBEDDEDINSTANCE)
2242 a.dunfey       1.85                              != PEG_NOT_FOUND)
2243                                              {
2244 venkat.puvvada 1.126                             if (paramValue.isArray())
2245 kumpf          1.151                             {
2246 venkat.puvvada 1.126                                 Array<CIMInstance> paramInstArr;
2247                                                      Array<CIMObject> paramObjectArr;
2248                                                      paramValue.get(paramObjectArr);
2249 kumpf          1.151                                 for (Uint32 j = 0 ;
2250 kumpf          1.134                                     j < paramObjectArr.size() ; ++j)
2251 venkat.puvvada 1.126                                 {
2252                                                          paramInstArr.append(
2253 kumpf          1.134                                         CIMInstance(paramObjectArr[j]));
2254 venkat.puvvada 1.126                                 }
2255                                                      currentParam = CIMParamValue(currentParamName,
2256                                                          CIMValue(paramInstArr));
2257                                                  }
2258                                                  else
2259                                                  {
2260                                                      CIMObject paramObject;
2261                                                      paramValue.get(paramObject);
2262                                                      CIMInstance paramInst(paramObject);
2263                                                      currentParam = CIMParamValue(currentParamName,
2264                                                          CIMValue(paramInst));
2265                                                  }
2266 a.dunfey       1.85                          }
2267                                              else
2268                                              {
2269                                                  currentParam = CIMParamValue(currentParamName,
2270 venkat.puvvada 1.126                                 paramValue);
2271 a.dunfey       1.85                          }
2272                      
2273                                              handler.deliverParamValue(currentParam);
2274                                          }
2275                                      }
2276                                      else
2277                                      {
2278                                          handler.deliverParamValue(currentParam);
2279                                      }
2280                                  }
2281                              }
2282 venkat.puvvada 1.108         handler.complete();
2283 marek          1.63      }
2284                          HandlerCatch(handler);
2285                      
2286                          PEG_METHOD_EXIT();
2287                      
2288                          return(response);
2289                      }
2290                      
2291 venkat.puvvada 1.108 int LocateIndicationProviderNames(
2292                          const CIMInstance& pInstance,
2293                          const CIMInstance& pmInstance,
2294 kumpf          1.151     String& providerName,
2295 venkat.puvvada 1.108     String& location)
2296 marek          1.63  {
2297 ms.aruran      1.115    PEG_METHOD_ENTER(
2298                              TRC_PROVIDERMANAGER,
2299                              "CMPIProviderManager:LocateIndicationProviderNames()");
2300 marek          1.139     Uint32 pos = pInstance.findProperty(PEGASUS_PROPERTYNAME_NAME);
2301 marek          1.63      pInstance.getProperty(pos).getValue().get(providerName);
2302                      
2303                          pos = pmInstance.findProperty(CIMName ("Location"));
2304                          pmInstance.getProperty(pos).getValue().get(location);
2305 ms.aruran      1.115     PEG_METHOD_EXIT();
2306 marek          1.63      return 0;
2307                      }
2308                      
2309 venkat.puvvada 1.145 String CMPIProviderManager::_getClassNameFromQuery(
2310                          CIMOMHandleQueryContext *context,
2311                          String &query,
2312                          String &lang)
2313                      {
2314 venkat.puvvada 1.146     String className;
2315                      
2316 venkat.puvvada 1.145     try
2317                          {
2318                              QueryExpression qe(lang, query, *context);
2319                              // Neither WQL nor CQL support joins, we should get only
2320                              // one class path here.
2321                              PEGASUS_ASSERT(qe.getClassPathList().size() == 1);
2322 venkat.puvvada 1.146         className = qe.getClassPathList()[0].getClassName().getString();
2323 venkat.puvvada 1.145     }
2324                          catch(QueryException&)
2325                          {
2326                              // We should never get query parsing exceptions, IndicationService
2327                              // already performed this checking.
2328                              PEGASUS_ASSERT(0);
2329                          }
2330 venkat.puvvada 1.146     return className;
2331 venkat.puvvada 1.145 }
2332                      
2333 venkat.puvvada 1.108 Message * CMPIProviderManager::handleCreateSubscriptionRequest(
2334                          const Message * message)
2335 marek          1.63  {
2336 ms.aruran      1.115     PEG_METHOD_ENTER(
2337                              TRC_PROVIDERMANAGER,
2338                              "CMPIProviderManager::handleCreateSubscriptionRequest()");
2339 marek          1.63  
2340                          HandlerIntroInd(CreateSubscription,message,request,response,
2341 venkat.puvvada 1.108         handler);
2342                          try
2343                          {
2344 marek          1.63          CIMInstance req_provider, req_providerModule;
2345 kumpf          1.151         ProviderIdContainer pidc =
2346 venkat.puvvada 1.108             (ProviderIdContainer)request->operationContext.get(
2347                                  ProviderIdContainer::NAME);
2348 marek          1.63          req_provider = pidc.getProvider();
2349                              req_providerModule = pidc.getModule();
2350                      
2351                              String providerName,providerLocation;
2352                              LocateIndicationProviderNames(req_provider, req_providerModule,
2353 venkat.puvvada 1.108             providerName,providerLocation);
2354 marek          1.63  
2355 thilo.boehm    1.138         PEG_TRACE((TRC_PROVIDERMANAGER,Tracer::LEVEL3,
2356 marek          1.129             "CMPIProviderManager::handleCreateSubscriptionRequest"
2357                                  " - Host name: %s  Name space: %s  Provider name(s): %s",
2358                                  (const char*) System::getHostName().getCString(),
2359                                  (const char*) request->nameSpace.getString().getCString(),
2360                                  (const char*) providerName.getCString()));
2361 marek          1.63  
2362                              Boolean remote=false;
2363 venkat.puvvada 1.132         OpProviderHolder ph;
2364 marek          1.63  
2365 venkat.puvvada 1.108         if ((remote=pidc.isRemoteNameSpace()))
2366                              {
2367                                  ph = providerManager.getRemoteProvider(
2368                                      providerLocation, providerName);
2369 marek          1.63          }
2370 venkat.puvvada 1.108         else
2371                              {
2372                                  // get cached or load new provider module
2373                                  ph = providerManager.getProvider(
2374                                      providerLocation, providerName);
2375 marek          1.63          }
2376                      
2377                              indProvRecord *prec=NULL;
2378 marek          1.95          {
2379                                  WriteLock writeLock(rwSemProvTab);
2380 venkat.puvvada 1.108             provTab.lookup(ph.GetProvider().getName(),prec);
2381                                  if (prec) prec->count++;
2382                                  else
2383                                  {
2384                                      prec=new indProvRecord();
2385 venkat.puvvada 1.110 #ifdef PEGASUS_ENABLE_REMOTE_CMPI
2386                                      if (remote)
2387                                      {
2388                                          prec->remoteInfo = pidc.getRemoteInfo();
2389                                      }
2390                      #endif
2391 venkat.puvvada 1.108                 provTab.insert(ph.GetProvider().getName(),prec);
2392                                  }
2393 marek          1.95          }
2394 marek          1.63  
2395                              //
2396                              //  Save the provider instance from the request
2397                              //
2398                              ph.GetProvider ().setProviderInstance (req_provider);
2399                      
2400 venkat.puvvada 1.145         const CIMObjectPath &sPath=request->subscriptionInstance.getPath();
2401 marek          1.63  
2402 marek          1.95          indSelectRecord *srec=NULL;
2403                      
2404                              {
2405                                  WriteLock writeLock(rwSemSelxTab);
2406 venkat.puvvada 1.145             selxTab.lookup(sPath,srec);
2407 marek          1.95              if (srec) srec->count++;
2408 venkat.puvvada 1.108             else
2409                                  {
2410                                      srec=new indSelectRecord();
2411 venkat.puvvada 1.145                 selxTab.insert(sPath,srec);
2412 marek          1.95              }
2413                              }
2414 marek          1.63  
2415                              // convert arguments
2416                              OperationContext context;
2417                              context.insert(request->operationContext.get(IdentityContainer::NAME));
2418 venkat.puvvada 1.108         context.insert(
2419                                  request->operationContext.get(AcceptLanguageListContainer::NAME));
2420                              context.insert(
2421                                  request->operationContext.get(ContentLanguageListContainer::NAME));
2422                              context.insert(
2423                                  request->operationContext.get(SubscriptionInstanceContainer::NAME));
2424                              context.insert(
2425                                  request->operationContext.get(
2426                                  SubscriptionFilterConditionContainer::NAME));
2427 marek          1.63  
2428 kumpf          1.151         CIMObjectPath subscriptionName =
2429 venkat.puvvada 1.108             request->subscriptionInstance.getPath();
2430 marek          1.63  
2431                              CMPIProvider & pr=ph.GetProvider();
2432                      
2433                              CMPIStatus rc={CMPI_RC_OK,NULL};
2434                              CMPI_ContextOnStack eCtx(context);
2435 kumpf          1.151         SubscriptionFilterConditionContainer sub_cntr =
2436 venkat.puvvada 1.108             request->operationContext.get(
2437                                  SubscriptionFilterConditionContainer::NAME);
2438                      
2439 kumpf          1.151         CIMOMHandleQueryContext *_context=
2440 venkat.puvvada 1.108             new CIMOMHandleQueryContext(
2441                                  CIMNamespaceName(
2442                                  request->nameSpace.getString()),
2443 venkat.puvvada 1.132             *pr.getCIMOMHandle());
2444 venkat.puvvada 1.108 
2445                              CMPI_SelectExp *eSelx=new CMPI_SelectExp(
2446                                  context,
2447                                  _context,
2448                                  request->query,
2449                                  sub_cntr.getQueryLanguage());
2450 marek          1.63  
2451                              srec->eSelx=eSelx;
2452 venkat.puvvada 1.108         srec->qContext=_context;
2453 marek          1.63  
2454 venkat.puvvada 1.132         CMPI_ThreadContext thr(pr.getBroker(),&eCtx);
2455 marek          1.63  
2456 venkat.puvvada 1.145         String lang(sub_cntr.getQueryLanguage());
2457                              CString className = _getClassNameFromQuery(
2458 kumpf          1.151             _context,
2459 venkat.puvvada 1.145             request->query,
2460                                  lang).getCString();
2461 kumpf          1.151 
2462 venkat.puvvada 1.145         CIMObjectPath indClassPath(
2463                                  System::getHostName(),
2464                                  request->nameSpace,
2465                                  (const char*)className);
2466                      
2467                              eSelx->classNames.append(indClassPath);
2468 marek          1.63  
2469                              CIMPropertyList propertyList = request->propertyList;
2470 venkat.puvvada 1.108         if (!propertyList.isNull())
2471                              {
2472                                  Array<CIMName> p=propertyList.getPropertyNameArray();
2473                                  int pCount=p.size();
2474                                  eSelx->props = new const char*[1+pCount];
2475                                  for (int i=0; i<pCount; i++)
2476                                  {
2477                                      eSelx->props[i]=strdup(p[i].getString().getCString());
2478                                  }
2479                                  eSelx->props[pCount]=NULL;
2480 marek          1.63          }
2481                      
2482                              Uint16 repeatNotificationPolicy = request->repeatNotificationPolicy;
2483                      
2484 marek          1.124         // includeQualifiers and includeClassOrigin not of interest for
2485                              // this type of request
2486                              _setupCMPIContexts(
2487 kumpf          1.79              &eCtx,
2488 marek          1.124             &context,
2489                                  &pidc,
2490                                  request->nameSpace.getString(),
2491                                  remote);
2492 marek          1.63  
2493                              CMPIProvider::pm_service_op_lock op_lock(&pr);
2494                      
2495 thilo.boehm    1.143         PEG_TRACE((
2496                                  TRC_PROVIDERMANAGER,
2497                                  Tracer::LEVEL2,
2498                                  "Calling provider.createSubscriptionRequest: %s",
2499                                  (const char*)pr.getName().getCString()));
2500                      
2501 venkat.puvvada 1.145         Boolean filterActivated = false;
2502 kumpf          1.92          {
2503 thilo.boehm    1.144             AutoPThreadSecurity threadLevelSecurity(request->operationContext);
2504                      
2505 kumpf          1.92              StatProviderTimeMeasurement providerTime(response);
2506 venkat.puvvada 1.145             // Call activateFilter() on each subclass name, Check if atleast one
2507                                  // filter can be activated for any of the subclasses.
2508                                  for (Uint32 i = 0, n = request->classNames.size(); i < n; i++)
2509                                  {
2510                                      CIMObjectPath classPath(
2511                                          System::getHostName(),
2512                                          request->nameSpace,
2513                                          request->classNames[i]);
2514                      
2515                                      CMPI_ObjectPathOnStack eRef(classPath);
2516                      
2517                                      if (pr.getIndMI()->ft->ftVersion >= 100)
2518                                      {
2519                                          rc = pr.getIndMI()->ft->activateFilter(
2520                                              pr.getIndMI(),
2521                                              &eCtx,
2522                                              eSelx,
2523                                              CHARS(className),
2524                                              &eRef,
2525                                              false);
2526                                      }
2527 venkat.puvvada 1.145                 else
2528                                      {
2529                                          // Older version of (pre 1.00) also pass in a CMPIResult
2530 kumpf          1.92  
2531 venkat.puvvada 1.145                     rc = ((CMPIStatus (*)(
2532                                                   CMPIIndicationMI*,
2533                                                   CMPIContext*,
2534                                                   CMPIResult*,
2535                                                   CMPISelectExp*,
2536                                                   const char *,
2537                                                   CMPIObjectPath*,
2538                                                   CMPIBoolean))pr.getIndMI()->ft->activateFilter)
2539                                                       (pr.getIndMI(),
2540                                                        &eCtx,
2541                                                        NULL,
2542                                                        eSelx,
2543                                                        CHARS(className),
2544                                                        &eRef,
2545                                                        false);
2546                                      }
2547                                      if (rc.rc == CMPI_RC_OK)
2548                                      {
2549                                          filterActivated = true;
2550                                          eSelx->classNames.append(classPath);
2551                                      }
2552 venkat.puvvada 1.145                 else
2553                                      {
2554                                          PEG_TRACE((
2555                                              TRC_PROVIDERMANAGER,
2556                                              Tracer::LEVEL2,
2557                                              "activateFilter() for class %s in namespace %s "
2558                                                  "failed. Error : %s",
2559                                              CHARS(classPath.getClassName().
2560                                                  getString().getCString()),
2561                                              CHARS(request->nameSpace.getString().getCString()),
2562                                              rc.msg ? CMGetCharsPtr(rc.msg, NULL) : "Unknown"));
2563                                      }
2564 kumpf          1.92              }
2565                              }
2566 marek          1.63  
2567 thilo.boehm    1.143         PEG_TRACE((
2568                                  TRC_PROVIDERMANAGER,
2569                                  Tracer::LEVEL2,
2570                                  "Returning from provider.createSubscriptionRequest: %s",
2571                                  (const char*)pr.getName().getCString()));
2572                      
2573 dave.sudlik    1.99  //      Need to save ContentLanguage value into operation context of response
2574 kumpf          1.151 //      Do this before checking rc from provider to throw exception in case
2575 dave.sudlik    1.99  //      rc.msg is also localized.
2576                              CMPIStatus tmprc={CMPI_RC_OK,NULL};
2577 kumpf          1.151         CMPIData cldata =
2578 venkat.puvvada 1.108             eCtx.ft->getEntry (&eCtx, CMPIContentLanguage, &tmprc);
2579 dave.sudlik    1.99          if (tmprc.rc == CMPI_RC_OK)
2580                              {
2581                                  response->operationContext.set(
2582                                      ContentLanguageListContainer(
2583 venkat.puvvada 1.108                 ContentLanguageList(
2584                                      LanguageParser::parseContentLanguageHeader(
2585 s.kodali       1.137                 CMGetCharsPtr(cldata.value.string, NULL)))));
2586 dave.sudlik    1.99          }
2587                      
2588 venkat.puvvada 1.145         if (!filterActivated)
2589 marek          1.63          {
2590 marek          1.95              //  Removed the select expression from the cache
2591                                  WriteLock lock(rwSemSelxTab);
2592                                  if (--srec->count<=0)
2593                                  {
2594 venkat.puvvada 1.145                 selxTab.remove(sPath);
2595 marek          1.95                  delete _context;
2596                                      delete eSelx;
2597                                      delete srec;
2598                                  }
2599 venkat.puvvada 1.108             throw CIMException((CIMStatusCode)rc.rc,
2600 s.kodali       1.137                 rc.msg ? CMGetCharsPtr(rc.msg, NULL) : String::EMPTY);
2601 marek          1.63          }
2602                              else
2603                              {
2604                                  //
2605                                  //  Increment count of current subscriptions for this provider
2606                                  //
2607                                  if (ph.GetProvider ().testIfZeroAndIncrementSubscriptions ())
2608                                  {
2609                                      //
2610                                      //  If there were no current subscriptions before the increment,
2611                                      //  the first subscription has been created
2612                                      //  Call the provider's enableIndications method
2613                                      //
2614                                      if (_subscriptionInitComplete)
2615                                      {
2616                                          _callEnableIndications (req_provider, _indicationCallback,
2617 marek          1.124                         ph, (const char*)pidc.getRemoteInfo().getCString());
2618 marek          1.63                  }
2619                                  }
2620                              }
2621                          }
2622                          HandlerCatch(handler);
2623                      
2624                          PEG_METHOD_EXIT();
2625                      
2626                          return(response);
2627                      }
2628                      
2629 venkat.puvvada 1.108 Message * CMPIProviderManager::handleDeleteSubscriptionRequest(
2630                          const Message * message)
2631 marek          1.63  {
2632 ms.aruran      1.115     PEG_METHOD_ENTER(
2633                              TRC_PROVIDERMANAGER,
2634                              "CMPIProviderManager::handleDeleteSubscriptionRequest()");
2635 marek          1.63  
2636                          HandlerIntroInd(DeleteSubscription,message,request,response,
2637 venkat.puvvada 1.108         handler);
2638                          try
2639                          {
2640 marek          1.63          String providerName,providerLocation;
2641                      
2642                              CIMInstance req_provider, req_providerModule;
2643 kumpf          1.151         ProviderIdContainer pidc =
2644 venkat.puvvada 1.108             (ProviderIdContainer)request->operationContext.get(
2645                                  ProviderIdContainer::NAME);
2646 marek          1.63          req_provider = pidc.getProvider();
2647                              req_providerModule = pidc.getModule();
2648                      
2649                              LocateIndicationProviderNames(req_provider, req_providerModule,
2650 venkat.puvvada 1.108             providerName,providerLocation);
2651 marek          1.63  
2652 thilo.boehm    1.138         PEG_TRACE((TRC_PROVIDERMANAGER,Tracer::LEVEL3,
2653 marek          1.129             "CMPIProviderManager::handleDeleteSubscriptionRequest"
2654                                  " - Host name: %s  Name space: %s  Provider name(s): %s",
2655                                  (const char*) System::getHostName().getCString(),
2656                                  (const char*) request->nameSpace.getString().getCString(),
2657                                  (const char*) providerName.getCString()));
2658 marek          1.63  
2659                              Boolean remote=false;
2660 venkat.puvvada 1.132         OpProviderHolder ph;
2661 marek          1.63  
2662 venkat.puvvada 1.108         if ((remote=pidc.isRemoteNameSpace()))
2663                              {
2664                                  ph = providerManager.getRemoteProvider(
2665                                      providerLocation, providerName);
2666 marek          1.63          }
2667 venkat.puvvada 1.108         else
2668                              {
2669                                  // get cached or load new provider module
2670                                  ph = providerManager.getProvider(
2671                                      providerLocation, providerName);
2672 marek          1.63          }
2673                      
2674                      
2675                              indProvRecord *prec=NULL;
2676 marek          1.95          {
2677                                  WriteLock writeLock(rwSemProvTab);
2678 venkat.puvvada 1.108             provTab.lookup(ph.GetProvider().getName(),prec);
2679                                  if (--prec->count<=0)
2680                                  {
2681                                      if (prec->handler)
2682                                          delete prec->handler;
2683                                      delete prec;
2684                                      provTab.remove(ph.GetProvider().getName());
2685                                      prec=NULL;
2686                                  }
2687 marek          1.95          }
2688 marek          1.63  
2689                              indSelectRecord *srec=NULL;
2690 venkat.puvvada 1.145         const CIMObjectPath &sPath=request->subscriptionInstance.getPath();
2691 r.kieninger    1.81  
2692 marek          1.95          WriteLock writeLock(rwSemSelxTab);
2693 venkat.puvvada 1.145         if (!selxTab.lookup(sPath,srec))
2694 venkat.puvvada 1.108         {
2695 dave.sudlik    1.117             MessageLoaderParms parms(
2696                                      "ProviderManager.CMPI.CMPIProviderManager."
2697                                      "FAILED_LOCATE_SUBSCRIPTION_FILTER",
2698                                      "Failed to locate the subscription filter.");
2699 venkat.puvvada 1.108             // failed to get select expression from hash table
2700 dave.sudlik    1.117             throw CIMException(CIM_ERR_FAILED, parms);
2701 venkat.puvvada 1.108         };
2702 marek          1.63  
2703                              CMPI_SelectExp *eSelx=srec->eSelx;
2704 venkat.puvvada 1.108         CIMOMHandleQueryContext *qContext=srec->qContext;
2705 marek          1.63  
2706 venkat.puvvada 1.145         CString className = eSelx->classNames[0].getClassName().
2707                                  getString().getCString();
2708                      
2709 marek          1.95          if (--srec->count<=0)
2710                              {
2711 venkat.puvvada 1.145             selxTab.remove(sPath);
2712 marek          1.95          }
2713 marek          1.63  
2714                              // convert arguments
2715                              OperationContext context;
2716                              context.insert(request->operationContext.get(IdentityContainer::NAME));
2717 venkat.puvvada 1.108         context.insert(
2718                                  request->operationContext.get(AcceptLanguageListContainer::NAME));
2719                              context.insert(
2720                                  request->operationContext.get(ContentLanguageListContainer::NAME));
2721                              context.insert(
2722                                  request->operationContext.get(SubscriptionInstanceContainer::NAME));
2723 marek          1.63  
2724 kumpf          1.151         CIMObjectPath subscriptionName =
2725 venkat.puvvada 1.108             request->subscriptionInstance.getPath();
2726 marek          1.63  
2727                              CMPIProvider & pr=ph.GetProvider();
2728                      
2729                              CMPIStatus rc={CMPI_RC_OK,NULL};
2730                              CMPI_ContextOnStack eCtx(context);
2731 venkat.puvvada 1.132         CMPI_ThreadContext thr(pr.getBroker(),&eCtx);
2732 marek          1.63  
2733 marek          1.124         // includeQualifiers and includeClassOrigin not of interest for
2734                              // this type of request
2735                              _setupCMPIContexts(
2736 venkat.puvvada 1.108             &eCtx,
2737 marek          1.124             &context,
2738                                  &pidc,
2739                                  request->nameSpace.getString(),
2740                                  remote);
2741 marek          1.63  
2742                              CMPIProvider::pm_service_op_lock op_lock(&pr);
2743                      
2744 thilo.boehm    1.143         PEG_TRACE((
2745                                  TRC_PROVIDERMANAGER,
2746                                  Tracer::LEVEL2,
2747                                  "Calling provider.deleteSubscriptionRequest: %s",
2748                                  (const char*)pr.getName().getCString()));
2749                      
2750 kumpf          1.92          {
2751 thilo.boehm    1.144             AutoPThreadSecurity threadLevelSecurity(request->operationContext);
2752                      
2753 kumpf          1.92              StatProviderTimeMeasurement providerTime(response);
2754                      
2755 venkat.puvvada 1.145             Array<CIMObjectPath> subClassPaths = eSelx->classNames;
2756                                  // Call deactivateFilter() for each subclass name those were
2757                                  // activated previously using activateFilter().
2758                                  // Note: Start from Index 1, first name is actual class name in
2759                                  // the FROM clause of filter query.
2760                                  for (Uint32 i = 1, n = eSelx->classNames.size(); i < n ; ++i)
2761                                  {
2762                                      CMPI_ObjectPathOnStack eRef(eSelx->classNames[i]);
2763                                      if (pr.getIndMI()->ft->ftVersion >= 100)
2764                                      {
2765                                          rc = pr.getIndMI()->ft->deActivateFilter(
2766                                              pr.getIndMI(),
2767                                              &eCtx,
2768                                              eSelx,
2769                                              CHARS(className),
2770                                              &eRef,
2771                                              prec==NULL);
2772                                      }
2773                                      else
2774                                      {
2775                                          // Older version of (pre 1.00) also pass in a CMPIResult
2776 marek          1.63  
2777 venkat.puvvada 1.145                     rc = ((CMPIStatus (*)(
2778                                              CMPIIndicationMI*,
2779                                              CMPIContext*,
2780                                              CMPIResult*,
2781                                              CMPISelectExp*,
2782 kumpf          1.151                         const char *,
2783 venkat.puvvada 1.145                         CMPIObjectPath*,
2784                                              CMPIBoolean)) pr.getIndMI()->ft->deActivateFilter)(
2785                                                  pr.getIndMI(),
2786                                                  &eCtx,
2787                                                  NULL,
2788                                                  eSelx,
2789                                                  CHARS(className),
2790                                                  &eRef,
2791                                                  prec==NULL);
2792                                      }
2793                                      if (rc.rc != CMPI_RC_OK)
2794                                      {
2795                                          PEG_TRACE((
2796                                              TRC_PROVIDERMANAGER,
2797                                              Tracer::LEVEL2,
2798                                              "deactivateFilter() for class %s in namespace %s"
2799                                                  "failed. Error : %s",
2800                                              CHARS(eSelx->classNames[i].getClassName().
2801                                                  getString().getCString()),
2802                                              CHARS(request->nameSpace.getString().getCString()),
2803                                              rc.msg ? CMGetCharsPtr(rc.msg, NULL) : "Unknown"));
2804 venkat.puvvada 1.145                 }
2805 kumpf          1.92              }
2806                              }
2807 marek          1.63  
2808 thilo.boehm    1.143         PEG_TRACE((
2809                                  TRC_PROVIDERMANAGER,
2810                                  Tracer::LEVEL2,
2811                                  "Returning from provider.deleteSubscriptionRequest: %s",
2812                                  (const char*)pr.getName().getCString()));
2813                      
2814 marek          1.95          if (srec->count<=0)
2815                              {
2816 venkat.puvvada 1.108             delete qContext;
2817                                  delete eSelx;
2818                                  delete srec;
2819 marek          1.95          }
2820 marek          1.63  
2821 dave.sudlik    1.99  //      Need to save ContentLanguage value into operation context of response
2822 kumpf          1.151 //      Do this before checking rc from provider to throw exception in case
2823 dave.sudlik    1.99  //      rc.msg is also localized.
2824                              CMPIStatus tmprc={CMPI_RC_OK,NULL};
2825 kumpf          1.151         CMPIData cldata =
2826 venkat.puvvada 1.108             eCtx.ft->getEntry (&eCtx, CMPIContentLanguage, &tmprc);
2827 dave.sudlik    1.99          if (tmprc.rc == CMPI_RC_OK)
2828                              {
2829                                  response->operationContext.set(
2830                                      ContentLanguageListContainer(
2831 venkat.puvvada 1.108                 ContentLanguageList(
2832                                      LanguageParser::parseContentLanguageHeader(
2833 s.kodali       1.137                 CMGetCharsPtr(cldata.value.string, NULL)))));
2834 dave.sudlik    1.99          }
2835                      
2836 marek          1.63          if (rc.rc!=CMPI_RC_OK)
2837                              {
2838 venkat.puvvada 1.108             throw CIMException((CIMStatusCode)rc.rc,
2839 s.kodali       1.137                 rc.msg ? CMGetCharsPtr(rc.msg, NULL) : String::EMPTY);
2840 marek          1.63          }
2841                              else
2842                              {
2843                                  //
2844                                  //  Decrement count of current subscriptions for this provider
2845                                  //
2846                                  if (ph.GetProvider ().decrementSubscriptionsAndTestIfZero ())
2847                                  {
2848                                      //
2849                                      //  If there are no current subscriptions after the decrement,
2850                                      //  the last subscription has been deleted
2851                                      //  Call the provider's disableIndications method
2852                                      //
2853                                      if (_subscriptionInitComplete)
2854                                      {
2855 marek          1.124                     _callDisableIndications(
2856                                              ph,
2857                                              (const char*)pidc.getRemoteInfo().getCString());
2858 marek          1.63                  }
2859                                  }
2860                              }
2861                          }
2862                          HandlerCatch(handler);
2863                      
2864                          PEG_METHOD_EXIT();
2865                      
2866                          return(response);
2867                      }
2868                      
2869 venkat.puvvada 1.108 Message * CMPIProviderManager::handleDisableModuleRequest(
2870                          const Message * message)
2871 marek          1.63  {
2872 ms.aruran      1.115     PEG_METHOD_ENTER(
2873                              TRC_PROVIDERMANAGER,
2874                              "CMPIProviderManager::handleDisableModuleRequest()");
2875 marek          1.63  
2876                          CIMDisableModuleRequestMessage * request =
2877 venkat.puvvada 1.108         dynamic_cast<CIMDisableModuleRequestMessage *>(
2878                              const_cast<Message *>(message));
2879 marek          1.63  
2880                          PEGASUS_ASSERT(request != 0);
2881                      
2882 venkat.puvvada 1.133     //Set to false when provider refused to unload due to pending operations.
2883                          Boolean disableModuleOk = true;
2884                      
2885 marek          1.63      // get provider module name
2886                          Boolean disableProviderOnly = request->disableProviderOnly;
2887                      
2888                          //
2889                          // Unload providers
2890                          //
2891                          Array<CIMInstance> _pInstances = request->providers;
2892                          Array <Boolean> _indicationProviders = request->indicationProviders;
2893 kumpf          1.151     /* The CIMInstances on request->providers array is completly _different_
2894 venkat.puvvada 1.108        than the request->providerModule CIMInstance. Hence  */
2895 marek          1.63  
2896 konrad.r       1.69      String physicalName=(request->providerModule.getProperty(
2897 venkat.puvvada 1.108         request->
2898                              providerModule.findProperty("Location")).getValue().toString());
2899 marek          1.63  
2900 venkat.puvvada 1.108     for (Uint32 i = 0, n = _pInstances.size(); i < n; i++)
2901 marek          1.63      {
2902                              String providerName;
2903 marek          1.139         _pInstances[i].getProperty(_pInstances [i].findProperty
2904                                  (PEGASUS_PROPERTYNAME_NAME)).getValue().get(providerName);
2905 marek          1.63  
2906 marek          1.139         Uint32 pos = _pInstances[i].findProperty(PEGASUS_PROPERTYNAME_NAME);
2907 marek          1.63  
2908 venkat.puvvada 1.128         if (!providerManager.isProviderActive(providerName))
2909                              {
2910                                  continue;
2911 venkat.puvvada 1.133         }
2912 kumpf          1.151 
2913 venkat.puvvada 1.133         Boolean unloadOk = providerManager.unloadProvider(
2914 kumpf          1.151             physicalName,
2915 venkat.puvvada 1.133             _pInstances[i].getProperty(
2916 marek          1.139                 _pInstances[i].findProperty(PEGASUS_PROPERTYNAME_NAME)
2917 venkat.puvvada 1.133                 ).getValue ().toString ());
2918                      
2919                              if (!unloadOk)
2920                              {
2921                                  disableModuleOk = false;
2922                                  continue;
2923                              }
2924 marek          1.63          //
2925                              //  Reset the indication provider's count of current
2926                              //  subscriptions since it has been disabled
2927                              //
2928                              if (_indicationProviders [i])
2929                              {
2930                                  if (physicalName.size () > 0)
2931                                  {
2932 venkat.puvvada 1.108                 try
2933                                      {
2934 kumpf          1.151                     OpProviderHolder ph =
2935 venkat.puvvada 1.108                         providerManager.getProvider(
2936 kumpf          1.151                         physicalName,
2937 venkat.puvvada 1.108                         providerName);
2938                                          ph.GetProvider ().resetSubscriptions ();
2939                                      }
2940                                      catch (const Exception &e)
2941                                      {
2942 thilo.boehm    1.138                     PEG_TRACE((TRC_PROVIDERMANAGER, Tracer::LEVEL1,
2943                                              "Exception during reset subscriptions on indication "
2944 kumpf          1.151                         "provider %s: %s",
2945 thilo.boehm    1.138                         (const char*)providerName.getCString(),
2946                                              (const char*)e.getMessage().getCString()));
2947 venkat.puvvada 1.108                 }
2948 marek          1.63              }
2949                              }
2950                          }
2951                      
2952 kumpf          1.123     CIMDisableModuleResponseMessage* response =
2953                              dynamic_cast<CIMDisableModuleResponseMessage*>(
2954                                  request->buildResponse());
2955 marek          1.63      PEGASUS_ASSERT(response != 0);
2956 venkat.puvvada 1.133 
2957                          if (disableModuleOk)
2958                          {
2959                              response->operationalStatus.append(
2960                                  CIM_MSE_OPSTATUS_VALUE_STOPPED);
2961                          }
2962                          else
2963                          {
2964                              response->operationalStatus.append(
2965                                  CIM_MSE_OPSTATUS_VALUE_OK);
2966                          }
2967 marek          1.63  
2968                          PEG_METHOD_EXIT();
2969                      
2970                          return(response);
2971                      }
2972                      
2973 venkat.puvvada 1.108 Message * CMPIProviderManager::handleEnableModuleRequest(
2974                          const Message * message)
2975 marek          1.63  {
2976 ms.aruran      1.115     PEG_METHOD_ENTER(
2977                              TRC_PROVIDERMANAGER,
2978                              "CMPIProviderManager::handleEnableModuleRequest()");
2979 marek          1.63  
2980                          CIMEnableModuleRequestMessage * request =
2981 venkat.puvvada 1.108         dynamic_cast<CIMEnableModuleRequestMessage *>(
2982                              const_cast<Message *>(message));
2983 marek          1.63  
2984                          PEGASUS_ASSERT(request != 0);
2985                      
2986                          Array<Uint16> operationalStatus;
2987                          operationalStatus.append(CIM_MSE_OPSTATUS_VALUE_OK);
2988                      
2989 kumpf          1.123     CIMEnableModuleResponseMessage* response =
2990                              dynamic_cast<CIMEnableModuleResponseMessage*>(
2991                                  request->buildResponse());
2992 marek          1.63      PEGASUS_ASSERT(response != 0);
2993 kumpf          1.123     response->operationalStatus = operationalStatus;
2994 marek          1.63  
2995                          PEG_METHOD_EXIT();
2996                      
2997                          return(response);
2998                      }
2999                      
3000 venkat.puvvada 1.108 Message * CMPIProviderManager::handleStopAllProvidersRequest(
3001                          const Message * message)
3002 marek          1.63  {
3003 ms.aruran      1.115     PEG_METHOD_ENTER(
3004                              TRC_PROVIDERMANAGER,
3005                              "CMPIProviderManager::handleStopAllProvidersRequest()");
3006 marek          1.63  
3007                          CIMStopAllProvidersRequestMessage * request =
3008 venkat.puvvada 1.108         dynamic_cast<CIMStopAllProvidersRequestMessage *>(
3009                              const_cast<Message *>(message));
3010 marek          1.63  
3011                          PEGASUS_ASSERT(request != 0);
3012                      
3013 kumpf          1.123     CIMStopAllProvidersResponseMessage* response =
3014                              dynamic_cast<CIMStopAllProvidersResponseMessage*>(
3015                                  request->buildResponse());
3016 marek          1.63      PEGASUS_ASSERT(response != 0);
3017                      
3018                          // tell the provider manager to shutdown all the providers
3019                          providerManager.shutdownAllProviders();
3020                      
3021                          PEG_METHOD_EXIT();
3022                      
3023                          return(response);
3024                      }
3025                      
3026 venkat.puvvada 1.108 Message * CMPIProviderManager::handleSubscriptionInitCompleteRequest(
3027                          const Message * message)
3028 marek          1.63  {
3029 ms.aruran      1.115     PEG_METHOD_ENTER(
3030                              TRC_PROVIDERMANAGER,
3031                              "CMPIProviderManager::handleSubscriptionInitCompleteRequest()");
3032 marek          1.63  
3033                          CIMSubscriptionInitCompleteRequestMessage * request =
3034                              dynamic_cast <CIMSubscriptionInitCompleteRequestMessage *>
3035 venkat.puvvada 1.108         (const_cast <Message *> (message));
3036 marek          1.63  
3037                          PEGASUS_ASSERT (request != 0);
3038                      
3039                          CIMSubscriptionInitCompleteResponseMessage * response =
3040                              dynamic_cast <CIMSubscriptionInitCompleteResponseMessage *>
3041 venkat.puvvada 1.108         (request->buildResponse ());
3042 marek          1.63  
3043                          PEGASUS_ASSERT (response != 0);
3044                      
3045                          //
3046                          //  Set indicator
3047                          //
3048                          _subscriptionInitComplete = true;
3049                      
3050                          //
3051                          //  For each provider that has at least one subscription, call
3052                          //  provider's enableIndications method
3053                          //
3054                          Array <CMPIProvider *> enableProviders;
3055                          enableProviders = providerManager.getIndicationProvidersToEnable ();
3056                      
3057                          Uint32 numProviders = enableProviders.size ();
3058                          for (Uint32 i = 0; i < numProviders; i++)
3059                          {
3060                              try
3061                              {
3062                                  CIMInstance provider;
3063 marek          1.63              provider = enableProviders [i]->getProviderInstance ();
3064                      
3065 venkat.puvvada 1.110             CString info;
3066                      #ifdef PEGASUS_ENABLE_REMOTE_CMPI
3067                                  indProvRecord *provRec = 0;
3068                                  if (provTab.lookup (enableProviders [i]->getName(), provRec))
3069                                  {
3070                                      if (provRec->remoteInfo != String::EMPTY)
3071                                      {
3072                                          info = provRec->remoteInfo.getCString();
3073                                      }
3074                                  }
3075                      #endif
3076 marek          1.63              //
3077                                  //  Get cached or load new provider module
3078                                  //
3079 venkat.puvvada 1.132             OpProviderHolder ph;
3080 venkat.puvvada 1.110             if ((const char*)info)
3081                                  {
3082                                      ph = providerManager.getRemoteProvider
3083                                          (enableProviders [i]->getModule ()->getFileName (),
3084                                          enableProviders [i]->getName ());
3085                                  }
3086                                  else
3087                                  {
3088                                      ph = providerManager.getProvider
3089                                          (enableProviders [i]->getModule ()->getFileName (),
3090                                          enableProviders [i]->getName ());
3091                                  }
3092 venkat.puvvada 1.108             _callEnableIndications(
3093 kumpf          1.151                 provider,
3094                                      _indicationCallback,
3095                                      ph,
3096 venkat.puvvada 1.108                 (const char*)info);
3097 marek          1.63          }
3098 konrad.r       1.64          catch (const CIMException & e)
3099 marek          1.63          {
3100 thilo.boehm    1.138             PEG_TRACE((TRC_PROVIDERMANAGER,Tracer::LEVEL1,
3101                                      "CIMException: %s",(const char*)e.getMessage().getCString()));
3102 marek          1.63          }
3103 konrad.r       1.64          catch (const Exception & e)
3104 marek          1.63          {
3105 thilo.boehm    1.138             PEG_TRACE((TRC_PROVIDERMANAGER,Tracer::LEVEL1,
3106                                      "Exception: %s",(const char*)e.getMessage().getCString()));
3107 marek          1.63          }
3108 venkat.puvvada 1.108         catch (...)
3109 marek          1.63          {
3110 ms.aruran      1.115             PEG_TRACE_CSTRING(
3111                                      TRC_PROVIDERMANAGER,
3112 marek          1.131                 Tracer::LEVEL1,
3113 marek          1.63                  "Unknown error in handleSubscriptionInitCompleteRequest");
3114                              }
3115                          }
3116                      
3117                          PEG_METHOD_EXIT ();
3118 venkat.puvvada 1.108     return(response);
3119 marek          1.63  }
3120                      
3121 venkat.puvvada 1.108 Message * CMPIProviderManager::handleGetPropertyRequest(
3122                          const Message * message)
3123 dave.sudlik    1.98  {
3124 ms.aruran      1.115     PEG_METHOD_ENTER(
3125                              TRC_PROVIDERMANAGER,
3126                              "CMPIProviderManager::handleGetPropertyRequest()");
3127 dave.sudlik    1.98  
3128                          HandlerIntro(GetProperty,message,request,response,handler);
3129                      
3130                          // We're only going to be interested in the specific property from this
3131                          // instance.
3132                          Array<CIMName> localPropertyListArray;
3133                          localPropertyListArray.append(request->propertyName);
3134                          CIMPropertyList localPropertyList(localPropertyListArray);
3135                      
3136                          // NOTE: GetProperty will use the CIMInstanceProvider interface, so we
3137 kumpf          1.151     // must manually define a request, response, and handler (emulate
3138 dave.sudlik    1.98      // HandlerIntro macro)
3139 kumpf          1.151     CIMGetInstanceRequestMessage * GI_request =
3140 dave.sudlik    1.98          new CIMGetInstanceRequestMessage(
3141 kumpf          1.151         request->messageId,
3142 venkat.puvvada 1.108         request->nameSpace,
3143                              request->instanceName,
3144                              false,
3145                              false,
3146                              localPropertyList,
3147                              request->queueIds,
3148                              request->authType,
3149                              request->userName
3150                              );
3151 dave.sudlik    1.98  
3152 kumpf          1.151     PEGASUS_ASSERT(GI_request != 0);
3153 dave.sudlik    1.98  
3154 kumpf          1.151     CIMGetInstanceResponseMessage * GI_response =
3155 venkat.puvvada 1.108         dynamic_cast<CIMGetInstanceResponseMessage*>
3156                              (GI_request->buildResponse());
3157 dave.sudlik    1.98  
3158 kumpf          1.151     PEGASUS_ASSERT(GI_response != 0);
3159 dave.sudlik    1.98  
3160 venkat.puvvada 1.108     GetInstanceResponseHandler GI_handler(
3161 kumpf          1.151         GI_request,
3162                              GI_response,
3163 venkat.puvvada 1.108         _responseChunkCallback);
3164 dave.sudlik    1.98  
3165 venkat.puvvada 1.108     try
3166 dave.sudlik    1.98      {
3167 thilo.boehm    1.138         PEG_TRACE((TRC_PROVIDERMANAGER,Tracer::LEVEL3,
3168 marek          1.129             "CMPIProviderManager::handleGetPropertyRequest"
3169                                  " - Host name: %s  Name space: %s  "
3170                                      "Class name: %s  Property name: %s",
3171                                  (const char*) System::getHostName().getCString(),
3172                                  (const char*) request->nameSpace.getString().getCString(),
3173                                  (const char*)
3174                                      request->instanceName.getClassName().getString().getCString(),
3175                                  (const char*) request->propertyName.getString().getCString()));
3176 kumpf          1.151 
3177 dave.sudlik    1.98          // make target object path
3178                              CIMObjectPath objectPath(
3179                                  System::getHostName(),
3180                                  request->nameSpace,
3181                                  request->instanceName.getClassName(),
3182                                  request->instanceName.getKeyBindings());
3183                      
3184                              Boolean remote=false;
3185 venkat.puvvada 1.132         OpProviderHolder ph;
3186 dave.sudlik    1.98  
3187                              // resolve provider name
3188 kumpf          1.151         ProviderIdContainer pidc =
3189 venkat.puvvada 1.108             request->operationContext.get(ProviderIdContainer::NAME);
3190 dave.sudlik    1.98          ProviderName name = _resolveProviderName(pidc);
3191                      
3192 venkat.puvvada 1.108         if ((remote=pidc.isRemoteNameSpace()))
3193                              {
3194                                  ph = providerManager.getRemoteProvider(
3195                                      name.getLocation(), name.getLogicalName());
3196 dave.sudlik    1.98          }
3197 venkat.puvvada 1.108         else
3198                              {
3199                                  // get cached or load new provider module
3200                                  ph = providerManager.getProvider(
3201                                      name.getPhysicalName(), name.getLogicalName());
3202 dave.sudlik    1.98          }
3203                      
3204                              // convert arguments
3205                              OperationContext context;
3206                      
3207                              context.insert(request->operationContext.get(IdentityContainer::NAME));
3208 venkat.puvvada 1.108         context.insert(
3209                                  request->operationContext.get(AcceptLanguageListContainer::NAME));
3210                              context.insert(
3211                                  request->operationContext.get(ContentLanguageListContainer::NAME));
3212 dave.sudlik    1.98          // forward request
3213                              CMPIProvider & pr=ph.GetProvider();
3214                      
3215 venkat.puvvada 1.121         AutoPtr<NormalizerContext> tmpNormalizerContext(
3216 venkat.puvvada 1.132             new CIMOMHandleContext(*pr.getCIMOMHandle()));
3217 venkat.puvvada 1.121         request->operationContext.insert(
3218                                  NormalizerContextContainer(tmpNormalizerContext));
3219 dave.sudlik    1.98  
3220                              CMPIStatus rc={CMPI_RC_OK,NULL};
3221                              CMPI_ContextOnStack eCtx(context);
3222                              CMPI_ObjectPathOnStack eRef(objectPath);
3223 venkat.puvvada 1.132         CMPI_ResultOnStack eRes(GI_handler,pr.getBroker());
3224                              CMPI_ThreadContext thr(pr.getBroker(),&eCtx);
3225 dave.sudlik    1.98  
3226 kumpf          1.151         // For the getInstance provider call, use the property list that we
3227 dave.sudlik    1.98          // created containing the single property from the getProperty call.
3228                              CMPIPropertyList props(localPropertyList);
3229                      
3230 kumpf          1.151         // Leave includeQualifiers and includeClassOrigin as false for this
3231 venkat.puvvada 1.108         // call to getInstance
3232 marek          1.124         _setupCMPIContexts(
3233 venkat.puvvada 1.108             &eCtx,
3234 marek          1.124             &context,
3235                                  &pidc,
3236                                  request->nameSpace.getString(),
3237                                  remote,
3238                                  false,
3239                                  false,
3240                                  true);
3241 dave.sudlik    1.98  
3242                              CMPIProvider::pm_service_op_lock op_lock(&pr);
3243                      
3244 thilo.boehm    1.143         PEG_TRACE((
3245                                  TRC_PROVIDERMANAGER,
3246                                  Tracer::LEVEL2,
3247                                  "Calling provider.getInstance via getProperty: %s",
3248                                  (const char*)pr.getName().getCString()));
3249                      
3250 dave.sudlik    1.98          {
3251 thilo.boehm    1.144             AutoPThreadSecurity threadLevelSecurity(request->operationContext);
3252                      
3253 dave.sudlik    1.98              StatProviderTimeMeasurement providerTime(response);
3254                      
3255 venkat.puvvada 1.132             rc = pr.getInstMI()->ft->getInstance(
3256                                      pr.getInstMI(),
3257                                      &eCtx,
3258                                      &eRes,
3259                                      &eRef,
3260 dave.sudlik    1.98                  (const char **)props.getList());
3261                              }
3262                      
3263 thilo.boehm    1.143         PEG_TRACE((
3264                                  TRC_PROVIDERMANAGER,
3265                                  Tracer::LEVEL2,
3266                                  "Returning from provider.getInstance via getProperty: %s",
3267                                  (const char*)pr.getName().getCString()));
3268                      
3269 dave.sudlik    1.99  //      Need to save ContentLanguage value into operation context of response
3270 kumpf          1.151 //      Do this before checking rc from provider to throw exception in case
3271 dave.sudlik    1.99  //      rc.msg is also localized.
3272                              CMPIStatus tmprc={CMPI_RC_OK,NULL};
3273 kumpf          1.151         CMPIData cldata =
3274 venkat.puvvada 1.108             eCtx.ft->getEntry (&eCtx, CMPIContentLanguage, &tmprc);
3275 dave.sudlik    1.99          if (tmprc.rc == CMPI_RC_OK)
3276                              {
3277                                  response->operationContext.set(
3278                                      ContentLanguageListContainer(
3279 venkat.puvvada 1.108                 ContentLanguageList(
3280                                      LanguageParser::parseContentLanguageHeader(
3281 s.kodali       1.137                 CMGetCharsPtr(cldata.value.string, NULL)))));
3282 dave.sudlik    1.103             handler.setContext(response->operationContext);
3283 dave.sudlik    1.99          }
3284                      
3285 dave.sudlik    1.98          if (rc.rc!=CMPI_RC_OK)
3286 dave.sudlik    1.102         {
3287 venkat.puvvada 1.108             CIMException cimException(
3288                                      (CIMStatusCode)rc.rc,
3289 s.kodali       1.137                 rc.msg ? CMGetCharsPtr(rc.msg, NULL) : String::EMPTY);
3290 venkat.puvvada 1.108 
3291                                  if (eRes.resError)
3292                                  {
3293 kumpf          1.151                 for (CMPI_Error* currErr=eRes.resError;
3294                                          currErr!=NULL;
3295 dave.sudlik    1.102                     currErr=currErr->nextError)
3296 venkat.puvvada 1.108                 {
3297                                          cimException.addError(
3298                                              ((CIMError*)currErr->hdl)->getInstance());
3299                                      }
3300                                  }
3301                                  throw cimException;
3302 dave.sudlik    1.102         }
3303 dave.sudlik    1.98  
3304                              // Copy property value from instance to getProperty response
3305 mike           1.147         if (!(GI_response->getCimInstance().isUninitialized()))
3306 dave.sudlik    1.98          {
3307 mike           1.147             Uint32 pos = GI_response->getCimInstance().findProperty(
3308                                      request->propertyName);
3309 dave.sudlik    1.98  
3310 venkat.puvvada 1.108             if (pos != PEG_NOT_FOUND)
3311 dave.sudlik    1.98              {
3312 kumpf          1.151                 response->value =
3313 mike           1.147                     GI_response->getCimInstance().getProperty(pos).getValue();
3314 dave.sudlik    1.98              }
3315                                  // Else property not found. Return CIM_ERR_NO_SUCH_PROPERTY.
3316                                  else
3317                                  {
3318                                      throw PEGASUS_CIM_EXCEPTION(
3319                                          CIM_ERR_NO_SUCH_PROPERTY,
3320                                          request->propertyName.getString()
3321                                          );
3322                                  }
3323                              }
3324                          }
3325                          HandlerCatch(handler);
3326                      
3327                          delete GI_request;
3328                          delete GI_response;
3329                      
3330                          PEG_METHOD_EXIT();
3331                      
3332                          return(response);
3333                      }
3334                      
3335 venkat.puvvada 1.108 Message * CMPIProviderManager::handleSetPropertyRequest(
3336                          const Message * message)
3337 dave.sudlik    1.98  {
3338 ms.aruran      1.115     PEG_METHOD_ENTER(
3339                              TRC_PROVIDERMANAGER,
3340                              "CMPIProviderManager::handleSetPropertyRequest()");
3341 dave.sudlik    1.98  
3342                          HandlerIntro(SetProperty,message,request,response,handler);
3343                      
3344 kumpf          1.151     // We're only going to be interested in the specific property from this
3345 venkat.puvvada 1.108     // instance.
3346 dave.sudlik    1.98      Array<CIMName> localPropertyListArray;
3347                          localPropertyListArray.append(request->propertyName);
3348                          CIMPropertyList localPropertyList(localPropertyListArray);
3349                      
3350 kumpf          1.151     // Build a modified instance with just the specific property and its
3351 venkat.puvvada 1.108     // new value.
3352 dave.sudlik    1.98      CIMInstance localModifiedInstance(request->instanceName.getClassName());
3353                          localModifiedInstance.setPath(request->instanceName);
3354 venkat.puvvada 1.108     localModifiedInstance.addProperty(
3355                              CIMProperty(request->propertyName, request->newValue));
3356 dave.sudlik    1.98  
3357 venkat.puvvada 1.108     // NOTE: SetProperty will use the CIMInstanceProvider interface, so we must
3358                          // manually define a request, response, and handler.
3359 kumpf          1.151     CIMModifyInstanceRequestMessage * MI_request =
3360 dave.sudlik    1.98          new CIMModifyInstanceRequestMessage(
3361 kumpf          1.151         request->messageId,
3362 venkat.puvvada 1.108         request->nameSpace,
3363                              localModifiedInstance,
3364                              false,
3365                              localPropertyList,
3366                              request->queueIds,
3367                              request->authType,
3368                              request->userName
3369                              );
3370 dave.sudlik    1.98  
3371 kumpf          1.151     PEGASUS_ASSERT(MI_request != 0);
3372 dave.sudlik    1.98  
3373 kumpf          1.151     CIMModifyInstanceResponseMessage * MI_response =
3374 venkat.puvvada 1.108         dynamic_cast<CIMModifyInstanceResponseMessage*>(
3375                              MI_request->buildResponse());
3376 dave.sudlik    1.98  
3377 kumpf          1.151     PEGASUS_ASSERT(MI_response != 0);
3378 dave.sudlik    1.98  
3379 venkat.puvvada 1.108     ModifyInstanceResponseHandler MI_handler(
3380 kumpf          1.151         MI_request,
3381                              MI_response,
3382 venkat.puvvada 1.108         _responseChunkCallback);
3383 dave.sudlik    1.98  
3384 venkat.puvvada 1.108     try
3385 dave.sudlik    1.98      {
3386 thilo.boehm    1.138         PEG_TRACE((TRC_PROVIDERMANAGER,Tracer::LEVEL3,
3387 marek          1.129             "CMPIProviderManager::handleSetPropertyRequest"
3388                                  " - Host name: %s  Name space: %s  "
3389                                      "Class name: %s  Property name: %s",
3390                                  (const char*) System::getHostName().getCString(),
3391                                  (const char*) request->nameSpace.getString().getCString(),
3392                                  (const char*)
3393                                      request->instanceName.getClassName().getString().getCString(),
3394                                  (const char*) request->propertyName.getString().getCString()));
3395 kumpf          1.151 
3396 dave.sudlik    1.98          // make target object path
3397                              CIMObjectPath objectPath(
3398                                  System::getHostName(),
3399                                  request->nameSpace,
3400                                  request->instanceName.getClassName(),
3401                                  request->instanceName.getKeyBindings());
3402                      
3403                              Boolean remote=false;
3404 venkat.puvvada 1.132         OpProviderHolder ph;
3405 dave.sudlik    1.98  
3406                              // resolve provider name
3407 kumpf          1.151         ProviderIdContainer pidc =
3408 venkat.puvvada 1.108             request->operationContext.get(ProviderIdContainer::NAME);
3409 dave.sudlik    1.98          ProviderName name = _resolveProviderName(pidc);
3410                      
3411 venkat.puvvada 1.108         if ((remote=pidc.isRemoteNameSpace()))
3412                              {
3413                                  ph = providerManager.getRemoteProvider(
3414                                      name.getLocation(), name.getLogicalName());
3415 dave.sudlik    1.98          }
3416 venkat.puvvada 1.108         else
3417                              {
3418                                  // get cached or load new provider module
3419                                  ph = providerManager.getProvider(
3420                                      name.getPhysicalName(), name.getLogicalName());
3421 dave.sudlik    1.98          }
3422                      
3423                              // convert arguments
3424                              OperationContext context;
3425                      
3426                              context.insert(request->operationContext.get(IdentityContainer::NAME));
3427 venkat.puvvada 1.108         context.insert(
3428                                  request->operationContext.get(AcceptLanguageListContainer::NAME));
3429                              context.insert(
3430                                  request->operationContext.get(ContentLanguageListContainer::NAME));
3431 dave.sudlik    1.98          // forward request
3432                              CMPIProvider & pr=ph.GetProvider();
3433                      
3434                              CMPIStatus rc={CMPI_RC_OK,NULL};
3435                              CMPI_ContextOnStack eCtx(context);
3436                              CMPI_ObjectPathOnStack eRef(objectPath);
3437 venkat.puvvada 1.132         CMPI_ResultOnStack eRes(MI_handler,pr.getBroker());
3438 dave.sudlik    1.98          CMPI_InstanceOnStack eInst(localModifiedInstance);
3439 venkat.puvvada 1.132         CMPI_ThreadContext thr(pr.getBroker(),&eCtx);
3440 dave.sudlik    1.98  
3441                              CMPIPropertyList props(localPropertyList);
3442                      
3443                              // Leave includeQualifiers as false for this call to modifyInstance
3444 marek          1.124         _setupCMPIContexts(
3445 venkat.puvvada 1.108             &eCtx,
3446 marek          1.124             &context,
3447                                  &pidc,
3448                                  request->nameSpace.getString(),
3449                                  remote,
3450                                  false,
3451                                  false,
3452                                  true);
3453 dave.sudlik    1.98  
3454                              CMPIProvider::pm_service_op_lock op_lock(&pr);
3455                      
3456 thilo.boehm    1.143         PEG_TRACE((
3457                                  TRC_PROVIDERMANAGER,
3458                                  Tracer::LEVEL2,
3459                                  "Calling provider.modifyInstance via setProperty: %s",
3460                                  (const char*)pr.getName().getCString()));
3461                      
3462 dave.sudlik    1.98          {
3463 thilo.boehm    1.144             AutoPThreadSecurity threadLevelSecurity(request->operationContext);
3464                      
3465 dave.sudlik    1.98              StatProviderTimeMeasurement providerTime(response);
3466                      
3467 venkat.puvvada 1.132             rc = pr.getInstMI()->ft->modifyInstance(
3468                                      pr.getInstMI(),
3469                                      &eCtx,
3470                                      &eRes,
3471                                      &eRef,
3472                                      &eInst,
3473 dave.sudlik    1.98                  (const char **)props.getList());
3474                              }
3475                      
3476 thilo.boehm    1.143         PEG_TRACE((
3477                                  TRC_PROVIDERMANAGER,
3478                                  Tracer::LEVEL2,
3479                                  "Returning from provider.modifyInstance via setProperty: %s",
3480                                  (const char*)pr.getName().getCString()));
3481                      
3482 dave.sudlik    1.99  //      Need to save ContentLanguage value into operation context of response
3483 kumpf          1.151 //      Do this before checking rc from provider to throw exception in case
3484 dave.sudlik    1.99  //      rc.msg is also localized.
3485                              CMPIStatus tmprc={CMPI_RC_OK,NULL};
3486 kumpf          1.151         CMPIData cldata =
3487 venkat.puvvada 1.108             eCtx.ft->getEntry (&eCtx, CMPIContentLanguage, &tmprc);
3488 dave.sudlik    1.99          if (tmprc.rc == CMPI_RC_OK)
3489                              {
3490                                  response->operationContext.set(
3491                                      ContentLanguageListContainer(
3492 venkat.puvvada 1.108                 ContentLanguageList(
3493                                      LanguageParser::parseContentLanguageHeader(
3494 s.kodali       1.137                 CMGetCharsPtr(cldata.value.string, NULL)))));
3495 dave.sudlik    1.103             handler.setContext(response->operationContext);
3496 dave.sudlik    1.99          }
3497                      
3498 dave.sudlik    1.98          if (rc.rc!=CMPI_RC_OK)
3499 dave.sudlik    1.102         {
3500 venkat.puvvada 1.108             CIMException cimException(
3501                                      (CIMStatusCode)rc.rc,
3502 s.kodali       1.137                 rc.msg ? CMGetCharsPtr(rc.msg, NULL) : String::EMPTY);
3503 venkat.puvvada 1.108 
3504                                  if (eRes.resError)
3505                                  {
3506 kumpf          1.151                 for (CMPI_Error* currErr=eRes.resError;
3507                                          currErr!=NULL;
3508 dave.sudlik    1.102                     currErr=currErr->nextError)
3509 venkat.puvvada 1.108                 {
3510                                          cimException.addError(
3511                                              ((CIMError*)currErr->hdl)->getInstance());
3512                                      }
3513                                  }
3514                                  throw cimException;
3515 dave.sudlik    1.102         }
3516 dave.sudlik    1.98      }
3517                          HandlerCatch(handler);
3518                      
3519                          delete MI_request;
3520                          delete MI_response;
3521                      
3522                          PEG_METHOD_EXIT();
3523                      
3524                          return(response);
3525                      }
3526                      
3527 venkat.puvvada 1.108 Message * CMPIProviderManager::handleUnsupportedRequest(
3528                          const Message * message)
3529 marek          1.63  {
3530 ms.aruran      1.115     PEG_METHOD_ENTER(
3531                              TRC_PROVIDERMANAGER,
3532                              "CMPIProviderManager::handleUnsupportedRequest()");
3533 marek          1.63      CIMRequestMessage* request =
3534                              dynamic_cast<CIMRequestMessage *>(const_cast<Message *>(message));
3535                          PEGASUS_ASSERT(request != 0 );
3536                      
3537                          CIMResponseMessage* response = request->buildResponse();
3538                          response->cimException =
3539                              PEGASUS_CIM_EXCEPTION(CIM_ERR_NOT_SUPPORTED, String::EMPTY);
3540                      
3541                          PEG_METHOD_EXIT();
3542                          return response;
3543                      }
3544                      
3545                      ProviderName CMPIProviderManager::_resolveProviderName(
3546                          const ProviderIdContainer & providerId)
3547                      {
3548                          String providerName;
3549                          String fileName;
3550                          String location;
3551 dmitry.mikulin 1.114     String moduleName;
3552 marek          1.63      CIMValue genericValue;
3553                      
3554 ms.aruran      1.115     PEG_METHOD_ENTER(
3555                              TRC_PROVIDERMANAGER,
3556                              "CMPIProviderManager::_resolveProviderName()");
3557                      
3558 dmitry.mikulin 1.114     genericValue = providerId.getModule().getProperty(
3559 marek          1.139         providerId.getModule().findProperty(
3560                                  PEGASUS_PROPERTYNAME_NAME)).getValue();
3561 dmitry.mikulin 1.114     genericValue.get(moduleName);
3562                      
3563 marek          1.63      genericValue = providerId.getProvider().getProperty(
3564 marek          1.139         providerId.getProvider().findProperty(
3565                                  PEGASUS_PROPERTYNAME_NAME)).getValue();
3566 marek          1.63      genericValue.get(providerName);
3567                      
3568                          genericValue = providerId.getModule().getProperty(
3569                              providerId.getModule().findProperty("Location")).getValue();
3570                          genericValue.get(location);
3571                          fileName = _resolvePhysicalName(location);
3572                      
3573 kumpf          1.151     // An empty file name is only for interest if we are in the
3574 thilo.boehm    1.89      // local name space. So the message is only issued if not
3575                          // in the remote Name Space.
3576                          if (fileName == String::EMPTY && (!providerId.isRemoteNameSpace()))
3577                          {
3578 venkat.puvvada 1.108         genericValue.get(location);
3579                              String fullName = FileSystem::buildLibraryFileName(location);
3580                              Logger::put_l(Logger::ERROR_LOG, System::CIMSERVER, Logger::SEVERE,
3581 kumpf          1.136             MessageLoaderParms(
3582                                      "ProviderManager.CMPI.CMPIProviderManager.CANNOT_FIND_LIBRARY",
3583 kumpf          1.151                 "For provider $0 library $1 was not found.",
3584 kumpf          1.136                 providerName, fullName));
3585 thilo.boehm    1.89  
3586                          }
3587 dmitry.mikulin 1.114     ProviderName name(moduleName, providerName, fileName);
3588 marek          1.63      name.setLocation(location);
3589 ms.aruran      1.115     PEG_METHOD_EXIT();
3590 marek          1.63      return name;
3591                      }
3592                      
3593                      void CMPIProviderManager::_callEnableIndications
3594                          (CIMInstance & req_provider,
3595 venkat.puvvada 1.108     PEGASUS_INDICATION_CALLBACK_T _indicationCallback,
3596 venkat.puvvada 1.132     OpProviderHolder & ph,
3597 venkat.puvvada 1.108     const char* remoteInfo)
3598 marek          1.63  {
3599 ms.aruran      1.115     PEG_METHOD_ENTER(
3600                              TRC_PROVIDERMANAGER,
3601                              "CMPIProviderManager::_callEnableIndications()");
3602 marek          1.63  
3603                          try
3604                          {
3605 w.otsuka       1.86          indProvRecord *provRec =0;
3606 marek          1.95          {
3607                                  WriteLock lock(rwSemProvTab);
3608                      
3609 venkat.puvvada 1.108             if (provTab.lookup (ph.GetProvider ().getName (), provRec))
3610                                  {
3611                                      provRec->enabled = true;
3612                                      CIMRequestMessage * request = 0;
3613                                      CIMResponseMessage * response = 0;
3614                                      provRec->handler=new EnableIndicationsResponseHandler(
3615                                          request,
3616                                          response,
3617                                          req_provider,
3618                                          _indicationCallback,
3619                                          _responseChunkCallback);
3620                                  }
3621 marek          1.95          }
3622 marek          1.63  
3623                              CMPIProvider & pr=ph.GetProvider();
3624                      
3625                              //
3626                              //  Versions prior to 86 did not include enableIndications routine
3627                              //
3628 venkat.puvvada 1.132         if (pr.getIndMI()->ft->ftVersion >= 86)
3629 marek          1.63          {
3630                                  OperationContext context;
3631 kumpf          1.112 #ifdef PEGASUS_ZOS_THREADLEVEL_SECURITY
3632 venkat.puvvada 1.108             // For the z/OS security model we always need an Identity container
3633 kumpf          1.151             // in the operation context. Since we don't have a client request
3634                                  // ID here we have to use the cim servers identity for the time
3635 venkat.puvvada 1.108             // being.
3636                                  IdentityContainer idContainer(System::getEffectiveUserName());
3637                                  context.insert(idContainer);
3638 kumpf          1.112 #endif
3639 marek          1.90  
3640 marek          1.63              CMPIStatus rc={CMPI_RC_OK,NULL};
3641                                  CMPI_ContextOnStack eCtx(context);
3642 venkat.puvvada 1.132             CMPI_ThreadContext thr(pr.getBroker(),&eCtx);
3643 marek          1.63  
3644 dave.sudlik    1.100             // Add RemoteInformation -V 5245
3645                                  if (remoteInfo)
3646                                  {
3647                                      eCtx.ft->addEntry(&eCtx,"CMPIRRemoteInfo",
3648 venkat.puvvada 1.108                     (CMPIValue*)(const char*)remoteInfo,CMPI_chars);
3649 dave.sudlik    1.100             }
3650                      
3651 thilo.boehm    1.143             PEG_TRACE((
3652                                      TRC_PROVIDERMANAGER,
3653                                      Tracer::LEVEL2,
3654 thilo.boehm    1.138                 "Calling provider.enableIndications: %s",
3655                                      (const char*)pr.getName().getCString()));
3656 marek          1.63  
3657 venkat.puvvada 1.111             pr.protect();
3658 marek          1.63  
3659 dave.sudlik    1.101             // enableIndications() is defined by the CMPI standard as
3660                                  // returning a CMPIStatus return value. Unfortunately, Pegasus
3661                                  // originally implemented enableIndications() with a void
3662 kumpf          1.151             // return type, and this incompatibility was not detected for
3663                                  // some time. Since exceptions thrown from enableIndications()
3664 dave.sudlik    1.101             // are not reported (other than via logging), it was decided to
3665                                  // discard the returned CMPIStatus here. This will prevent us from
3666                                  // breaking existing CMPI Indication providers. This is ok since
3667                                  // there really isn't a user to which the problem should be
3668                                  // reported.
3669 venkat.puvvada 1.132             pr.getIndMI()->ft->enableIndications(pr.getIndMI(),&eCtx);
3670 thilo.boehm    1.143 
3671                                  PEG_TRACE((
3672                                      TRC_PROVIDERMANAGER,
3673                                      Tracer::LEVEL2,
3674                                      "Returning from provider.enableIndications: %s",
3675                                      (const char*)pr.getName().getCString()));
3676                      
3677 marek          1.63          }
3678                              else
3679                              {
3680 thilo.boehm    1.143             PEG_TRACE((
3681                                      TRC_PROVIDERMANAGER,
3682                                      Tracer::LEVEL2,
3683 thilo.boehm    1.138                 "Not calling provider.enableIndications: %s routine as it is "
3684                                      "an earlier version that does not support this function",
3685                                       (const char*)pr.getName().getCString()));
3686 marek          1.63          }
3687                          }
3688 konrad.r       1.64      catch (const Exception & e)
3689 marek          1.63      {
3690 kumpf          1.136         Logger::put_l(Logger::ERROR_LOG, System::CIMSERVER, Logger::WARNING,
3691                                  MessageLoaderParms(
3692                                      "ProviderManager.CMPI.CMPIProviderManager."
3693                                          "ENABLE_INDICATIONS_FAILED",
3694                                      "Failed to enable indications for provider $0: $1.",
3695                                      ph.GetProvider().getName(), e.getMessage()));
3696 marek          1.63      }
3697 venkat.puvvada 1.108     catch (...)
3698 marek          1.63      {
3699 kumpf          1.136         Logger::put_l(Logger::ERROR_LOG, System::CIMSERVER, Logger::WARNING,
3700                                  MessageLoaderParms(
3701                                      "ProviderManager.CMPI.CMPIProviderManager."
3702                                          "ENABLE_INDICATIONS_FAILED_UNKNOWN",
3703                                      "Failed to enable indications for provider $0.",
3704                                      ph.GetProvider().getName()));
3705 marek          1.63      }
3706                      
3707                          PEG_METHOD_EXIT ();
3708                      }
3709                      
3710                      void CMPIProviderManager::_callDisableIndications
3711 venkat.puvvada 1.132     (OpProviderHolder & ph, const char *remoteInfo)
3712 marek          1.63  {
3713 ms.aruran      1.115     PEG_METHOD_ENTER(
3714                              TRC_PROVIDERMANAGER,
3715                              "CMPIProviderManager::_callDisableIndications()");
3716 marek          1.63  
3717 dave.sudlik    1.101     try
3718 marek          1.95      {
3719 dave.sudlik    1.101         indProvRecord * provRec = 0;
3720                              {
3721                                  WriteLock writeLock(rwSemProvTab);
3722 venkat.puvvada 1.108             if (provTab.lookup (ph.GetProvider ().getName (), provRec))
3723                                  {
3724                                      provRec->enabled = false;
3725                                      if (provRec->handler) delete provRec->handler;
3726                                      provRec->handler = NULL;
3727                                  }
3728 dave.sudlik    1.101         }
3729                      
3730                              CMPIProvider & pr=ph.GetProvider();
3731 marek          1.63  
3732 dave.sudlik    1.101         //
3733                              //  Versions prior to 86 did not include disableIndications routine
3734                              //
3735 venkat.puvvada 1.132         if (pr.getIndMI()->ft->ftVersion >= 86)
3736 dave.sudlik    1.101         {
3737                                  OperationContext context;
3738                                  CMPIStatus rc={CMPI_RC_OK,NULL};
3739                                  CMPI_ContextOnStack eCtx(context);
3740                      
3741                                  if (remoteInfo)
3742                                  {
3743 venkat.puvvada 1.108                 eCtx.ft->addEntry(&eCtx,"CMPIRRemoteInfo",
3744                                          (CMPIValue*)(const char*)remoteInfo,CMPI_chars);
3745 dave.sudlik    1.101             }
3746 venkat.puvvada 1.132             CMPI_ThreadContext thr(pr.getBroker(),&eCtx);
3747 dave.sudlik    1.96  
3748 thilo.boehm    1.143             PEG_TRACE((TRC_PROVIDERMANAGER,Tracer::LEVEL2,
3749 thilo.boehm    1.138                 "Calling provider.disableIndications: %s",
3750                                      (const char*)pr.getName().getCString()));
3751 dave.sudlik    1.100 
3752 dave.sudlik    1.101             // disableIndications() is defined by the CMPI standard as
3753                                  // returning a CMPIStatus return value. Unfortunately, Pegasus
3754                                  // originally implemented disableIndications() with a void
3755 kumpf          1.151             // return type, and this incompatibility was not detected for
3756 dave.sudlik    1.101             // some time. For consistency with the enableIndications()
3757 kumpf          1.151             // interface, it was decided to discard the returned CMPIStatus
3758                                  // here. This will prevent us from breaking existing CMPI
3759                                  // Indication providers. This is ok since there really isn't a
3760 dave.sudlik    1.101             // user to which the problem should be reported.
3761 venkat.puvvada 1.132             pr.getIndMI()->ft->disableIndications(
3762 kumpf          1.151                 pr.getIndMI(),
3763 venkat.puvvada 1.108                 &eCtx);
3764 marek          1.63  
3765 venkat.puvvada 1.111             pr.unprotect();
3766 thilo.boehm    1.143 
3767                                  PEG_TRACE((TRC_PROVIDERMANAGER,Tracer::LEVEL2,
3768                                      "Returning from provider.disableIndications: %s",
3769                                      (const char*)pr.getName().getCString()));
3770                      
3771 dave.sudlik    1.101         }
3772                              else
3773                              {
3774 thilo.boehm    1.143             PEG_TRACE((TRC_PROVIDERMANAGER,Tracer::LEVEL2,
3775 thilo.boehm    1.138                 "Not calling provider.disableIndications: %s routine as it is "
3776                                      "an earlier version that does not support this function",
3777                                      (const char*)pr.getName().getCString()));
3778 dave.sudlik    1.101         }
3779                          }
3780                          catch (const Exception & e)
3781                          {
3782 kumpf          1.136         Logger::put_l(Logger::ERROR_LOG, System::CIMSERVER, Logger::WARNING,
3783                                  MessageLoaderParms(
3784                                      "ProviderManager.CMPI.CMPIProviderManager."
3785                                          "DISABLE_INDICATIONS_FAILED",
3786                                      "Failed to disable indications for provider $0: $1.",
3787                                      ph.GetProvider().getName(), e.getMessage()));
3788 marek          1.63      }
3789 venkat.puvvada 1.108     catch (...)
3790 marek          1.63      {
3791 kumpf          1.136         Logger::put_l(Logger::ERROR_LOG, System::CIMSERVER, Logger::WARNING,
3792                                  MessageLoaderParms(
3793                                      "ProviderManager.CMPI.CMPIProviderManager."
3794                                          "DISABLE_INDICATIONS_FAILED_UNKNOWN",
3795                                      "Failed to disable indications for provider $0.",
3796                                      ph.GetProvider().getName()));
3797 marek          1.63      }
3798                      
3799                          PEG_METHOD_EXIT ();
3800                      }
3801                      
3802                      PEGASUS_NAMESPACE_END
3803 kumpf          1.151 

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2