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

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2