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

   1 chip  1.1 //%/////////////////////////////////////////////////////////////////////////////
   2           //
   3           // Copyright (c) 2000 - 2003 BMC Software, Hewlett-Packard Company, IBM,
   4           // The Open Group, Tivoli Systems
   5           //
   6           // Permission is hereby granted, free of charge, to any person obtaining a copy
   7           // of this software and associated documentation files (the "Software"), to
   8           // deal in the Software without restriction, including without limitation the
   9           // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
  10           // sell copies of the Software, and to permit persons to whom the Software is
  11           // furnished to do so, subject to the following conditions:
  12           //
  13           // THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
  14           // ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED
  15           // "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
  16           // LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
  17           // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
  18           // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
  19           // ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
  20           // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  21           //
  22 chip  1.1 //==============================================================================
  23           //
  24           // Author: Chip Vincent (cvincent@us.ibm.com)
  25           //
  26           // Modified By: Carol Ann Krug Graves, Hewlett-Packard Company
  27           //                  (carolann_graves@hp.com)
  28           //              Mike Day, IBM (mdday@us.ibm.com)
  29           //              Karl Schopmeyer(k.schopmeyer@opengroup.org) - Fix associators.
  30           //		        Yi Zhou, Hewlett-Packard Company (yi_zhou@hp.com)
  31           //
  32           //%/////////////////////////////////////////////////////////////////////////////
  33           
  34           #include "DefaultProviderManager.h"
  35           
  36           #include <Pegasus/Common/CIMMessage.h>
  37           #include <Pegasus/Common/OperationContext.h>
  38           #include <Pegasus/Common/Destroyer.h>
  39           #include <Pegasus/Common/Tracer.h>
  40           #include <Pegasus/Common/StatisticalData.h>
  41           #include <Pegasus/Common/Logger.h>
  42           #include <Pegasus/Common/MessageLoader.h> //l10n
  43 chip  1.1 
  44           #include <Pegasus/Config/ConfigManager.h>
  45           
  46           #include <Pegasus/ProviderManager2/Default/Provider.h>
  47           #include <Pegasus/ProviderManager2/Default/OperationResponseHandler.h>
  48           
  49           #include <Pegasus/Server/ProviderRegistrationManager/ProviderRegistrationManager.h>
  50           
  51           PEGASUS_NAMESPACE_BEGIN
  52           
  53           // auto variable to protect provider during operations
  54           class pm_service_op_lock
  55           {
  56           private:
  57               pm_service_op_lock(void);
  58           
  59           public:
  60               pm_service_op_lock(Provider *provider) : _provider(provider)
  61               {
  62                   _provider->protect();
  63               }
  64 chip  1.1 
  65               ~pm_service_op_lock(void)
  66               {
  67                   _provider->unprotect();
  68               }
  69           
  70               Provider * _provider;
  71           };
  72           
  73           //
  74           // Provider module status
  75           //
  76           static const Uint16 _MODULE_OK       = 2;
  77           static const Uint16 _MODULE_STOPPING = 9;
  78           static const Uint16 _MODULE_STOPPED  = 10;
  79           
  80           // provider manager
  81           LocalProviderManager providerManager;
  82           
  83           DefaultProviderManager::DefaultProviderManager(void)
  84           {
  85 chip  1.1 }
  86           
  87           DefaultProviderManager::~DefaultProviderManager(void)
  88           {
  89           }
  90           
  91 kumpf 1.3 Message * DefaultProviderManager::processMessage(Message * request) throw()
  92 chip  1.1 {
  93               PEG_METHOD_ENTER(TRC_PROVIDERMANAGER,
  94                   "DefaultProviderManager::processMessage()");
  95           
  96               Message * response = 0;
  97           
  98               // pass the request message to a handler method based on message type
  99               switch(request->getType())
 100               {
 101               case CIM_GET_INSTANCE_REQUEST_MESSAGE:
 102                   response = handleGetInstanceRequest(request);
 103           
 104                   break;
 105               case CIM_ENUMERATE_INSTANCES_REQUEST_MESSAGE:
 106                   response = handleEnumerateInstancesRequest(request);
 107           
 108                   break;
 109               case CIM_ENUMERATE_INSTANCE_NAMES_REQUEST_MESSAGE:
 110                   response = handleEnumerateInstanceNamesRequest(request);
 111           
 112                   break;
 113 chip  1.1     case CIM_CREATE_INSTANCE_REQUEST_MESSAGE:
 114                   response = handleCreateInstanceRequest(request);
 115           
 116                   break;
 117               case CIM_MODIFY_INSTANCE_REQUEST_MESSAGE:
 118                   response = handleModifyInstanceRequest(request);
 119           
 120                   break;
 121               case CIM_DELETE_INSTANCE_REQUEST_MESSAGE:
 122                   response = handleDeleteInstanceRequest(request);
 123           
 124                   break;
 125               case CIM_EXEC_QUERY_REQUEST_MESSAGE:
 126                   response = handleExecuteQueryRequest(request);
 127           
 128                   break;
 129               case CIM_ASSOCIATORS_REQUEST_MESSAGE:
 130                   response = handleAssociatorsRequest(request);
 131           
 132                   break;
 133               case CIM_ASSOCIATOR_NAMES_REQUEST_MESSAGE:
 134 chip  1.1         response = handleAssociatorNamesRequest(request);
 135           
 136                   break;
 137               case CIM_REFERENCES_REQUEST_MESSAGE:
 138                   response = handleReferencesRequest(request);
 139           
 140                   break;
 141               case CIM_REFERENCE_NAMES_REQUEST_MESSAGE:
 142                   response = handleReferenceNamesRequest(request);
 143           
 144                   break;
 145               case CIM_GET_PROPERTY_REQUEST_MESSAGE:
 146                   response = handleGetPropertyRequest(request);
 147           
 148                   break;
 149               case CIM_SET_PROPERTY_REQUEST_MESSAGE:
 150                   response = handleSetPropertyRequest(request);
 151           
 152                   break;
 153               case CIM_INVOKE_METHOD_REQUEST_MESSAGE:
 154                   response = handleInvokeMethodRequest(request);
 155 chip  1.1 
 156                   break;
 157               case CIM_CREATE_SUBSCRIPTION_REQUEST_MESSAGE:
 158                   response = handleCreateSubscriptionRequest(request);
 159           
 160                   break;
 161               case CIM_MODIFY_SUBSCRIPTION_REQUEST_MESSAGE:
 162                   response = handleModifySubscriptionRequest(request);
 163           
 164                   break;
 165               case CIM_DELETE_SUBSCRIPTION_REQUEST_MESSAGE:
 166                   response = handleDeleteSubscriptionRequest(request);
 167           
 168                   break;
 169               case CIM_ENABLE_INDICATIONS_REQUEST_MESSAGE:
 170                   response = handleEnableIndicationsRequest(request);
 171           
 172                   break;
 173               case CIM_DISABLE_INDICATIONS_REQUEST_MESSAGE:
 174                   response = handleDisableIndicationsRequest(request);
 175           
 176 chip  1.1         break;
 177               case CIM_CONSUME_INDICATION_REQUEST_MESSAGE:
 178                   response = handleConsumeIndicationRequest(request);
 179                   break;
 180           
 181               case CIM_DISABLE_MODULE_REQUEST_MESSAGE:
 182                   response = handleDisableModuleRequest(request);
 183           
 184                   break;
 185               case CIM_ENABLE_MODULE_REQUEST_MESSAGE:
 186                   response = handleEnableModuleRequest(request);
 187           
 188                   break;
 189               case CIM_STOP_ALL_PROVIDERS_REQUEST_MESSAGE:
 190                   response = handleStopAllProvidersRequest(request);
 191           
 192                   break;
 193               default:
 194                   response = handleUnsupportedRequest(request);
 195           
 196                   break;
 197 chip  1.1     }
 198           
 199               PEG_METHOD_EXIT();
 200           
 201               return(response);
 202           }
 203           
 204           Message * DefaultProviderManager::handleUnsupportedRequest(const Message * message) throw()
 205           {
 206               PEG_METHOD_ENTER(TRC_PROVIDERMANAGER, "DefaultProviderManager::handleUnsupportedRequest");
 207           
 208               PEG_METHOD_EXIT();
 209           
 210               // a null response implies unsupported or unknown operation
 211               return(0);
 212           }
 213           
 214           Message * DefaultProviderManager::handleGetInstanceRequest(const Message * message) throw()
 215           {
 216               PEG_METHOD_ENTER(TRC_PROVIDERMANAGER, "DefaultProviderManager::handleGetInstanceRequest");
 217           
 218 chip  1.1     CIMGetInstanceRequestMessage * request =
 219                   dynamic_cast<CIMGetInstanceRequestMessage *>(const_cast<Message *>(message));
 220           
 221               PEGASUS_ASSERT(request != 0);
 222           
 223               CIMGetInstanceResponseMessage * response =
 224                   new CIMGetInstanceResponseMessage(
 225                   request->messageId,
 226                   CIMException(),
 227                   request->queueIds.copyAndPop(),
 228                   CIMInstance());
 229           
 230               PEGASUS_ASSERT(response != 0);
 231           
 232               // preserve message key
 233               response->setKey(request->getKey());
 234           
 235               //  Set HTTP method in response from request
 236               response->setHttpMethod(request->getHttpMethod());
 237           
 238               // create a handler for this request
 239 chip  1.1     GetInstanceResponseHandler handler(request, response);
 240           
 241               try
 242               {
 243                   Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE,
 244                       "DefaultProviderManager::handleGetInstanceRequest - Host name: $0  Name space: $1  Class name: $2",
 245                       System::getHostName(),
 246                       request->nameSpace.getString(),
 247                       request->instanceName.getClassName().getString());
 248           
 249                   // make target object path
 250                   CIMObjectPath objectPath(
 251                       System::getHostName(),
 252                       request->nameSpace,
 253                       request->instanceName.getClassName(),
 254                       request->instanceName.getKeyBindings());
 255           
 256 chip  1.4         ProviderName name(
 257                       objectPath.toString(),
 258 chip  1.1             String::EMPTY,
 259                       String::EMPTY,
 260 chip  1.4             String::EMPTY,
 261                       0);
 262 chip  1.1 
 263 chip  1.4         name = findProvider(name);
 264 chip  1.1 
 265                   // get cached or load new provider module
 266                   OpProviderHolder ph =
 267                       providerManager.getProvider(name.getPhysicalName(), name.getLogicalName(), String::EMPTY);
 268           
 269                   // convert arguments
 270                   OperationContext context;
 271           
 272                   context.insert(IdentityContainer(request->userName));
 273                   context.insert(AcceptLanguageListContainer(request->acceptLanguages));
 274                   context.insert(ContentLanguageListContainer(request->contentLanguages));
 275           
 276                   CIMPropertyList propertyList(request->propertyList);
 277           
 278                   // forward request
 279                   PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
 280                       "Calling provider.getInstance: " +
 281                       ph.GetProvider().getName());
 282           
 283                   pm_service_op_lock op_lock(&ph.GetProvider());
 284           
 285 chip  1.1         STAT_GETSTARTTIME;
 286           
 287                   ph.GetProvider().getInstance(
 288                       context,
 289                       objectPath,
 290                       request->includeQualifiers,
 291                       request->includeClassOrigin,
 292                       propertyList,
 293                       handler);
 294           
 295                   STAT_PMS_PROVIDEREND;
 296               }
 297               catch(CIMException & e)
 298               {
 299                   PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
 300                       "Exception: " + e.getMessage());
 301           
 302                   handler.setStatus(e.getCode(), e.getContentLanguages(), e.getMessage()); // l10n
 303               }
 304               catch(Exception & e)
 305               {
 306 chip  1.1         PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
 307                       "Exception: " + e.getMessage());
 308 chip  1.2 
 309 chip  1.1         handler.setStatus(CIM_ERR_FAILED, e.getContentLanguages(), e.getMessage()); // l10n
 310               }
 311               catch(...)
 312               {
 313                   PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
 314                       "Exception: Unknown");
 315 chip  1.2 
 316 chip  1.1         handler.setStatus(CIM_ERR_FAILED, "Unknown error.");
 317               }
 318           
 319               PEG_METHOD_EXIT();
 320           
 321               return(response);
 322           }
 323           
 324           Message * DefaultProviderManager::handleEnumerateInstancesRequest(const Message * message) throw()
 325           {
 326               PEG_METHOD_ENTER(TRC_PROVIDERMANAGER, "DefaultProviderManager::handleEnumerateInstanceRequest");
 327           
 328               CIMEnumerateInstancesRequestMessage * request =
 329                   dynamic_cast<CIMEnumerateInstancesRequestMessage *>(const_cast<Message *>(message));
 330           
 331               PEGASUS_ASSERT(request != 0);
 332           
 333               CIMEnumerateInstancesResponseMessage * response =
 334                   new CIMEnumerateInstancesResponseMessage(
 335                   request->messageId,
 336                   CIMException(),
 337 chip  1.1         request->queueIds.copyAndPop(),
 338                   Array<CIMInstance>());
 339           
 340               PEGASUS_ASSERT(response != 0);
 341           
 342               // preserve message key
 343               response->setKey(request->getKey());
 344           
 345               //  Set HTTP method in response from request
 346               response->setHttpMethod (request->getHttpMethod ());
 347           
 348               // create a handler for this request
 349               EnumerateInstancesResponseHandler handler(request, response);
 350           
 351               try
 352               {
 353                   Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE,
 354                       "DefaultProviderManager::handleEnumerateInstancesRequest - Host name: $0  Name space: $1  Class name: $2",
 355                       System::getHostName(),
 356                       request->nameSpace.getString(),
 357                       request->className.getString());
 358 chip  1.1 
 359                   // make target object path
 360                   CIMObjectPath objectPath(
 361                       System::getHostName(),
 362                       request->nameSpace,
 363                       request->className);
 364           
 365 chip  1.4         ProviderName name(
 366                       objectPath.toString(),
 367 chip  1.1             String::EMPTY,
 368                       String::EMPTY,
 369 chip  1.4             String::EMPTY,
 370                       0);
 371 chip  1.1 
 372 chip  1.4         name = findProvider(name);
 373 chip  1.1 
 374                   // get cached or load new provider module
 375                   OpProviderHolder ph =
 376                       providerManager.getProvider(name.getPhysicalName(), name.getLogicalName(), String::EMPTY);
 377           
 378                   // convert arguments
 379                   OperationContext context;
 380           
 381                   context.insert(IdentityContainer(request->userName));
 382                   context.insert(AcceptLanguageListContainer(request->acceptLanguages));
 383                   context.insert(ContentLanguageListContainer(request->contentLanguages));
 384           
 385                   CIMPropertyList propertyList(request->propertyList);
 386           
 387                   // forward request
 388                   PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
 389                       "Calling provider.enumerateInstances: " +
 390                       ph.GetProvider().getName());
 391           
 392                   pm_service_op_lock op_lock(&ph.GetProvider());
 393           
 394 chip  1.1         STAT_GETSTARTTIME;
 395           
 396                   ph.GetProvider().enumerateInstances(
 397                       context,
 398                       objectPath,
 399                       request->includeQualifiers,
 400                       request->includeClassOrigin,
 401                       propertyList,
 402                       handler);
 403           
 404                   STAT_PMS_PROVIDEREND;
 405               }
 406               catch(CIMException & e)
 407               {
 408                   PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
 409                       "Exception: " + e.getMessage());
 410 chip  1.2 
 411 chip  1.1         handler.setStatus(e.getCode(), e.getContentLanguages(), e.getMessage()); // l10n
 412               }
 413               catch(Exception & e)
 414               {
 415                   PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
 416                       "Exception: " + e.getMessage());
 417 chip  1.2 
 418 chip  1.1         handler.setStatus(CIM_ERR_FAILED, e.getContentLanguages(), e.getMessage()); // l10n
 419               }
 420               catch(...)
 421               {
 422                   PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
 423                       "Exception: Unknown");
 424 chip  1.2 
 425 chip  1.1         handler.setStatus(CIM_ERR_FAILED, "Unknown error.");
 426               }
 427           
 428               PEG_METHOD_EXIT();
 429           
 430               return(response);
 431           }
 432           
 433           Message * DefaultProviderManager::handleEnumerateInstanceNamesRequest(const Message * message) throw()
 434           {
 435               PEG_METHOD_ENTER(TRC_PROVIDERMANAGER, "DefaultProviderManager::handleEnumerateInstanceNamesRequest");
 436           
 437               CIMEnumerateInstanceNamesRequestMessage * request =
 438                   dynamic_cast<CIMEnumerateInstanceNamesRequestMessage *>(const_cast<Message *>(message));
 439           
 440               PEGASUS_ASSERT(request != 0);
 441           
 442               CIMEnumerateInstanceNamesResponseMessage * response =
 443                   new CIMEnumerateInstanceNamesResponseMessage(
 444                   request->messageId,
 445                   CIMException(),
 446 chip  1.1         request->queueIds.copyAndPop(),
 447                   Array<CIMObjectPath>());
 448           
 449               PEGASUS_ASSERT(response != 0);
 450           
 451               // preserve message key
 452               response->setKey(request->getKey());
 453           
 454               //set HTTP method in response from request
 455               response->setHttpMethod(request->getHttpMethod());;
 456           
 457               // create a handler for this request
 458               EnumerateInstanceNamesResponseHandler handler(request, response);
 459           
 460               // process the request
 461               try
 462               {
 463                   Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE,
 464                       "DefaultProviderManager::handleEnumerateInstanceNamesRequest - Host name: $0  Name space: $1  Class name: $2",
 465                       System::getHostName(),
 466                       request->nameSpace.getString(),
 467 chip  1.1             request->className.getString());
 468           
 469                   // make target object path
 470                   CIMObjectPath objectPath(
 471                       System::getHostName(),
 472                       request->nameSpace,
 473                       request->className);
 474           
 475                   // build an internal provider name from the request arguments
 476 chip  1.4         ProviderName name(
 477                       objectPath.toString(),
 478 chip  1.1             String::EMPTY,
 479                       String::EMPTY,
 480 chip  1.4             String::EMPTY,
 481                       0);
 482 chip  1.1 
 483                   // resolve the physical and logical provider name
 484 chip  1.4         name = findProvider(name);
 485 chip  1.1 
 486                   // get cached or load new provider module
 487                   OpProviderHolder ph =
 488                       providerManager.getProvider(name.getPhysicalName(), name.getLogicalName());
 489           
 490                   // convert arguments
 491                   OperationContext context;
 492           
 493                   context.insert(IdentityContainer(request->userName));
 494                   context.insert(AcceptLanguageListContainer(request->acceptLanguages));
 495                   context.insert(ContentLanguageListContainer(request->contentLanguages));
 496           
 497                   // forward request
 498                   PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
 499                       "Calling provider.enumerateInstanceNames: " +
 500                       ph.GetProvider().getName());
 501           
 502                   pm_service_op_lock op_lock(&ph.GetProvider());
 503           
 504                   STAT_GETSTARTTIME;
 505           
 506 chip  1.1         ph.GetProvider().enumerateInstanceNames(
 507                       context,
 508                       objectPath,
 509                       handler);
 510           
 511                   STAT_PMS_PROVIDEREND;
 512               }
 513               catch(CIMException & e)
 514               {
 515                   PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
 516                       "Exception: " + e.getMessage());
 517 chip  1.2 
 518 chip  1.1         handler.setStatus(e.getCode(), e.getContentLanguages(), e.getMessage()); // l10n
 519               }
 520               catch(Exception & e)
 521               {
 522                   PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
 523                       "Exception: " + e.getMessage());
 524 chip  1.2 
 525 chip  1.1         handler.setStatus(CIM_ERR_FAILED, e.getContentLanguages(), e.getMessage()); // l10n
 526               }
 527               catch(...)
 528               {
 529                   PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
 530                       "Exception: Unknown");
 531 chip  1.2 
 532 chip  1.1         handler.setStatus(CIM_ERR_FAILED, "Unknown error.");
 533               }
 534           
 535               PEG_METHOD_EXIT();
 536           
 537               return(response);
 538           }
 539           
 540           Message * DefaultProviderManager::handleCreateInstanceRequest(const Message * message) throw()
 541           {
 542               PEG_METHOD_ENTER(TRC_PROVIDERMANAGER, "DefaultProviderManager::handleCreateInstanceRequest");
 543           
 544               CIMCreateInstanceRequestMessage * request =
 545                   dynamic_cast<CIMCreateInstanceRequestMessage *>(const_cast<Message *>(message));
 546           
 547               PEGASUS_ASSERT(request != 0);
 548           
 549               // create response message
 550               CIMCreateInstanceResponseMessage * response =
 551                   new CIMCreateInstanceResponseMessage(
 552                   request->messageId,
 553 chip  1.1         CIMException(),
 554                   request->queueIds.copyAndPop(),
 555                   CIMObjectPath());
 556           
 557               PEGASUS_ASSERT(response != 0);
 558           
 559               // preserve message key
 560               response->setKey(request->getKey());
 561           
 562               //  Set HTTP method in response from request
 563               response->setHttpMethod (request->getHttpMethod ());
 564           
 565               // create a handler for this request
 566               CreateInstanceResponseHandler handler(request, response);
 567           
 568               try
 569               {
 570                   Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE,
 571                       "DefaultProviderManager::handleCreateInstanceRequest - Host name: $0  Name space: $1  Class name: $2",
 572                       System::getHostName(),
 573                       request->nameSpace.getString(),
 574 chip  1.1             request->newInstance.getPath().getClassName().getString());
 575           
 576                   // make target object path
 577                   CIMObjectPath objectPath(
 578                       System::getHostName(),
 579                       request->nameSpace,
 580                       request->newInstance.getPath().getClassName(),
 581                       request->newInstance.getPath().getKeyBindings());
 582           
 583 chip  1.4         ProviderName name(
 584                       objectPath.toString(),
 585 chip  1.1             String::EMPTY,
 586                       String::EMPTY,
 587 chip  1.4             String::EMPTY,
 588                       0);
 589 chip  1.1 
 590 chip  1.4         name = findProvider(name);
 591 chip  1.1 
 592                   // get cached or load new provider module
 593                   OpProviderHolder ph =
 594                       providerManager.getProvider(name.getPhysicalName(), name.getLogicalName(), String::EMPTY);
 595           
 596                   // convert arguments
 597                   OperationContext context;
 598           
 599                   context.insert(IdentityContainer(request->userName));
 600                   context.insert(AcceptLanguageListContainer(request->acceptLanguages));
 601                   context.insert(ContentLanguageListContainer(request->contentLanguages));
 602           
 603                   // forward request
 604                   PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
 605                       "Calling provider.createInstance: " +
 606                       ph.GetProvider().getName());
 607           
 608                   pm_service_op_lock op_lock(&ph.GetProvider());
 609           
 610                   STAT_GETSTARTTIME;
 611           
 612 chip  1.1         ph.GetProvider().createInstance(
 613                       context,
 614                       objectPath,
 615                       request->newInstance,
 616                       handler);
 617           
 618                   STAT_PMS_PROVIDEREND;
 619               }
 620               catch(CIMException & e)
 621               {
 622                   PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
 623                       "Exception: " + e.getMessage());
 624 chip  1.2 
 625 chip  1.1         handler.setStatus(e.getCode(), e.getContentLanguages(), e.getMessage()); // l10n
 626               }
 627               catch(Exception & e)
 628               {
 629                   PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
 630                       "Exception: " + e.getMessage());
 631 chip  1.2 
 632 chip  1.1         handler.setStatus(CIM_ERR_FAILED, e.getContentLanguages(), e.getMessage()); // l10n
 633               }
 634               catch(...)
 635               {
 636                   PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
 637                       "Exception: Unknown");
 638 chip  1.2 
 639 chip  1.1         handler.setStatus(CIM_ERR_FAILED, "Unknown error.");
 640               }
 641           
 642               PEG_METHOD_EXIT();
 643           
 644               return(response);
 645           }
 646           
 647           Message * DefaultProviderManager::handleModifyInstanceRequest(const Message * message) throw()
 648           {
 649               PEG_METHOD_ENTER(TRC_PROVIDERMANAGER, "DefaultProviderManager::handleModifyInstanceRequest");
 650           
 651               CIMModifyInstanceRequestMessage * request =
 652                   dynamic_cast<CIMModifyInstanceRequestMessage *>(const_cast<Message *>(message));
 653           
 654               PEGASUS_ASSERT(request != 0);
 655           
 656               // create response message
 657               CIMModifyInstanceResponseMessage * response =
 658                   new CIMModifyInstanceResponseMessage(
 659                   request->messageId,
 660 chip  1.1         CIMException(),
 661                   request->queueIds.copyAndPop());
 662           
 663               PEGASUS_ASSERT(response != 0);
 664           
 665               // preserve message key
 666               response->setKey(request->getKey());
 667           
 668               //  Set HTTP method in response from request
 669               response->setHttpMethod (request->getHttpMethod ());
 670           
 671               // create a handler for this request
 672               ModifyInstanceResponseHandler handler(request, response);
 673           
 674               try
 675               {
 676                   Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE,
 677                       "DefaultProviderManager::handleModifyInstanceRequest - Host name: $0  Name space: $1  Class name: $2",
 678                       System::getHostName(),
 679                       request->nameSpace.getString(),
 680                       request->modifiedInstance.getPath().getClassName().getString());
 681 chip  1.1 
 682                   // make target object path
 683                   CIMObjectPath objectPath(
 684                       System::getHostName(),
 685                       request->nameSpace,
 686                       request->modifiedInstance.getPath ().getClassName(),
 687                       request->modifiedInstance.getPath ().getKeyBindings());
 688           
 689 chip  1.4         ProviderName name(
 690                       objectPath.toString(),
 691 chip  1.1             String::EMPTY,
 692                       String::EMPTY,
 693 chip  1.4             String::EMPTY,
 694                       0);
 695 chip  1.1 
 696 chip  1.4         name = findProvider(name);
 697 chip  1.1 
 698                   // get cached or load new provider module
 699                   OpProviderHolder ph =
 700                       providerManager.getProvider(name.getPhysicalName(), name.getLogicalName(), String::EMPTY);
 701           
 702                   // convert arguments
 703                   OperationContext context;
 704           
 705                   context.insert(IdentityContainer(request->userName));
 706                   context.insert(AcceptLanguageListContainer(request->acceptLanguages));
 707                   context.insert(ContentLanguageListContainer(request->contentLanguages));
 708           
 709                   CIMPropertyList propertyList(request->propertyList);
 710           
 711                   // forward request
 712                   PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
 713                       "Calling provider.modifyInstance: " +
 714                       ph.GetProvider().getName());
 715           
 716                   pm_service_op_lock op_lock(&ph.GetProvider());
 717           
 718 chip  1.1         STAT_GETSTARTTIME;
 719           
 720                   ph.GetProvider().modifyInstance(
 721                       context,
 722                       objectPath,
 723                       request->modifiedInstance,
 724                       request->includeQualifiers,
 725                       propertyList,
 726                       handler);
 727           
 728                   STAT_PMS_PROVIDEREND;
 729               }
 730               catch(CIMException & e)
 731               {
 732                   PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
 733                       "Exception: " + e.getMessage());
 734 chip  1.2 
 735 chip  1.1         handler.setStatus(e.getCode(), e.getContentLanguages(), e.getMessage()); // l10n
 736               }
 737               catch(Exception & e)
 738               {
 739                   PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
 740                       "Exception: " + e.getMessage());
 741 chip  1.2 
 742 chip  1.1         handler.setStatus(CIM_ERR_FAILED, e.getContentLanguages(), e.getMessage()); // l10n
 743               }
 744               catch(...)
 745               {
 746                   PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
 747                       "Exception: Unknown");
 748 chip  1.2 
 749 chip  1.1         handler.setStatus(CIM_ERR_FAILED, "Unknown error.");
 750               }
 751           
 752               PEG_METHOD_EXIT();
 753           
 754               return(response);
 755           }
 756           
 757           Message * DefaultProviderManager::handleDeleteInstanceRequest(const Message * message) throw()
 758           {
 759               PEG_METHOD_ENTER(TRC_PROVIDERMANAGER, "DefaultProviderManager::handleDeleteInstanceRequest");
 760           
 761               CIMDeleteInstanceRequestMessage * request =
 762                   dynamic_cast<CIMDeleteInstanceRequestMessage *>(const_cast<Message *>(message));
 763           
 764               PEGASUS_ASSERT(request != 0);
 765           
 766               // create response message
 767               CIMDeleteInstanceResponseMessage * response =
 768                   new CIMDeleteInstanceResponseMessage(
 769                   request->messageId,
 770 chip  1.1         CIMException(),
 771                   request->queueIds.copyAndPop());
 772           
 773               PEGASUS_ASSERT(response != 0);
 774           
 775               // preserve message key
 776               response->setKey(request->getKey());
 777           
 778               //  Set HTTP method in response from request
 779               response->setHttpMethod (request->getHttpMethod ());
 780           
 781               // create a handler for this request
 782               DeleteInstanceResponseHandler handler(request, response);
 783           
 784               try
 785               {
 786                   Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE,
 787                       "DefaultProviderManager::handleDeleteInstanceRequest - Host name: $0  Name space: $1  Class name: $2",
 788                       System::getHostName(),
 789                       request->nameSpace.getString(),
 790                       request->instanceName.getClassName().getString());
 791 chip  1.1 
 792                   // make target object path
 793                   CIMObjectPath objectPath(
 794                       System::getHostName(),
 795                       request->nameSpace,
 796                       request->instanceName.getClassName(),
 797                       request->instanceName.getKeyBindings());
 798           
 799 chip  1.4         ProviderName name(
 800                       objectPath.toString(),
 801 chip  1.1             String::EMPTY,
 802                       String::EMPTY,
 803 chip  1.4             String::EMPTY,
 804                       0);
 805 chip  1.1 
 806 chip  1.4         name = findProvider(name);
 807 chip  1.1 
 808                   // get cached or load new provider module
 809                   OpProviderHolder ph =
 810                       providerManager.getProvider(name.getPhysicalName(), name.getLogicalName(), String::EMPTY);
 811           
 812                   // convert arguments
 813                   OperationContext context;
 814           
 815                   context.insert(IdentityContainer(request->userName));
 816                   context.insert(AcceptLanguageListContainer(request->acceptLanguages));
 817                   context.insert(ContentLanguageListContainer(request->contentLanguages));
 818           
 819                   // forward request
 820                   PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
 821                       "Calling provider.deleteInstance: " +
 822                       ph.GetProvider().getName());
 823           
 824                   pm_service_op_lock op_lock(&ph.GetProvider());
 825           
 826                   STAT_GETSTARTTIME;
 827           
 828 chip  1.1         ph.GetProvider().deleteInstance(
 829                       context,
 830                       objectPath,
 831                       handler);
 832           
 833                   STAT_PMS_PROVIDEREND;
 834               }
 835               catch(CIMException & e)
 836               {
 837                   PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
 838                       "Exception: " + e.getMessage());
 839 chip  1.2 
 840 chip  1.1         handler.setStatus(e.getCode(), e.getContentLanguages(), e.getMessage()); // l10n
 841               }
 842               catch(Exception & e)
 843               {
 844                   PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
 845                       "Exception: " + e.getMessage());
 846 chip  1.2 
 847 chip  1.1         handler.setStatus(CIM_ERR_FAILED, e.getContentLanguages(), e.getMessage()); // l10n
 848               }
 849               catch(...)
 850               {
 851                   PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
 852                       "Exception: Unknown");
 853 chip  1.2 
 854 chip  1.1         handler.setStatus(CIM_ERR_FAILED, "Unknown error.");
 855               }
 856           
 857               PEG_METHOD_EXIT();
 858           
 859               return(response);
 860           }
 861           
 862           Message * DefaultProviderManager::handleExecuteQueryRequest(const Message * message) throw()
 863           {
 864               PEG_METHOD_ENTER(TRC_PROVIDERMANAGER, "DefaultProviderManager::handleExecuteQueryRequest");
 865           
 866               CIMExecQueryRequestMessage * request =
 867                   dynamic_cast<CIMExecQueryRequestMessage *>(const_cast<Message *>(message));
 868           
 869               PEGASUS_ASSERT(request != 0);
 870           
 871               //l10n
 872               CIMExecQueryResponseMessage * response =
 873                   new CIMExecQueryResponseMessage(
 874                   request->messageId,
 875 chip  1.1         PEGASUS_CIM_EXCEPTION_L(CIM_ERR_FAILED, MessageLoaderParms(
 876                   "ProviderManager.DefaultProviderManager.NOT_IMPLEMENTED",
 877                   "not implemented")),
 878                   request->queueIds.copyAndPop(),
 879                   Array<CIMObject>());
 880           
 881               PEGASUS_ASSERT(response != 0);
 882           
 883               // preserve message key
 884               response->setKey(request->getKey());
 885           
 886               //  Set HTTP method in response from request
 887               response->setHttpMethod(request->getHttpMethod());
 888           
 889               // l10n
 890               // ATTN: when this is implemented, need to add the language containers to the
 891               // OperationContext.  See how the other requests do it.
 892           
 893               PEG_METHOD_EXIT();
 894           
 895               return(response);
 896 chip  1.1 }
 897           
 898           Message * DefaultProviderManager::handleAssociatorsRequest(const Message * message) throw()
 899           {
 900               PEG_METHOD_ENTER(TRC_PROVIDERMANAGER, "DefaultProviderManager::handleAssociatorsRequest");
 901           
 902               CIMAssociatorsRequestMessage * request =
 903                   dynamic_cast<CIMAssociatorsRequestMessage *>(const_cast<Message *>(message));
 904           
 905               PEGASUS_ASSERT(request != 0);
 906           
 907               CIMAssociatorsResponseMessage * response =
 908                   new CIMAssociatorsResponseMessage(
 909                   request->messageId,
 910                   CIMException(),
 911                   request->queueIds.copyAndPop(),
 912                   Array<CIMObject>());
 913           
 914               PEGASUS_ASSERT(response != 0);
 915           
 916               // preserve message key
 917 chip  1.1     response->setKey(request->getKey());
 918           
 919               // create a handler for this request
 920               AssociatorsResponseHandler handler(request, response);
 921           
 922               // process the request
 923               try
 924               {
 925                   Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE,
 926                       "DefaultProviderManager::handleAssociatorsRequest - Host name: $0  Name space: $1  Class name: $2",
 927                       System::getHostName(),
 928                       request->nameSpace.getString(),
 929                       request->objectName.getClassName().getString());
 930           
 931                   // make target object path
 932                   CIMObjectPath objectPath(
 933                       System::getHostName(),
 934                       request->nameSpace,
 935                       request->objectName.getClassName());
 936           
 937                   objectPath.setKeyBindings(request->objectName.getKeyBindings());
 938 chip  1.1 
 939 chip  1.4         ProviderName name(
 940                       objectPath.toString(),
 941 chip  1.2             String::EMPTY,
 942                       String::EMPTY,
 943 chip  1.4             String::EMPTY,
 944                       0);
 945 chip  1.2 
 946 chip  1.4         name = findProvider(name);
 947 chip  1.2 
 948                   // get cached or load new provider module
 949                   OpProviderHolder ph =
 950                       providerManager.getProvider(name.getPhysicalName(), name.getLogicalName(), String::EMPTY);
 951           
 952                   // convert arguments
 953                   OperationContext context;
 954           
 955                   context.insert(IdentityContainer(request->userName));
 956                   context.insert(AcceptLanguageListContainer(request->acceptLanguages));
 957                   context.insert(ContentLanguageListContainer(request->contentLanguages));
 958 chip  1.1 
 959 chip  1.2         // ATTN KS STAT_GETSTARTTIME;
 960                   pm_service_op_lock op_lock(&ph.GetProvider());
 961 chip  1.1 
 962 chip  1.2         ph.GetProvider().associators(
 963                       context,
 964                       objectPath,
 965                       request->assocClass,
 966                       request->resultClass,
 967                       request->role,
 968                       request->resultRole,
 969                       request->includeQualifiers,
 970                       request->includeClassOrigin,
 971                       request->propertyList.getPropertyNameArray(),
 972                       handler);
 973 chip  1.1 
 974 chip  1.2         STAT_PMS_PROVIDEREND;
 975 chip  1.1     }
 976               catch(CIMException & e)
 977               {
 978                   PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
 979                       "Exception: " + e.getMessage());
 980 chip  1.2 
 981 chip  1.1         handler.setStatus(e.getCode(), e.getContentLanguages(), e.getMessage()); // l10n
 982               }
 983               catch(Exception & e)
 984               {
 985                   PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
 986                       "Exception: " + e.getMessage());
 987 chip  1.2 
 988 chip  1.1         handler.setStatus(CIM_ERR_FAILED, e.getContentLanguages(), e.getMessage()); // l10n
 989               }
 990               catch(...)
 991               {
 992                   PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
 993                       "Exception: Unknown");
 994 chip  1.2 
 995 chip  1.1         handler.setStatus(CIM_ERR_FAILED, "Unknown error.");
 996               }
 997           
 998               PEG_METHOD_EXIT();
 999           
