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

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2