1000               return(response);
1001           }
1002           
1003           Message * DefaultProviderManager::handleAssociatorNamesRequest(const Message * message) throw()
1004           {
1005               PEG_METHOD_ENTER(TRC_PROVIDERMANAGER, "DefaultProviderManager::handleAssociatorNamesRequest");
1006           
1007               CIMAssociatorNamesRequestMessage * request =
1008                   dynamic_cast<CIMAssociatorNamesRequestMessage *>(const_cast<Message *>(message));
1009           
1010               PEGASUS_ASSERT(request != 0);
1011           
1012               CIMAssociatorNamesResponseMessage * response =
1013                   new CIMAssociatorNamesResponseMessage(
1014                   request->messageId,
1015                   CIMException(),
1016 chip  1.1         request->queueIds.copyAndPop(),
1017                   Array<CIMObjectPath>());
1018           
1019               PEGASUS_ASSERT(response != 0);
1020           
1021               // preserve message key
1022               response->setKey(request->getKey());
1023           
1024               //  Set HTTP method in response from request
1025               response->setHttpMethod(request->getHttpMethod());
1026           
1027               // create a handler for this request
1028               AssociatorNamesResponseHandler handler(request, response);
1029           
1030               // process the request
1031               try
1032               {
1033                   Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE,
1034                       "DefaultProviderManager::handleAssociationNamesRequest - Host name: $0  Name space: $1  Class name: $2",
1035                       System::getHostName(),
1036                       request->nameSpace.getString(),
1037 chip  1.1             request->objectName.getClassName().getString());
1038           
1039                   // make target object path
1040                   CIMObjectPath objectPath(
1041                       System::getHostName(),
1042                       request->nameSpace,
1043                       request->objectName.getClassName());
1044           
1045                   objectPath.setKeyBindings(request->objectName.getKeyBindings());
1046           
1047 chip  1.4         ProviderName name(
1048                       objectPath.toString(),
1049 chip  1.2             String::EMPTY,
1050                       String::EMPTY,
1051 chip  1.4             String::EMPTY,
1052                       0);
1053 chip  1.2 
1054 chip  1.4         name = findProvider(name);
1055 chip  1.2 
1056                   // get cached or load new provider module
1057                   OpProviderHolder ph =
1058                       providerManager.getProvider(name.getPhysicalName(), name.getLogicalName(), String::EMPTY);
1059           
1060                   // convert arguments
1061                   OperationContext context;
1062 chip  1.1 
1063 chip  1.2         context.insert(IdentityContainer(request->userName));
1064                   context.insert(AcceptLanguageListContainer(request->acceptLanguages));
1065                   context.insert(ContentLanguageListContainer(request->contentLanguages));
1066 chip  1.1 
1067 chip  1.2         pm_service_op_lock op_lock(&ph.GetProvider());
1068 chip  1.1 
1069 chip  1.2         ph.GetProvider().associatorNames(
1070                       context,
1071                       objectPath,
1072                       request->assocClass,
1073                       request->resultClass,
1074                       request->role,
1075                       request->resultRole,
1076                       handler);
1077 chip  1.1 
1078 chip  1.2         STAT_PMS_PROVIDEREND;
1079 chip  1.1     }
1080               catch(CIMException & e)
1081               {
1082 chip  1.2         PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
1083                       "Exception: " + e.getMessage());
1084           
1085 chip  1.1         handler.setStatus(e.getCode(), e.getContentLanguages(), e.getMessage()); // l10n
1086               }
1087               catch(Exception & e)
1088               {
1089 chip  1.2         PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
1090                       "Exception: " + e.getMessage());
1091           
1092 chip  1.1         handler.setStatus(CIM_ERR_FAILED, e.getContentLanguages(), e.getMessage()); // l10n
1093               }
1094               catch(...)
1095               {
1096                   PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
1097                       "Exception: Unknown");
1098 chip  1.2 
1099 chip  1.1         handler.setStatus(CIM_ERR_FAILED, "Unknown error.");
1100               }
1101           
1102               PEG_METHOD_EXIT();
1103           
1104               return(response);
1105           }
1106           
1107           Message * DefaultProviderManager::handleReferencesRequest(const Message * message) throw()
1108           {
1109               PEG_METHOD_ENTER(TRC_PROVIDERMANAGER, "DefaultProviderManager::handleReferencesRequest");
1110           
1111               CIMReferencesRequestMessage * request =
1112                   dynamic_cast<CIMReferencesRequestMessage *>(const_cast<Message *>(message));
1113           
1114               PEGASUS_ASSERT(request != 0);
1115           
1116               CIMReferencesResponseMessage * response =
1117                   new CIMReferencesResponseMessage(
1118                   request->messageId,
1119                   CIMException(),
1120 chip  1.1         request->queueIds.copyAndPop(),
1121                   Array<CIMObject>());
1122           
1123               PEGASUS_ASSERT(response != 0);
1124           
1125               // preserve message key
1126               response->setKey(request->getKey());
1127           
1128               //  Set HTTP method in response from request
1129               response->setHttpMethod (request->getHttpMethod ());
1130           
1131               // create a handler for this request
1132               ReferencesResponseHandler handler(request, response);
1133           
1134               // process the request
1135               try
1136               {
1137                   Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE,
1138                       "DefaultProviderManager::handleReferencesRequest - Host name: $0  Name space: $1  Class name: $2",
1139                       System::getHostName(),
1140                       request->nameSpace.getString(),
1141 chip  1.1             request->objectName.getClassName().getString());
1142           
1143                   // make target object path
1144                   CIMObjectPath objectPath(
1145                       System::getHostName(),
1146                       request->nameSpace,
1147                       request->objectName.getClassName());
1148           
1149                   objectPath.setKeyBindings(request->objectName.getKeyBindings());
1150           
1151 chip  1.4         ProviderName name(
1152                       objectPath.toString(),
1153 chip  1.2             String::EMPTY,
1154                       String::EMPTY,
1155 chip  1.4             String::EMPTY,
1156                       0);
1157 chip  1.2 
1158 chip  1.4         name = findProvider(name);
1159 chip  1.2 
1160                   // get cached or load new provider module
1161                   OpProviderHolder ph =
1162                       providerManager.getProvider(name.getPhysicalName(), name.getLogicalName(), String::EMPTY);
1163           
1164                   // convert arguments
1165                   OperationContext context;
1166           
1167                   context.insert(IdentityContainer(request->userName));
1168                   context.insert(AcceptLanguageListContainer(request->acceptLanguages));
1169                   context.insert(ContentLanguageListContainer(request->contentLanguages));
1170           
1171                   STAT_GETSTARTTIME;
1172 chip  1.1 
1173 chip  1.2         PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
1174                       "Calling provider.references: " +
1175                       ph.GetProvider().getName());
1176 chip  1.1 
1177 chip  1.2         pm_service_op_lock op_lock(&ph.GetProvider());
1178 chip  1.1 
1179 chip  1.2         ph.GetProvider().references(
1180                       context,
1181                       objectPath,
1182                       request->resultClass,
1183                       request->role,
1184                       request->includeQualifiers,
1185                       request->includeClassOrigin,
1186                       request->propertyList.getPropertyNameArray(),
1187                       handler);
1188 chip  1.1 
1189 chip  1.2         STAT_PMS_PROVIDEREND;
1190 chip  1.1     }
1191               catch(CIMException & e)
1192               {
1193                   PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
1194                       "Exception: " + e.getMessage());
1195 chip  1.2 
1196 chip  1.1         handler.setStatus(e.getCode(), e.getContentLanguages(), e.getMessage()); // l10n
1197               }
1198               catch(Exception & e)
1199               {
1200                   PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
1201                       "Exception: " + e.getMessage());
1202 chip  1.2 
1203 chip  1.1         handler.setStatus(CIM_ERR_FAILED, e.getContentLanguages(), e.getMessage()); // l10n
1204               }
1205               catch(...)
1206               {
1207                   PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
1208                       "Exception: Unknown");
1209 chip  1.2 
1210 chip  1.1         handler.setStatus(CIM_ERR_FAILED, "Unknown error.");
1211               }
1212           
1213               PEG_METHOD_EXIT();
1214           
1215               return(response);
1216           }
1217           
1218           Message * DefaultProviderManager::handleReferenceNamesRequest(const Message * message) throw()
1219           {
1220               PEG_METHOD_ENTER(TRC_PROVIDERMANAGER, "DefaultProviderManager::handleReferenceNamesRequest");
1221           
1222               CIMReferenceNamesRequestMessage * request =
1223                   dynamic_cast<CIMReferenceNamesRequestMessage *>(const_cast<Message *>(message));
1224           
1225               PEGASUS_ASSERT(request != 0);
1226           
1227               CIMReferenceNamesResponseMessage * response =
1228                   new CIMReferenceNamesResponseMessage(
1229                   request->messageId,
1230                   CIMException(),
1231 chip  1.1         request->queueIds.copyAndPop(),
1232                   Array<CIMObjectPath>());
1233           
1234               // preserve message key
1235               response->setKey(request->getKey());
1236           
1237               //  Set HTTP method in response from request
1238               response->setHttpMethod (request->getHttpMethod ());
1239           
1240               // create a handler for this request
1241               ReferenceNamesResponseHandler handler(request, response);
1242           
1243               // process the request
1244               try
1245               {
1246                   Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE,
1247                       "DefaultProviderManager::handleReferenceNamesRequest - Host name: $0  Name space: $1  Class name: $2",
1248                       System::getHostName(),
1249                       request->nameSpace.getString(),
1250                       request->objectName.getClassName().getString());
1251           
1252 chip  1.1         // make target object path
1253                   CIMObjectPath objectPath(
1254                       System::getHostName(),
1255                       request->nameSpace,
1256                       request->objectName.getClassName());
1257           
1258                   objectPath.setKeyBindings(request->objectName.getKeyBindings());
1259           
1260 chip  1.4         ProviderName name(
1261                       objectPath.toString(),
1262 chip  1.2             String::EMPTY,
1263                       String::EMPTY,
1264 chip  1.4             String::EMPTY,
1265                       0);
1266 chip  1.1 
1267 chip  1.4         name = findProvider(name);
1268 chip  1.1 
1269 chip  1.2         // get cached or load new provider module
1270                   OpProviderHolder ph =
1271                       providerManager.getProvider(name.getPhysicalName(), name.getLogicalName(), String::EMPTY);
1272 chip  1.1 
1273 chip  1.2         // convert arguments
1274                   OperationContext context;
1275 chip  1.1 
1276 chip  1.2         context.insert(IdentityContainer(request->userName));
1277                   context.insert(AcceptLanguageListContainer(request->acceptLanguages));
1278                   context.insert(ContentLanguageListContainer(request->contentLanguages));
1279 chip  1.1 
1280 chip  1.2         STAT_GETSTARTTIME;
1281 chip  1.1 
1282 chip  1.2         PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
1283                       "Calling provider.referenceNames: " +
1284                       ph.GetProvider().getName());
1285 chip  1.1 
1286 chip  1.2         pm_service_op_lock op_lock(&ph.GetProvider());
1287 chip  1.1 
1288 chip  1.2         ph.GetProvider().referenceNames(
1289                       context,
1290                       objectPath,
1291                       request->resultClass,
1292                       request->role,
1293                       handler);
1294 chip  1.1 
1295 chip  1.2         STAT_PMS_PROVIDEREND;
1296 chip  1.1     }
1297               catch(CIMException & e)
1298               {
1299                   PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
1300                       "Exception: " + e.getMessage());
1301 chip  1.2 
1302 chip  1.1         handler.setStatus(e.getCode(), e.getContentLanguages(), e.getMessage()); // l10n
1303               }
1304               catch(Exception & e)
1305               {
1306                   PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
1307                       "Exception: " + e.getMessage());
1308 chip  1.2 
1309 chip  1.1         handler.setStatus(CIM_ERR_FAILED, e.getContentLanguages(), e.getMessage()); // l10n
1310               }
1311               catch(...)
1312               {
1313                   PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
1314                       "Exception: Unknown");
1315 chip  1.2 
1316 chip  1.1         handler.setStatus(CIM_ERR_FAILED, "Unknown error.");
1317               }
1318           
1319               PEG_METHOD_EXIT();
1320           
1321               return(response);
1322           }
1323           
1324           Message * DefaultProviderManager::handleGetPropertyRequest(const Message * message) throw()
1325           {
1326               PEG_METHOD_ENTER(TRC_PROVIDERMANAGER, "DefaultProviderManager::handleGetPropertyRequest");
1327           
1328               CIMGetPropertyRequestMessage * request =
1329                   dynamic_cast<CIMGetPropertyRequestMessage *>(const_cast<Message *>(message));
1330           
1331               PEGASUS_ASSERT(request != 0);
1332           
1333               // create response message
1334               CIMGetPropertyResponseMessage * response =
1335                   new CIMGetPropertyResponseMessage(
1336                   request->messageId,
1337 chip  1.1         CIMException(),
1338                   request->queueIds.copyAndPop(),
1339                   CIMValue());
1340           
1341               PEGASUS_ASSERT(response != 0);
1342           
1343               // preserve message key
1344               response->setKey(request->getKey());
1345           
1346               //  Set HTTP method in response from request
1347               response->setHttpMethod(request->getHttpMethod());
1348           
1349               GetPropertyResponseHandler handler(request, response);
1350           
1351               try
1352               {
1353                   Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE,
1354                       "DefaultProviderManager::handleGetPropertyRequest - Host name: $0  Name space: $1  Class name: $2",
1355                       System::getHostName(),
1356                       request->nameSpace.getString(),
1357                       request->instanceName.getClassName().getString());
1358 chip  1.1 
1359                   // make target object path
1360                   CIMObjectPath objectPath(
1361                       System::getHostName(),
1362                       request->nameSpace,
1363                       request->instanceName.getClassName(),
1364                       request->instanceName.getKeyBindings());
1365           
1366 chip  1.4         ProviderName name(
1367                       objectPath.toString(),
1368 chip  1.1             String::EMPTY,
1369                       String::EMPTY,
1370 chip  1.4             String::EMPTY,
1371                       0);
1372 chip  1.1 
1373 chip  1.4         name = findProvider(name);
1374 chip  1.1 
1375                   // get cached or load new provider module
1376                   OpProviderHolder ph =
1377                       providerManager.getProvider(name.getPhysicalName(), name.getLogicalName(), String::EMPTY);
1378           
1379                   // convert arguments
1380                   OperationContext context;
1381           
1382                   context.insert(IdentityContainer(request->userName));
1383                   context.insert(AcceptLanguageListContainer(request->acceptLanguages));
1384                   context.insert(ContentLanguageListContainer(request->contentLanguages));
1385           
1386                   CIMName propertyName = request->propertyName;
1387           
1388                   STAT_GETSTARTTIME;
1389           
1390                   PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
1391                       "Calling provider.getProperty: " +
1392                       ph.GetProvider().getName());
1393           
1394                   // forward request
1395 chip  1.1         pm_service_op_lock op_lock(&ph.GetProvider());
1396           
1397                   ph.GetProvider().getProperty(
1398                       context,
1399                       objectPath,
1400                       propertyName,
1401                       handler);
1402           
1403                   STAT_PMS_PROVIDEREND;
1404               }
1405               catch(CIMException & e)
1406               {
1407                   PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
1408                       "Exception: " + e.getMessage());
1409 chip  1.2 
1410 chip  1.1         handler.setStatus(e.getCode(), e.getContentLanguages(), e.getMessage()); // l10n
1411               }
1412               catch(Exception & e)
1413               {
1414                   PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
1415                       "Exception: " + e.getMessage());
1416 chip  1.2 
1417 chip  1.1         handler.setStatus(CIM_ERR_FAILED, e.getContentLanguages(), e.getMessage()); // l10n
1418               }
1419               catch(...)
1420               {
1421                   PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
1422                       "Exception: Unknown");
1423 chip  1.2 
1424 chip  1.1         handler.setStatus(CIM_ERR_FAILED, "Unknown error.");
1425               }
1426           
1427               PEG_METHOD_EXIT();
1428           
1429               return(response);
1430           }
1431           
1432           Message * DefaultProviderManager::handleSetPropertyRequest(const Message * message) throw()
1433           {
1434               PEG_METHOD_ENTER(TRC_PROVIDERMANAGER, "DefaultProviderManager::handleSetPropertyRequest");
1435           
1436               CIMSetPropertyRequestMessage * request =
1437                   dynamic_cast<CIMSetPropertyRequestMessage *>(const_cast<Message *>(message));
1438           
1439               PEGASUS_ASSERT(request != 0);
1440           
1441               // create response message
1442               //l10n
1443               CIMSetPropertyResponseMessage * response =
1444                   new CIMSetPropertyResponseMessage(
1445 chip  1.1         request->messageId,
1446                   PEGASUS_CIM_EXCEPTION_L(CIM_ERR_FAILED, MessageLoaderParms(
1447                   "ProviderManager.DefaultProviderManager.NOT_IMPLEMENTED",
1448                   "not implemented")),
1449                   request->queueIds.copyAndPop());
1450           
1451               PEGASUS_ASSERT(response != 0);
1452           
1453               // preserve message key
1454               response->setKey(request->getKey());
1455           
1456               //  Set HTTP method in response from request
1457               response->setHttpMethod(request->getHttpMethod());
1458           
1459               SetPropertyResponseHandler handler(request, response);
1460           
1461               try
1462               {
1463                   Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE,
1464                       "DefaultProviderManager::handleSetPropertyRequest - Host name: $0  Name space: $1  Class name: $2",
1465                       System::getHostName(),
1466 chip  1.1             request->nameSpace.getString(),
1467                       request->instanceName.getClassName().getString());
1468           
1469                   // make target object path
1470                   CIMObjectPath objectPath(
1471                       System::getHostName(),
1472                       request->nameSpace,
1473                       request->instanceName.getClassName(),
1474                       request->instanceName.getKeyBindings());
1475           
1476 chip  1.4         ProviderName name(
1477                       objectPath.toString(),
1478 chip  1.1             String::EMPTY,
1479                       String::EMPTY,
1480 chip  1.4             String::EMPTY,
1481                       0);
1482 chip  1.1 
1483 chip  1.4         name = findProvider(name);
1484 chip  1.1 
1485                   // get cached or load new provider module
1486                   OpProviderHolder ph =
1487                       providerManager.getProvider(name.getPhysicalName(), name.getLogicalName(), String::EMPTY);
1488           
1489                   // convert arguments
1490                   OperationContext context;
1491           
1492                   context.insert(IdentityContainer(request->userName));
1493                   context.insert(AcceptLanguageListContainer(request->acceptLanguages));
1494                   context.insert(ContentLanguageListContainer(request->contentLanguages));
1495           
1496                   CIMName propertyName = request->propertyName;
1497                   CIMValue propertyValue = request->newValue;
1498           
1499                   STAT_GETSTARTTIME;
1500           
1501                   PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
1502                       "Calling provider.setProperty: " +
1503                       ph.GetProvider().getName());
1504           
1505 chip  1.1         // forward request
1506                   pm_service_op_lock op_lock(&ph.GetProvider());
1507           
1508                   ph.GetProvider().setProperty(
1509                       context,
1510                       objectPath,
1511                       propertyName,
1512                       propertyValue,
1513                       handler);
1514           
1515                   STAT_PMS_PROVIDEREND;
1516               }
1517               catch(CIMException & e)
1518               {
1519                   PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
1520                       "Exception: " + e.getMessage());
1521 chip  1.2 
1522 chip  1.1         handler.setStatus(e.getCode(), e.getContentLanguages(), e.getMessage()); // l10n
1523               }
1524               catch(Exception & e)
1525               {
1526                   PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
1527                       "Exception: " + e.getMessage());
1528 chip  1.2 
1529 chip  1.1         handler.setStatus(CIM_ERR_FAILED, e.getContentLanguages(), e.getMessage()); // l10n
1530               }
1531               catch(...)
1532               {
1533                   PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
1534                       "Exception: Unknown");
1535 chip  1.2 
1536 chip  1.1         handler.setStatus(CIM_ERR_FAILED, "Unknown error.");
1537               }
1538           
1539               PEG_METHOD_EXIT();
1540           
1541               return(response);
1542           }
1543           
1544           Message * DefaultProviderManager::handleInvokeMethodRequest(const Message * message) throw()
1545           {
1546               PEG_METHOD_ENTER(TRC_PROVIDERMANAGER, "DefaultProviderManager::handleInvokeMethodRequest");
1547           
1548               CIMInvokeMethodRequestMessage * request =
1549                   dynamic_cast<CIMInvokeMethodRequestMessage *>(const_cast<Message *>(message));
1550           
1551               PEGASUS_ASSERT(request != 0);
1552           
1553               // create response message
1554               CIMInvokeMethodResponseMessage * response =
1555                   new CIMInvokeMethodResponseMessage(
1556                   request->messageId,
1557 chip  1.1         CIMException(),
1558                   request->queueIds.copyAndPop(),
1559                   CIMValue(),
1560                   Array<CIMParamValue>(),
1561                   request->methodName);
1562           
1563               PEGASUS_ASSERT(response != 0);
1564           
1565               // propagate message key
1566               response->setKey(request->getKey());
1567           
1568               //  Set HTTP method in response from request
1569               response->setHttpMethod (request->getHttpMethod ());
1570           
1571               // create a handler for this request
1572               InvokeMethodResponseHandler handler(request, response);
1573           
1574               try
1575               {
1576                   Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE,
1577                       "DefaultProviderManager::handleInvokeMethodRequest - Host name: $0  Name space: $1  Class name: $2",
1578 chip  1.1             System::getHostName(),
1579                       request->nameSpace.getString(),
1580                       request->instanceName.getClassName().getString());
1581           
1582                   // make target object path
1583                   CIMObjectPath objectPath(
1584                       System::getHostName(),
1585                       request->nameSpace,
1586                       request->instanceName.getClassName(),
1587                       request->instanceName.getKeyBindings());
1588           
1589 chip  1.4         ProviderName name(
1590                       objectPath.toString(),
1591 chip  1.1             String::EMPTY,
1592                       String::EMPTY,
1593 chip  1.4             String::EMPTY,
1594                       0);
1595 chip  1.1 
1596 chip  1.4         name = findProvider(name);
1597 chip  1.1 
1598                   // get cached or load new provider module
1599                   OpProviderHolder ph =
1600                       providerManager.getProvider(name.getPhysicalName(), name.getLogicalName(), String::EMPTY);
1601           
1602                   // convert arguments
1603                   OperationContext context;
1604           
1605                   context.insert(IdentityContainer(request->userName));
1606                   context.insert(AcceptLanguageListContainer(request->acceptLanguages));
1607                   context.insert(ContentLanguageListContainer(request->contentLanguages));
1608           
1609                   CIMObjectPath instanceReference(request->instanceName);
1610           
1611                   // ATTN: propagate namespace
1612                   instanceReference.setNameSpace(request->nameSpace);
1613           
1614                   // forward request
1615                   STAT_GETSTARTTIME;
1616           
1617                   PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
1618 chip  1.1             "Calling provider.invokeMethod: " +
1619                       ph.GetProvider().getName());
1620           
1621                   pm_service_op_lock op_lock(&ph.GetProvider());
1622           
1623                   ph.GetProvider().invokeMethod(
1624                       context,
1625                       instanceReference,
1626                       request->methodName,
1627                       request->inParameters,
1628                       handler);
1629           
1630                   STAT_PMS_PROVIDEREND;
1631               }
1632               catch(CIMException & e)
1633               {
1634                   PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
1635                       "Exception: " + e.getMessage());
1636 chip  1.2 
1637 chip  1.1         handler.setStatus(e.getCode(), e.getContentLanguages(), e.getMessage()); // l10n
1638               }
1639               catch(Exception & e)
1640               {
1641                   PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
1642                       "Exception: " + e.getMessage());
1643 chip  1.2 
1644 chip  1.1         handler.setStatus(CIM_ERR_FAILED, e.getContentLanguages(), e.getMessage()); // l10n
1645               }
1646               catch(...)
1647               {
1648                   PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
1649                       "Exception: Unknown");
1650 chip  1.2 
1651 chip  1.1         handler.setStatus(CIM_ERR_FAILED, "Unknown error.");
1652               }
1653           
1654               PEG_METHOD_EXIT();
1655           
1656               return(response);
1657           }
1658           
1659           Message * DefaultProviderManager::handleCreateSubscriptionRequest(const Message * message) throw()
1660           {
1661               PEG_METHOD_ENTER(TRC_PROVIDERMANAGER, "DefaultProviderManager::handleCreateSubscriptionRequest");
1662           
1663               CIMCreateSubscriptionRequestMessage * request =
1664                   dynamic_cast<CIMCreateSubscriptionRequestMessage *>(const_cast<Message *>(message));
1665           
1666               PEGASUS_ASSERT(request != 0);
1667           
1668               CIMCreateSubscriptionResponseMessage * response =
1669                   new CIMCreateSubscriptionResponseMessage(
1670                   request->messageId,
1671                   CIMException(),
1672 chip  1.1         request->queueIds.copyAndPop());
1673           
1674               PEGASUS_ASSERT(response != 0);
1675           
1676               // preserve message key
1677               response->setKey(request->getKey());
1678           
1679               //  Set HTTP method in response from request
1680               response->setHttpMethod (request->getHttpMethod ());
1681           
1682               OperationResponseHandler handler(request, response);
1683           
1684               try
1685               {
1686 chip  1.2         String temp;
1687           
1688                   for(Uint32 i = 0, n = request->classNames.size(); i < n; i++)
1689                   {
1690                       temp.append(request->classNames[i].getString());
1691           
1692                       if(i == (n - 1))
1693                       {
1694                           temp.append(", ");
1695                       }
1696                   }
1697           
1698                   Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE,
1699                       "DefaultProviderManager::handleCreateSubscriptionRequest - Host name: $0  Name space: $1  Class name(s): $2",
1700                       System::getHostName(),
1701                       request->nameSpace.getString(),
1702                       temp);
1703           
1704                   // NOTE: the provider and provider module name are embedded in the request, presumably to reduce
1705                   // the number of provider lookups (but this should be trivial if the data is cached and accessed
1706                   // from the same source). to keep the lookups consistent, use the first class name, combined
1707 chip  1.2         // with the other information in the request, and create an object path that can be used to
1708                   // resolve the provider using the ProviderRegistrar.
1709           
1710                   // make target object path
1711                   CIMObjectPath objectPath(
1712                       System::getHostName(),
1713                       request->nameSpace,
1714                       request->classNames[0].getString());
1715 chip  1.1 
1716 chip  1.4         ProviderName name(
1717                       objectPath.toString(),
1718 chip  1.1             String::EMPTY,
1719                       String::EMPTY,
1720 chip  1.4             String::EMPTY,
1721                       0);
1722 chip  1.1 
1723 chip  1.4         name = findProvider(name);
1724 chip  1.1 
1725                   // get cached or load new provider module
1726                   OpProviderHolder ph =
1727                       providerManager.getProvider(name.getPhysicalName(), name.getLogicalName(), String::EMPTY);
1728           
1729                   // convert arguments
1730                   OperationContext context;
1731           
1732                   context.insert(IdentityContainer(request->userName));
1733                   context.insert(SubscriptionInstanceContainer
1734                       (request->subscriptionInstance));
1735                   context.insert(SubscriptionFilterConditionContainer
1736                       (request->condition, request->queryLanguage));
1737                   context.insert(SubscriptionLanguageListContainer
1738                       (request->acceptLanguages));
1739                   context.insert(AcceptLanguageListContainer(request->acceptLanguages));
1740                   context.insert(ContentLanguageListContainer(request->contentLanguages));
1741           
1742                   CIMObjectPath subscriptionName = request->subscriptionInstance.getPath();
1743           
1744                   Array<CIMObjectPath> classNames;
1745 chip  1.1 
1746                   for(Uint32 i = 0, n = request->classNames.size(); i < n; i++)
1747                   {
1748                       CIMObjectPath className(
1749                           System::getHostName(),
1750                           request->nameSpace,
1751                           request->classNames[i]);
1752           
1753                       classNames.append(className);
1754                   }
1755           
1756                   CIMPropertyList propertyList = request->propertyList;
1757           
1758                   Uint16 repeatNotificationPolicy = request->repeatNotificationPolicy;
1759           
1760                   PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
1761                       "Calling provider.createSubscription: " +
1762                       ph.GetProvider().getName());
1763           
1764                   pm_service_op_lock op_lock(&ph.GetProvider());
1765           
1766 chip  1.1         ph.GetProvider().createSubscription(
1767                       context,
1768                       subscriptionName,
1769                       classNames,
1770                       propertyList,
1771                       repeatNotificationPolicy);
1772               }
1773               catch(CIMException & e)
1774               {
1775                   PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
1776                       "Exception: " + e.getMessage());
1777 chip  1.2 
1778 chip  1.1         handler.setStatus(e.getCode(), e.getContentLanguages(), e.getMessage()); // l10n
1779               }
1780               catch(Exception & e)
1781               {
1782                   PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
1783                       "Exception: " + e.getMessage());
1784 chip  1.2 
1785 chip  1.1         handler.setStatus(CIM_ERR_FAILED, e.getContentLanguages(), e.getMessage()); // l10n
1786               }
1787               catch(...)
1788               {
1789                   PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
1790                       "Exception: Unknown");
1791 chip  1.2 
1792 chip  1.1         handler.setStatus(CIM_ERR_FAILED, "Unknown Error");
1793               }
1794           
1795               PEG_METHOD_EXIT();
1796           
1797               return(response);
1798           }
1799           
1800           Message * DefaultProviderManager::handleModifySubscriptionRequest( const Message * message) throw()
1801           {
1802               PEG_METHOD_ENTER(TRC_PROVIDERMANAGER, "DefaultProviderManager::handleModifySubscriptionRequest");
1803           
1804               CIMModifySubscriptionRequestMessage * request =
1805                   dynamic_cast<CIMModifySubscriptionRequestMessage *>(const_cast<Message *>(message));
1806           
1807               PEGASUS_ASSERT(request != 0);
1808           
1809               CIMModifySubscriptionResponseMessage * response =
1810                   new CIMModifySubscriptionResponseMessage(
1811                   request->messageId,
1812                   CIMException(),
1813 chip  1.1         request->queueIds.copyAndPop());
1814           
1815               PEGASUS_ASSERT(response != 0);
1816           
1817               // preserve message key
1818               response->setKey(request->getKey());
1819           
1820               //  Set HTTP method in response from request
1821               response->setHttpMethod (request->getHttpMethod ());
1822           
1823               OperationResponseHandler handler(request, response);
1824           
1825               try
1826               {
1827 chip  1.2         String temp;
1828           
1829                   for(Uint32 i = 0, n = request->classNames.size(); i < n; i++)
1830                   {
1831                       temp.append(request->classNames[i].getString());
1832           
1833                       if(i == (n - 1))
1834                       {
1835                           temp.append(", ");
1836                       }
1837                   }
1838           
1839                   Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE,
1840                       "DefaultProviderManager::handleModifySubscriptionRequest - Host name: $0  Name space: $1  Class name(s): $2",
1841                       System::getHostName(),
1842                       request->nameSpace.getString(),
1843                       temp);
1844           
1845                   // NOTE: the provider and provider module name are embedded in the request, presumably to reduce
1846                   // the number of provider lookups (but this should be trivial if the data is cached and accessed
1847                   // from the same source). to keep the lookups consistent, use the first class name, combined
1848 chip  1.2         // with the other information in the request, and create an object path that can be used to
1849                   // resolve the provider using the ProviderRegistrar.
1850           
1851                   // make target object path
1852                   CIMObjectPath objectPath(
1853                       System::getHostName(),
1854                       request->nameSpace,
1855                       request->classNames[0].getString());
1856 chip  1.1 
1857 chip  1.4         ProviderName name(
1858                       objectPath.toString(),
1859 chip  1.1             String::EMPTY,
1860                       String::EMPTY,
1861 chip  1.4             String::EMPTY,
1862                       0);
1863 chip  1.1 
1864 chip  1.4         name = findProvider(name);
1865 chip  1.1 
1866                   // get cached or load new provider module
1867                   OpProviderHolder ph =
1868                       providerManager.getProvider(name.getPhysicalName(), name.getLogicalName(), String::EMPTY);
1869           
1870                   // convert arguments
1871                   OperationContext context;
1872           
1873                   context.insert(IdentityContainer(request->userName));
1874                   context.insert(SubscriptionInstanceContainer
1875                       (request->subscriptionInstance));
1876                   context.insert(SubscriptionFilterConditionContainer
1877                       (request->condition, request->queryLanguage));
1878                   context.insert(SubscriptionLanguageListContainer
1879                       (request->acceptLanguages));
1880                   context.insert(AcceptLanguageListContainer(request->acceptLanguages));
1881                   context.insert(ContentLanguageListContainer(request->contentLanguages));
1882           
1883                   CIMObjectPath subscriptionName = request->subscriptionInstance.getPath();
1884           
1885                   Array<CIMObjectPath> classNames;
1886 chip  1.1 
1887                   for(Uint32 i = 0, n = request->classNames.size(); i < n; i++)
1888                   {
1889                       CIMObjectPath className(
1890                           System::getHostName(),
1891                           request->nameSpace,
1892                           request->classNames[i]);
1893           
1894                       classNames.append(className);
1895                   }
1896           
1897                   CIMPropertyList propertyList = request->propertyList;
1898           
1899                   Uint16 repeatNotificationPolicy = request->repeatNotificationPolicy;
1900           
1901                   PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
1902                       "Calling provider.modifySubscription: " +
1903                       ph.GetProvider().getName());
1904           
1905                   pm_service_op_lock op_lock(&ph.GetProvider());
1906           
1907 chip  1.1         ph.GetProvider().modifySubscription(
1908                       context,
1909                       subscriptionName,
1910                       classNames,
1911                       propertyList,
1912                       repeatNotificationPolicy);
1913               }
1914               catch(CIMException & e)
1915               {
1916                   PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
1917                       "Exception: " + e.getMessage());
1918 chip  1.2 
1919 chip  1.1         handler.setStatus(e.getCode(), e.getContentLanguages(), e.getMessage()); // l10n
1920               }
1921               catch(Exception & e)
1922               {
1923                   PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
1924                       "Exception: " + e.getMessage());
1925 chip  1.2 
1926 chip  1.1         handler.setStatus(CIM_ERR_FAILED, e.getContentLanguages(), e.getMessage()); // l10n
1927               }
1928               catch(...)
1929               {
1930                   PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
1931                       "Exception: Unknown");
1932 chip  1.2 
1933 chip  1.1         handler.setStatus(CIM_ERR_FAILED, "Unknown Error");
1934               }
1935           
1936               PEG_METHOD_EXIT();
1937           
1938               return(response);
1939           }
1940           
1941           Message * DefaultProviderManager::handleDeleteSubscriptionRequest(const Message * message) throw()
1942           {
1943               PEG_METHOD_ENTER(TRC_PROVIDERMANAGER, "DefaultProviderManager::handleDeleteSubscriptionRequest");
1944           
1945               CIMDeleteSubscriptionRequestMessage * request =
1946                   dynamic_cast<CIMDeleteSubscriptionRequestMessage *>(const_cast<Message *>(message));
1947           
1948               PEGASUS_ASSERT(request != 0);
1949           
1950               CIMDeleteSubscriptionResponseMessage * response =
1951                   new CIMDeleteSubscriptionResponseMessage(
1952                   request->messageId,
1953                   CIMException(),
1954 chip  1.1         request->queueIds.copyAndPop());
1955           
1956               PEGASUS_ASSERT(response != 0);
1957           
1958               // preserve message key
1959               response->setKey(request->getKey());
1960           
1961               //  Set HTTP method in response from request
1962               response->setHttpMethod(request->getHttpMethod());
1963           
1964               OperationResponseHandler handler(request, response);
1965           
1966               try
1967               {
1968 chip  1.2         String temp;
1969           
1970                   for(Uint32 i = 0, n = request->classNames.size(); i < n; i++)
1971                   {
1972                       temp.append(request->classNames[i].getString());
1973           
1974                       if(i == (n - 1))
1975                       {
1976                           temp.append(", ");
1977                       }
1978                   }
1979           
1980                   Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE,
1981                       "DefaultProviderManager::handleDeleteSubscriptionRequest - Host name: $0  Name space: $1  Class name(s): $2",
1982                       System::getHostName(),
1983                       request->nameSpace.getString(),
1984                       temp);
1985           
1986                   // NOTE: the provider and provider module name are embedded in the request, presumably to reduce
1987                   // the number of provider lookups (but this should be trivial if the data is cached and accessed
1988                   // from the same source). to keep the lookups consistent, use the first class name, combined
1989 chip  1.2         // with the other information in the request, and create an object path that can be used to
1990                   // resolve the provider using the ProviderRegistrar.
1991           
1992                   // make target object path
1993                   CIMObjectPath objectPath(
1994                       System::getHostName(),
1995                       request->nameSpace,
1996                       request->classNames[0].getString());
1997 chip  1.1 
1998 chip  1.4         ProviderName name(
1999                       objectPath.toString(),
2000 chip  1.1             String::EMPTY,
2001                       String::EMPTY,
2002 chip  1.4             String::EMPTY,
2003                       0);
2004 chip  1.1 
2005 chip  1.4         name = findProvider(name);
2006 chip  1.1 
2007                   // get cached or load new provider module
2008                   OpProviderHolder ph =
2009                       providerManager.getProvider(name.getPhysicalName(), name.getLogicalName(), String::EMPTY);
2010           
2011                   // convert arguments
2012                   OperationContext context;
2013           
2014                   context.insert(IdentityContainer(request->userName));
2015                   context.insert(SubscriptionInstanceContainer
2016                       (request->subscriptionInstance));
2017                   context.insert(SubscriptionLanguageListContainer
2018                       (request->acceptLanguages));
2019                   context.insert(AcceptLanguageListContainer(request->acceptLanguages));
2020                   context.insert(ContentLanguageListContainer(request->contentLanguages));
2021           
2022                   CIMObjectPath subscriptionName = request->subscriptionInstance.getPath();
2023           
2024                   Array<CIMObjectPath> classNames;
2025           
2026                   for(Uint32 i = 0, n = request->classNames.size(); i < n; i++)
2027 chip  1.1         {
2028                       CIMObjectPath className(
2029                           System::getHostName(),
2030                           request->nameSpace,
2031                           request->classNames[i]);
2032           
2033                       classNames.append(className);
2034                   }
2035           
2036                   PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
2037                       "Calling provider.deleteSubscription: " +
2038                       ph.GetProvider().getName());
2039           
2040                   pm_service_op_lock op_lock(&ph.GetProvider());
2041           
2042                   ph.GetProvider().deleteSubscription(
2043                       context,
2044                       subscriptionName,
2045                       classNames);
2046               }
2047               catch(CIMException & e)
2048 chip  1.1     {
2049                   PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
2050                       "Exception: " + e.getMessage());
2051 chip  1.2 
2052 chip  1.1         handler.setStatus(e.getCode(), e.getContentLanguages(), e.getMessage()); // l10n
2053               }
2054               catch(Exception & e)
2055               {
2056                   PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
2057                       "Exception: " + e.getMessage());
2058 chip  1.2 
2059 chip  1.1         handler.setStatus(CIM_ERR_FAILED, e.getContentLanguages(), e.getMessage()); // l10n
2060               }
2061               catch(...)
2062               {
2063                   PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
2064                       "Exception: Unknown");
2065 chip  1.2 
2066 chip  1.1         handler.setStatus(CIM_ERR_FAILED, "Unknown Error");
2067               }
2068           
2069               PEG_METHOD_EXIT();
2070           
2071               return(response);
2072           }
2073           
2074           Message * DefaultProviderManager::handleEnableIndicationsRequest(const Message * message) throw()
2075           {
2076               PEG_METHOD_ENTER(TRC_PROVIDERMANAGER, "DefaultProviderManager:: handleEnableIndicationsRequest");
2077           
2078               CIMEnableIndicationsRequestMessage * request =
2079                   dynamic_cast<CIMEnableIndicationsRequestMessage *>(const_cast<Message *>(message));
2080           
2081               PEGASUS_ASSERT(request != 0);
2082           
2083               CIMEnableIndicationsResponseMessage * response =
2084                   new CIMEnableIndicationsResponseMessage(
2085                   request->messageId,
2086                   CIMException(),
2087 chip  1.1         request->queueIds.copyAndPop());
2088           
2089               CIMEnableIndicationsResponseMessage * responseforhandler =
2090                   new CIMEnableIndicationsResponseMessage(
2091                   request->messageId,
2092                   CIMException(),
2093                   request->queueIds.copyAndPop());
2094           
2095               PEGASUS_ASSERT(response != 0);
2096           
2097               // preserve message key
2098               response->setKey(request->getKey());
2099           
2100               //  Set HTTP method in response from request
2101               response->setHttpMethod(request->getHttpMethod());
2102           
2103               response->dest = request->queueIds.top();
2104           
2105               /*
2106               // ATTN: need pointer to Provider Manager Server!
2107               //EnableIndicationsResponseHandler *handler =
2108 chip  1.1     //    new EnableIndicationsResponseHandler(request, response, this);
2109           
2110               try
2111               {
2112                   // get the provider file name and logical name
2113                   Triad<String, String, String> triad =
2114                       _getProviderRegPair(request->provider, request->providerModule);
2115           
2116                   // get cached or load new provider module
2117                   //Provider provider =
2118                   OpProviderHolder ph =
2119                       providerManager.getProvider(triad.first, triad.second, triad.third);
2120           
2121                   PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
2122                       "Calling provider.enableIndications: " +
2123                       ph.GetProvider().getName());
2124                   ph.GetProvider().protect();
2125                   ph.GetProvider().enableIndications(*handler);
2126           
2127           
2128                   // if no exception, store the handler so it is persistent for as
2129 chip  1.1         // long as the provider has indications enabled.
2130                   PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
2131                       "Storing indication handler for " + ph.GetProvider().getName());
2132           
2133                   _insertEntry(ph.GetProvider(), handler);
2134               }
2135               catch(CIMException & e)
2136               {
2137                   PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
2138                       "Exception: " + e.getMessage());
2139                   response->cimException = CIMException(e);
2140               }
2141               catch(Exception & e)
2142               {
2143                   PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
2144                       "Exception: " + e.getMessage());
2145                   //l10n
2146                   //response->cimException = CIMException(CIM_ERR_FAILED, "Internal Error");
2147                   response->cimException = CIMException(CIM_ERR_FAILED, MessageLoaderParms(
2148                       "ProviderManager.DefaultProviderManager.INTERNAL_ERROR",
2149                       "Internal Error"));
2150 chip  1.1     }
2151               catch(...)
2152               {
2153                   PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
2154                       "Exception: Unknown");
2155                   //l10n
2156                   //response->cimException = CIMException(CIM_ERR_FAILED, "Unknown Error");
2157                   response->cimException = CIMException(CIM_ERR_FAILED, MessageLoaderParms(
2158                       "ProviderManager.DefaultProviderManager.UNKNOWN_ERROR",
2159                       "Unknown Error"));
2160               }
2161               */
2162           
2163               PEG_METHOD_EXIT();
2164           
2165               return(response);
2166           }
2167           
2168           Message * DefaultProviderManager::handleDisableIndicationsRequest(const Message * message) throw()
2169           {
2170               PEG_METHOD_ENTER(TRC_PROVIDERMANAGER, "DefaultProviderManager::handleDisableIndicationsRequest");
2171 chip  1.1 
2172               CIMDisableIndicationsRequestMessage * request =
2173                   dynamic_cast<CIMDisableIndicationsRequestMessage *>(const_cast<Message *>(message));
2174           
2175               PEGASUS_ASSERT(request != 0);
2176           
2177               CIMDisableIndicationsResponseMessage * response =
2178                   new CIMDisableIndicationsResponseMessage(
2179                   request->messageId,
2180                   CIMException(),
2181                   request->queueIds.copyAndPop());
2182           
2183               PEGASUS_ASSERT(response != 0);
2184           
2185               // preserve message key
2186               response->setKey(request->getKey());
2187           
2188               //  Set HTTP method in response from request
2189               response->setHttpMethod (request->getHttpMethod ());
2190           
2191               OperationResponseHandler handler(request, response);
2192 chip  1.1 
2193               try
2194               {
2195 chip  1.4         ProviderName name("");
2196 chip  1.1 
2197                   /*
2198 chip  1.4         ProviderName name(
2199 chip  1.1             String::EMPTY,
2200                       String::EMPTY,
2201                       objectPath.toString());
2202           
2203 chip  1.4         name = findProvider(name);
2204 chip  1.1         */
2205           
2206                   // get cached or load new provider module
2207                   OpProviderHolder ph =
2208                       providerManager.getProvider(name.getPhysicalName(), name.getLogicalName(), String::EMPTY);
2209           
2210                   /*
2211                   // get the provider file name and logical name
2212                   Triad<String, String, String> triad =
2213                       getProviderRegistrar()->_getProviderRegPair(request->provider, request->providerModule);
2214           
2215                   // get cached or load new provider module
2216                   //Provider provider =
2217                   OpProviderHolder ph =
2218                       providerManager.getProvider(triad.first, triad.second, triad.third);
2219                   */
2220           
2221                   PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
2222                       "Calling provider.disableIndications: " +
2223                       ph.GetProvider().getName());
2224           
2225 chip  1.1         ph.GetProvider().disableIndications();
2226           
2227                   ph.GetProvider().unprotect();
2228           
2229                   PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
2230                       "Removing and Destroying indication handler for " +
2231                       ph.GetProvider().getName());
2232           
2233                   delete _removeEntry(_generateKey(ph.GetProvider()));
2234               }
2235           
2236               catch(CIMException & e)
2237               {
2238                   PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
2239                       "Exception: " + e.getMessage());
2240 chip  1.2 
2241 chip  1.1         response->cimException = CIMException(e);
2242               }
2243               catch(Exception & e)
2244               {
2245                   PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
2246                       "Exception: " + e.getMessage());
2247 chip  1.2             response->cimException = CIMException(CIM_ERR_FAILED, MessageLoaderParms(
2248 chip  1.1             "ProviderManager.DefaultProviderManager.INTERNAL_ERROR",
2249                       "Internal Error"));
2250               }
2251               catch(...)
2252               {
2253                   PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
2254                       "Exception: Unknown");
2255 chip  1.2             response->cimException = CIMException(CIM_ERR_FAILED, MessageLoaderParms(
2256 chip  1.1             "ProviderManager.DefaultProviderManager.UNKNOWN_ERROR",
2257                       "Unknown Error"));
2258               }
2259           
2260               PEG_METHOD_EXIT();
2261           
2262               return(response);
2263           }
2264           
2265           Message * DefaultProviderManager::handleConsumeIndicationRequest(const Message *message) throw()
2266           {
2267               PEG_METHOD_ENTER(TRC_PROVIDERMANAGER, "DefaultProviderManager::handlConsumeIndicationRequest");
2268           
2269               CIMConsumeIndicationRequestMessage *request =
2270                   dynamic_cast<CIMConsumeIndicationRequestMessage *>(const_cast<Message *>(message));
2271           
2272               PEGASUS_ASSERT(request != 0);
2273           
2274               CIMResponseMessage * response =
2275                   new CIMResponseMessage(
2276                   CIM_CONSUME_INDICATION_RESPONSE_MESSAGE,
2277 chip  1.1         request->messageId,
2278                   CIMException(),
2279                   request->queueIds.copyAndPop());
2280           
2281               PEGASUS_ASSERT(response != 0);
2282           
2283               response->setKey(request->getKey());
2284           
2285               //  Set HTTP method in response from request
2286               response->setHttpMethod (request->getHttpMethod ());
2287           
2288               Uint32 type = 3;
2289           
2290               try
2291               {
2292 chip  1.4         ProviderName name("");
2293 chip  1.1 
2294                   /*
2295 chip  1.4         ProviderName name(
2296 chip  1.1             String::EMPTY,
2297                       String::EMPTY,
2298                       objectPath.toString());
2299           
2300 chip  1.4         name = findProvider(name);
2301 chip  1.1         */
2302           
2303                   // get cached or load new provider module
2304                   OpProviderHolder ph =
2305                       providerManager.getProvider(name.getPhysicalName(), name.getLogicalName(), String::EMPTY);
2306           
2307                   PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
2308                       "Calling provider.: " +
2309                       ph.GetProvider().getName());
2310           
2311                   OperationContext context;
2312           
2313                   //l10n
2314                   // ATTN-CEC 06/04/03 NOTE: I can't find where the consume msg is sent.  This
2315                   // does not appear to be hooked-up.  When it is added, need to
2316                   // make sure that Content-Language is set in the consume msg.
2317                   // NOTE: A-L is not needed to be set in the consume msg.
2318                   // add the langs to the context
2319                   context.insert(ContentLanguageListContainer(request->contentLanguages));
2320           
2321                   CIMInstance indication_copy = request->indicationInstance;
2322 chip  1.1 
2323                   SimpleIndicationResponseHandler handler;
2324           
2325                   ph.GetProvider().consumeIndication(context,
2326                       "",
2327                       indication_copy);
2328               }
2329               catch(CIMException & e)
2330               {
2331                   PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
2332                       "Exception: " + e.getMessage());
2333 chip  1.2 
2334 chip  1.1         response->cimException = CIMException(e);
2335               }
2336               catch(Exception & e)
2337               {
2338                   PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
2339                       "Exception: " + e.getMessage());
2340                   //l10n
2341                   //response->cimException = CIMException(CIM_ERR_FAILED, "Internal Error");
2342                   response->cimException = CIMException(CIM_ERR_FAILED, MessageLoaderParms(
2343                       "ProviderManager.DefaultProviderManager.INTERNAL_ERROR",
2344                       "Internal Error"));
2345               }
2346               catch(...)
2347               {
2348                   PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
2349                       "Exception: Unknown");
2350                   //l10n
2351                   //response->cimException = CIMException(CIM_ERR_FAILED, "Unknown Error");
2352                   response->cimException = CIMException(CIM_ERR_FAILED, MessageLoaderParms(
2353                       "ProviderManager.DefaultProviderManager.UNKNOWN_ERROR",
2354                       "Unknown Error"));
2355 chip  1.1     }
2356           
2357               PEG_METHOD_EXIT();
2358           
2359               return(response);
2360           }
2361           
2362           //
2363           // This function disables a provider module if disableProviderOnly is not true,
2364           // otherwise, disables a provider. Disable provider module means that
2365           // block all the providers which contain in the module and unload the
2366           // providers.
2367           // Disable provider means unload the provider and the provider is not blocked.
2368           //
2369           // ATTN-YZ-P2-20030519: Provider needs to be blocked when disable a provider.
2370           //
2371           Message * DefaultProviderManager::handleDisableModuleRequest(const Message * message) throw()
2372           {
2373               // HACK
2374 chip  1.4     ProviderRegistrationManager * _providerRegistrationManager = GetProviderRegistrationManager();
2375 chip  1.1 
2376               PEG_METHOD_ENTER(TRC_PROVIDERMANAGER, "DefaultProviderManager::handleDisableModuleRequest");
2377           
2378               CIMDisableModuleRequestMessage * request =
2379                   dynamic_cast<CIMDisableModuleRequestMessage *>(const_cast<Message *>(message));
2380           
2381               PEGASUS_ASSERT(request != 0);
2382           
2383               // get provider module name
2384               String moduleName;
2385               CIMInstance mInstance = request->providerModule;
2386               Uint32 pos = mInstance.findProperty(CIMName ("Name"));
2387           
2388               if(pos != PEG_NOT_FOUND)
2389               {
2390                   mInstance.getProperty(pos).getValue().get(moduleName);
2391               }
2392           
2393               Boolean disableProviderOnly = request->disableProviderOnly;
2394           
2395               //
2396 chip  1.1     // get operational status
2397               //
2398               Array<Uint16> operationalStatus;
2399           
2400               if(!disableProviderOnly)
2401               {
2402                   Uint32 pos2 = mInstance.findProperty(CIMName ("OperationalStatus"));
2403 chip  1.2 
2404 chip  1.1         if(pos2 != PEG_NOT_FOUND)
2405                   {
2406                       //
2407                       //  ATTN-CAKG-P2-20020821: Check for null status?
2408                       //
2409                       mInstance.getProperty(pos2).getValue().get(operationalStatus);
2410                   }
2411           
2412                   //
2413                   // update module status from OK to Stopping
2414                   //
2415                   for(Uint32 i=0, n = operationalStatus.size(); i < n; i++)
2416                   {
2417                       if(operationalStatus[i] == _MODULE_OK)
2418                       {
2419                           operationalStatus.remove(i);
2420                       }
2421                   }
2422                   operationalStatus.append(_MODULE_STOPPING);
2423           
2424                   if(_providerRegistrationManager->setProviderModuleStatus
2425 chip  1.1             (moduleName, operationalStatus) == false)
2426                   {
2427                       //l10n
2428                       //throw PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED, "set module status failed.");
2429                       throw PEGASUS_CIM_EXCEPTION_L(CIM_ERR_FAILED, MessageLoaderParms(
2430                           "ProviderManager.DefaultProviderManager.SET_MODULE_STATUS_FAILED",
2431                           "set module status failed."));
2432                   }
2433               }
2434           
2435               // Unload providers
2436               Array<CIMInstance> _pInstances = request->providers;
2437           
2438               for(Uint32 i = 0, n = _pInstances.size(); i < n; i++)
2439               {
2440                   /* temp disabled by Chip
2441                   // get the provider file name and logical name
2442                   Triad<String, String, String> triad =
2443                       getProviderRegistrar()->_getProviderRegPair(_pInstances[i], mInstance);
2444           
2445                   providerManager.unloadProvider(triad.first, triad.second);
2446 chip  1.1         */
2447               }
2448           
2449               if(!disableProviderOnly)
2450               {
2451                   // update module status from Stopping to Stopped
2452                   for(Uint32 i=0, n = operationalStatus.size(); i < n; i++)
2453                   {
2454                       if(operationalStatus[i] == _MODULE_STOPPING)
2455                       {
2456                           operationalStatus.remove(i);
2457                       }
2458                   }
2459 chip  1.2 
2460 chip  1.1         operationalStatus.append(_MODULE_STOPPED);
2461           
2462                   if(_providerRegistrationManager->setProviderModuleStatus
2463                       (moduleName, operationalStatus) == false)
2464                   {
2465                       //l10n
2466                       //throw PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED,
2467                       //"set module status failed.");
2468                       throw PEGASUS_CIM_EXCEPTION_L(CIM_ERR_FAILED, MessageLoaderParms(
2469                           "ProviderManager.DefaultProviderManager.SET_MODULE_STATUS_FAILED",
2470                           "set module status failed."));
2471                   }
2472               }
2473           
2474               CIMDisableModuleResponseMessage * response =
2475                   new CIMDisableModuleResponseMessage(
2476                   request->messageId,
2477                   CIMException(),
2478                   request->queueIds.copyAndPop(),
2479                   operationalStatus);
2480           
2481 chip  1.1     PEGASUS_ASSERT(response != 0);
2482           
2483               // preserve message key
2484               response->setKey(request->getKey());
2485           
2486               //
2487               //  Set HTTP method in response from request
2488               //
2489               response->setHttpMethod (request->getHttpMethod ());
2490           
2491               PEG_METHOD_EXIT();
2492           
2493               return(response);
2494           }
2495           
2496           Message * DefaultProviderManager::handleEnableModuleRequest(const Message * message) throw()
2497           {
2498               // HACK
2499 chip  1.4     ProviderRegistrationManager * _providerRegistrationManager = GetProviderRegistrationManager();
2500 chip  1.1 
2501               PEG_METHOD_ENTER(TRC_PROVIDERMANAGER, "DefaultProviderManager::handleEnableModuleRequest");
2502           
2503               CIMEnableModuleRequestMessage * request =
2504                   dynamic_cast<CIMEnableModuleRequestMessage *>(const_cast<Message *>(message));
2505           
2506               PEGASUS_ASSERT(request != 0);
2507           
2508               //
2509               // get module status
2510               //
2511               CIMInstance mInstance = request->providerModule;
2512               Array<Uint16> operationalStatus;
2513               Uint32 pos = mInstance.findProperty(CIMName ("OperationalStatus"));
2514           
2515               if(pos != PEG_NOT_FOUND)
2516               {
2517                   //
2518                   //  ATTN-CAKG-P2-20020821: Check for null status?
2519                   //
2520                   mInstance.getProperty(pos).getValue().get(operationalStatus);
2521 chip  1.1     }
2522           
2523               // update module status from Stopped to OK
2524               for(Uint32 i=0, n = operationalStatus.size(); i < n; i++)
2525               {
2526                   if(operationalStatus[i] == _MODULE_STOPPED)
2527                   {
2528                       operationalStatus.remove(i);
2529                   }
2530               }
2531           
2532               operationalStatus.append(_MODULE_OK);
2533           
2534               //
2535               // get module name
2536               //
2537               String moduleName;
2538           
2539               Uint32 pos2 = mInstance.findProperty(CIMName ("Name"));
2540           
2541               if(pos2 != PEG_NOT_FOUND)
2542 chip  1.1     {
2543                   mInstance.getProperty(pos2).getValue().get(moduleName);
2544               }
2545           
2546               if(_providerRegistrationManager->setProviderModuleStatus
2547                   (moduleName, operationalStatus) == false)
2548               {
2549                   //l10n
2550                   //throw PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED, "set module status failed.");
2551                   throw PEGASUS_CIM_EXCEPTION_L(CIM_ERR_FAILED, MessageLoaderParms(
2552                       "ProviderManager.DefaultProviderManager.SET_MODULE_STATUS_FAILED",
2553                       "set module status failed."));
2554               }
2555           
2556               CIMEnableModuleResponseMessage * response =
2557                   new CIMEnableModuleResponseMessage(
2558                   request->messageId,
2559                   CIMException(),
2560                   request->queueIds.copyAndPop(),
2561                   operationalStatus);
2562           
2563 chip  1.1     PEGASUS_ASSERT(response != 0);
2564           
2565               // preserve message key
2566               response->setKey(request->getKey());
2567           
2568               //  Set HTTP method in response from request
2569               response->setHttpMethod (request->getHttpMethod ());
2570           
2571               PEG_METHOD_EXIT();
2572           
2573               return(response);
2574           }
2575           
2576           Message * DefaultProviderManager::handleStopAllProvidersRequest(const Message * message) throw()
2577           {
2578               PEG_METHOD_ENTER(TRC_PROVIDERMANAGER, "DefaultProviderManager::handleStopAllProvidersRequest");
2579           
2580               CIMStopAllProvidersRequestMessage * request =
2581                   dynamic_cast<CIMStopAllProvidersRequestMessage *>(const_cast<Message *>(message));
2582           
2583               PEGASUS_ASSERT(request != 0);
2584 chip  1.1 
2585               CIMStopAllProvidersResponseMessage * response =
2586                   new CIMStopAllProvidersResponseMessage(
2587                   request->messageId,
2588                   CIMException(),
2589                   request->queueIds.copyAndPop());
2590           
2591               PEGASUS_ASSERT(response != 0);
2592           
2593               // preserve message key
2594               response->setKey(request->getKey());
2595           
2596               //  Set HTTP method in response from request
2597               response->setHttpMethod (request->getHttpMethod ());
2598           
2599               // tell the provider manager to shutdown all the providers
2600               providerManager.shutdownAllProviders();
2601           
2602               PEG_METHOD_EXIT();
2603           
2604               return(response);
2605 chip  1.1 }
2606           
2607           void DefaultProviderManager::_insertEntry (
2608               const Provider & provider,
2609               const EnableIndicationsResponseHandler *handler)
2610           {
2611               PEG_METHOD_ENTER (TRC_INDICATION_SERVICE,
2612                   "DefaultProviderManager::_insertEntry");
2613           
2614               String tableKey = _generateKey
2615                   (provider);
2616           
2617               _responseTable.insert (tableKey, const_cast<EnableIndicationsResponseHandler *>(handler));
2618           
2619               PEG_METHOD_EXIT();
2620           }
2621           
2622           EnableIndicationsResponseHandler * DefaultProviderManager::_removeEntry(
2623               const String & key)
2624           {
2625               PEG_METHOD_ENTER (TRC_INDICATION_SERVICE,
2626 chip  1.1         "DefaultProviderManager::_removeEntry");
2627               EnableIndicationsResponseHandler *ret = 0;
2628           
2629               _responseTable.lookup(key, ret);
2630           
2631               PEG_METHOD_EXIT();
2632           
2633               return(ret);
2634           }
2635           
2636           String DefaultProviderManager::_generateKey (
2637               const Provider & provider)
2638           {
2639               String tableKey;
2640           
2641               PEG_METHOD_ENTER (TRC_INDICATION_SERVICE,
2642                   "DefaultProviderManager::_generateKey");
2643           
2644               //
2645               //  Append provider key values to key
2646               //
2647 chip  1.1     String providerName = provider.getName();
2648               String providerFileName = provider.getModule()->getFileName();
2649               tableKey.append (providerName);
2650               tableKey.append (providerFileName);
2651           
2652               PEG_METHOD_EXIT();
2653           
2654               return(tableKey);
2655           }
2656           
2657           PEGASUS_NAMESPACE_END

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2