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

   1 karl  1.3 //%2003////////////////////////////////////////////////////////////////////////
   2 chip  1.1 //
   3 karl  1.3 // Copyright (c) 2000, 2001, 2002  BMC Software, Hewlett-Packard Development
   4           // Company, L. P., IBM Corp., The Open Group, Tivoli Systems.
   5           // Copyright (c) 2003 BMC Software; Hewlett-Packard Development Company, L. P.;
   6           // IBM Corp.; EMC Corporation, The Open Group.
   7 chip  1.1 //
   8           // Permission is hereby granted, free of charge, to any person obtaining a copy
   9           // of this software and associated documentation files (the "Software"), to
  10           // deal in the Software without restriction, including without limitation the
  11           // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
  12           // sell copies of the Software, and to permit persons to whom the Software is
  13           // furnished to do so, subject to the following conditions:
  14 schuur 1.4 //
  15 chip   1.1 // THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
  16            // ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED
  17            // "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
  18            // LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
  19            // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
  20            // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
  21            // ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
  22            // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  23            //
  24            //==============================================================================
  25            //
  26 schuur 1.4 // Author:      Adrian Schuur, schuur@de.ibm.com
  27 chip   1.1 //
  28            // Modified By:
  29            //
  30            //%/////////////////////////////////////////////////////////////////////////////
  31            
  32 schuur 1.14 #include "CMPI_Version.h"
  33 schuur 1.6  
  34 chip   1.1  #include "CMPIProviderManager.h"
  35             
  36 schuur 1.4  #include "CMPI_Object.h"
  37             #include "CMPI_ContextArgs.h"
  38             #include "CMPI_Instance.h"
  39             #include "CMPI_ObjectPath.h"
  40             #include "CMPI_Result.h"
  41             #include "CMPI_SelectExp.h"
  42             
  43             #include <Pegasus/Common/CIMMessage.h>
  44             #include <Pegasus/Common/OperationContext.h>
  45             #include <Pegasus/Common/Destroyer.h>
  46             #include <Pegasus/Common/Tracer.h>
  47             #include <Pegasus/Common/StatisticalData.h>
  48             #include <Pegasus/Common/Logger.h>
  49             #include <Pegasus/Common/MessageLoader.h> //l10n
  50             
  51             #include <Pegasus/Config/ConfigManager.h>
  52 schuur 1.14 #include <Pegasus/Server/CIMServer.h>
  53 schuur 1.4  
  54 schuur 1.13 #include <Pegasus/ProviderManager2/ProviderType.h>
  55 schuur 1.4  #include <Pegasus/ProviderManager2/ProviderName.h>
  56             #include <Pegasus/ProviderManager2/CMPI/CMPIProvider.h>
  57             #include <Pegasus/ProviderManager2/CMPI/CMPILocalProviderManager.h>
  58             #include <Pegasus/ProviderManager2/ProviderManagerService.h>
  59             #include <Pegasus/ProviderManager2/Default/OperationResponseHandler.h>
  60             
  61             #include <Pegasus/Server/ProviderRegistrationManager/ProviderRegistrationManager.h>
  62             
  63 schuur 1.7  PEGASUS_USING_STD;
  64 chip   1.1  PEGASUS_NAMESPACE_BEGIN
  65             
  66 schuur 1.10 static CMPILocalProviderManager providerManager;
  67 schuur 1.4  
  68             int _cmpi_trace=0;
  69             
  70             #define DDD(x) if (_cmpi_trace) x;
  71             
  72             CMPIProviderManager::IndProvTab    CMPIProviderManager::provTab;
  73             CMPIProviderManager::IndSelectTab  CMPIProviderManager::selxTab;
  74             CMPIProviderManager::ProvRegistrar CMPIProviderManager::provReg;
  75             
  76 schuur 1.17 class CMPIPropertyList {
  77                char **props;
  78                int pCount;
  79               public: 
  80                CMPIPropertyList(CIMPropertyList &propertyList) {
  81                   if (!propertyList.isNull()) {
  82                     Array<CIMName> p=propertyList.getPropertyNameArray();
  83                     pCount=p.size();
  84                     props=(char**)malloc((1+pCount)*sizeof(char*));
  85                     for (int i=0; i<pCount; i++) {
  86                        props[i]=strdup(p[i].getString().getCString());
  87                     }
  88                     props[pCount]=NULL;
  89                   }
  90                   else props=NULL;
  91                }
  92                ~CMPIPropertyList() {
  93                   if (props) {
  94                      for (int i=0; i<pCount; i++)
  95                         free(props[i]);
  96                      free(props);   
  97 schuur 1.17       }
  98                }
  99                char **getList() {
 100                   return props;
 101                }
 102             };
 103             
 104 schuur 1.4  CMPIProviderManager::CMPIProviderManager(Mode m)
 105 chip   1.1  {
 106 schuur 1.4     mode=m;
 107                if (getenv("CMPI_TRACE")) _cmpi_trace=1;
 108                else _cmpi_trace=0;
 109 schuur 1.15    _repository = ProviderManagerService::_repository;
 110 chip   1.1  }
 111             
 112             CMPIProviderManager::~CMPIProviderManager(void)
 113             {
 114             }
 115             
 116 schuur 1.7  Boolean CMPIProviderManager::insertProvider(const ProviderName & name,
 117 schuur 1.4              const String &ns, const String &cn)
 118             {
 119                 String key(ns+String("::")+cn+String("::")+CIMValue(name.getCapabilitiesMask()).toString());
 120                 return provReg.insert(key,name);
 121             }
 122 schuur 1.7  
 123             
 124 kumpf  1.2  Message * CMPIProviderManager::processMessage(Message * request) throw()
 125 chip   1.1  {
 126 schuur 1.4        PEG_METHOD_ENTER(TRC_PROVIDERMANAGER,
 127                     "CMPIProviderManager::processMessage()");
 128             
 129                 Message * response = 0;
 130                 
 131                 // pass the request message to a handler method based on message type
 132                 switch(request->getType())
 133                 {
 134                 case CIM_GET_INSTANCE_REQUEST_MESSAGE:
 135                     response = handleGetInstanceRequest(request);
 136             
 137                     break;
 138                 case CIM_ENUMERATE_INSTANCES_REQUEST_MESSAGE:
 139                     response = handleEnumerateInstancesRequest(request);
 140             
 141                     break;
 142                 case CIM_ENUMERATE_INSTANCE_NAMES_REQUEST_MESSAGE:
 143                     response = handleEnumerateInstanceNamesRequest(request);
 144             
 145                     break;
 146                 case CIM_CREATE_INSTANCE_REQUEST_MESSAGE:
 147 schuur 1.4          response = handleCreateInstanceRequest(request);
 148             
 149                     break;
 150                 case CIM_MODIFY_INSTANCE_REQUEST_MESSAGE:
 151                     response = handleModifyInstanceRequest(request);
 152             
 153                     break;
 154                 case CIM_DELETE_INSTANCE_REQUEST_MESSAGE:
 155                     response = handleDeleteInstanceRequest(request);
 156             
 157                     break;
 158                 case CIM_EXEC_QUERY_REQUEST_MESSAGE:
 159 schuur 1.14         response = handleExecQueryRequest(request);
 160 schuur 1.4  
 161                     break;
 162                 case CIM_ASSOCIATORS_REQUEST_MESSAGE:
 163                     response = handleAssociatorsRequest(request);
 164             
 165                     break;
 166                 case CIM_ASSOCIATOR_NAMES_REQUEST_MESSAGE:
 167                     response = handleAssociatorNamesRequest(request);
 168             
 169                     break;
 170                 case CIM_REFERENCES_REQUEST_MESSAGE:
 171                     response = handleReferencesRequest(request);
 172             
 173                     break;
 174                 case CIM_REFERENCE_NAMES_REQUEST_MESSAGE:
 175                     response = handleReferenceNamesRequest(request);
 176             
 177                     break;
 178                 case CIM_INVOKE_METHOD_REQUEST_MESSAGE:
 179                     response = handleInvokeMethodRequest(request);
 180             
 181 schuur 1.4          break;
 182                 case CIM_CREATE_SUBSCRIPTION_REQUEST_MESSAGE:
 183                     response = handleCreateSubscriptionRequest(request);
 184             
 185                     break;
 186             /*    case CIM_MODIFY_SUBSCRIPTION_REQUEST_MESSAGE:
 187                     response = handleModifySubscriptionRequest(request);
 188             
 189                     break;
 190             */  case CIM_DELETE_SUBSCRIPTION_REQUEST_MESSAGE:
 191                     response = handleDeleteSubscriptionRequest(request);
 192             
 193                     break;
 194                 case CIM_ENABLE_INDICATIONS_REQUEST_MESSAGE:
 195                     response = handleEnableIndicationsRequest(request);
 196             
 197                     break;
 198                 case CIM_DISABLE_INDICATIONS_REQUEST_MESSAGE:
 199                     response = handleDisableIndicationsRequest(request);
 200             
 201                     break;
 202 schuur 1.4  /*    case CIM_CONSUME_INDICATION_REQUEST_MESSAGE:
 203                     response = handleConsumeIndicationRequest(request);
 204                     break;
 205 schuur 1.16 */
 206 schuur 1.4      case CIM_DISABLE_MODULE_REQUEST_MESSAGE:
 207                     response = handleDisableModuleRequest(request);
 208             
 209                     break;
 210                 case CIM_ENABLE_MODULE_REQUEST_MESSAGE:
 211                     response = handleEnableModuleRequest(request);
 212             
 213 schuur 1.16         break; 
 214 schuur 1.4      case CIM_STOP_ALL_PROVIDERS_REQUEST_MESSAGE:
 215                     response = handleStopAllProvidersRequest(request);
 216             
 217 schuur 1.5          break;
 218 schuur 1.4      default:
 219                     response = handleUnsupportedRequest(request);
 220             
 221                     break;
 222                 }
 223              
 224                 PEG_METHOD_EXIT();
 225             
 226                 return(response);
 227             }
 228             
 229             void CMPIProviderManager::unload_idle_providers(void) 
 230             {
 231 schuur 1.10      providerManager.unload_idle_providers();  
 232 schuur 1.4  }
 233             
 234             
 235             #define CHARS(cstring) (char*)(strlen(cstring)?(const char*)cstring:NULL)
 236             
 237             
 238             #define HandlerIntroBase(type,type1,message,request,response,handler,respType) \
 239                 CIM##type##RequestMessage * request = \
 240                     dynamic_cast<CIM##type##RequestMessage *>(const_cast<Message *>(message)); \
 241                 PEGASUS_ASSERT(request != 0); \
 242                 CIM##type##ResponseMessage * response = \
 243                     new CIM##type##ResponseMessage( \
 244                     request->messageId, \
 245                     CIMException(), \
 246                     request->queueIds.copyAndPop() \
 247                     respType \
 248                 PEGASUS_ASSERT(response != 0); \
 249                 response->setKey(request->getKey()); \
 250                 response->setHttpMethod(request->getHttpMethod()); \
 251                 type1##ResponseHandler handler(request, response); 
 252             
 253 schuur 1.4  #define VOIDINTRO );
 254             #define NOVOIDINTRO(type) ,type);
 255             #define METHODINTRO ,CIMValue(), Array<CIMParamValue>(), request->methodName );
 256             
 257             
 258             #define HandlerIntroVoid(type,message,request,response,handler) \
 259                  HandlerIntroBase(type,type,message,request,response,handler,VOIDINTRO)
 260             
 261             #define HandlerIntroMethod(type,message,request,response,handler) \
 262                  HandlerIntroBase(type,type,message,request,response,handler,METHODINTRO)
 263             
 264             #define HandlerIntroInd(type,message,request,response,handler) \
 265                  HandlerIntroBase(type,Operation,message,request,response,handler,VOIDINTRO)
 266             
 267             #define HandlerIntro(type,message,request,response,handler,respType) \
 268                  HandlerIntroBase(type,type,message,request,response,handler,NOVOIDINTRO(respType))
 269                  
 270             #define HandlerCatch(handler) \
 271                 catch(CIMException & e)  \
 272                 { PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4, \
 273                             "Exception: " + e.getMessage()); \
 274 schuur 1.4          handler.setStatus(e.getCode(), e.getContentLanguages(), e.getMessage()); \
 275                 } \
 276                 catch(Exception & e) \
 277                 { PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4, \
 278                             "Exception: " + e.getMessage()); \
 279                     handler.setStatus(CIM_ERR_FAILED, e.getContentLanguages(), e.getMessage()); \
 280                 } \
 281                 catch(...) \
 282                 { PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4, \
 283                             "Exception: Unknown"); \
 284                     handler.setStatus(CIM_ERR_FAILED, "Unknown error."); \
 285                 }
 286             
 287             
 288             
 289             Message * CMPIProviderManager::handleGetInstanceRequest(const Message * message) throw()
 290             {
 291                 PEG_METHOD_ENTER(TRC_PROVIDERMANAGER,
 292                     "CMPIProviderManager::handleGetInstanceRequest");
 293             
 294                 HandlerIntro(GetInstance,message,request,response,handler,CIMInstance());
 295 schuur 1.4  
 296                 try {
 297             	Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE,
 298                         "CmpiProviderManager::handleGetInstanceRequest - Host name: $0  Name space: $1  Class name: $2",
 299                         System::getHostName(),
 300                         request->nameSpace.getString(),
 301                         request->instanceName.getClassName().getString());
 302             
 303                     // make target object path
 304                     CIMObjectPath objectPath(
 305                         System::getHostName(),
 306                         request->nameSpace,
 307                         request->instanceName.getClassName(),
 308                         request->instanceName.getKeyBindings());
 309             
 310                     ProviderName name(
 311                         objectPath.toString(),
 312                         String::EMPTY,
 313                         String::EMPTY,
 314                         String::EMPTY,
 315                         ProviderType::INSTANCE);
 316 schuur 1.4  
 317                     // resolve provider name
 318                     name = _resolveProviderName(name);
 319             
 320                     // get cached or load new provider module
 321 schuur 1.10         CMPIProvider::OpProviderHolder ph = providerManager.getProvider(name.getPhysicalName(),
 322 schuur 1.4  	                                name.getLogicalName());
 323             
 324                     // convert arguments
 325                     OperationContext context;
 326             
 327                     context.insert(IdentityContainer(request->userName));
 328                     context.insert(AcceptLanguageListContainer(request->acceptLanguages));
 329                     context.insert(ContentLanguageListContainer(request->contentLanguages));
 330             
 331                     // forward request
 332 schuur 1.17         CMPIProvider & pr=ph.GetProvider();
 333 schuur 1.4  
 334                     PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
 335                         "Calling provider.getInstance: " + pr.getName());
 336             
 337 schuur 1.7          DDD(cerr<<"--- CMPIProviderManager::getInstance"<<endl);
 338 schuur 1.4  
 339 schuur 1.17         CMPIStatus rc={CMPI_RC_OK,NULL};
 340 schuur 1.4          CMPI_ContextOnStack eCtx(context);
 341                     CMPI_ObjectPathOnStack eRef(objectPath);
 342                     CMPI_ResultOnStack eRes(handler,&pr.broker);
 343                     CMPI_ThreadContext thr(&pr.broker,&eCtx);
 344             
 345 schuur 1.17         CMPIPropertyList props(request->propertyList);
 346                     
 347 schuur 1.4          CMPIFlags flgs=0;
 348                     if (request->includeQualifiers) flgs|=CMPI_FLAG_IncludeQualifiers;
 349                     if (request->includeClassOrigin) flgs|=CMPI_FLAG_IncludeClassOrigin;
 350                     eCtx.ft->addEntry(&eCtx,CMPIInvocationFlags,(CMPIValue*)&flgs,CMPI_uint32);
 351             
 352                     CMPIProvider::pm_service_op_lock op_lock(&pr);
 353             
 354 schuur 1.17         STAT_GETSTARTTIME;
 355 schuur 1.4  
 356                     rc=pr.miVector.instMI->ft->getInstance
 357 schuur 1.17         (pr.miVector.instMI,&eCtx,&eRes,&eRef,props.getList());
 358 schuur 1.4  
 359                     STAT_PMS_PROVIDEREND;
 360             
 361                     if (rc.rc!=CMPI_RC_OK)
 362 schuur 1.17            throw CIMException((CIMStatusCode)rc.rc);
 363 schuur 1.4      }   
 364                 HandlerCatch(handler);
 365                 
 366                 PEG_METHOD_EXIT();
 367             
 368                 return(response);
 369             }
 370             
 371             Message * CMPIProviderManager::handleEnumerateInstancesRequest(const Message * message) throw()
 372             {
 373                 PEG_METHOD_ENTER(TRC_PROVIDERMANAGER,
 374                     "CMPIProviderManager::handleEnumerateInstanceRequest");
 375             
 376                 HandlerIntro(EnumerateInstances,message,request,response,
 377                              handler,Array<CIMInstance>());
 378                 try {  
 379                   Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE,
 380                         "CMPIProviderManager::handleEnumerateInstancesRequest - Host name: $0  Name space: $1  Class name: $2",
 381                         System::getHostName(),
 382                         request->nameSpace.getString(),
 383                         request->className.getString());
 384 schuur 1.4  
 385                     // make target object path
 386                     CIMObjectPath objectPath(
 387                         System::getHostName(),
 388                         request->nameSpace,
 389                         request->className);
 390             
 391                     ProviderName name(
 392                         objectPath.toString(),
 393                         String::EMPTY,
 394                         String::EMPTY,
 395                         String::EMPTY,
 396                         ProviderType::INSTANCE);
 397             
 398                     // resolve provider name
 399                     name = _resolveProviderName(name);
 400             
 401                     // get cached or load new provider module
 402                     CMPIProvider::OpProviderHolder ph =
 403 schuur 1.10             providerManager.getProvider(name.getPhysicalName(), name.getLogicalName(),
 404 schuur 1.4                 String::EMPTY);
 405             
 406             	// convert arguments
 407                     OperationContext context;
 408             
 409                     context.insert(IdentityContainer(request->userName));
 410                     context.insert(AcceptLanguageListContainer(request->acceptLanguages));
 411                     context.insert(ContentLanguageListContainer(request->contentLanguages));
 412             
 413                     CIMPropertyList propertyList(request->propertyList);
 414             
 415                     // forward request
 416 schuur 1.17         CMPIProvider & pr=ph.GetProvider();
 417 schuur 1.4  
 418                     PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
 419                         "Calling provider.enumerateInstances: " + pr.getName());
 420             
 421 schuur 1.7          DDD(cerr<<"--- CMPIProviderManager::enumerateInstances"<<endl);
 422 schuur 1.4  
 423 schuur 1.17         CMPIStatus rc={CMPI_RC_OK,NULL};
 424 schuur 1.4          CMPI_ContextOnStack eCtx(context);
 425                     CMPI_ObjectPathOnStack eRef(objectPath);
 426                     CMPI_ResultOnStack eRes(handler,&pr.broker);
 427                     CMPI_ThreadContext thr(&pr.broker,&eCtx);
 428             
 429 schuur 1.17         CMPIPropertyList props(propertyList);
 430 schuur 1.4  
 431                     CMPIFlags flgs=0;
 432                     if (request->includeQualifiers) flgs|=CMPI_FLAG_IncludeQualifiers;
 433                     if (request->includeClassOrigin) flgs|=CMPI_FLAG_IncludeClassOrigin;
 434                     eCtx.ft->addEntry(&eCtx,CMPIInvocationFlags,(CMPIValue*)&flgs,CMPI_uint32);
 435             
 436                     CMPIProvider::pm_service_op_lock op_lock(&pr);
 437             
 438                     STAT_GETSTARTTIME;
 439             
 440                     rc=pr.miVector.instMI->ft->enumInstances
 441 schuur 1.17         (pr.miVector.instMI,&eCtx,&eRes,&eRef,props.getList()); 
 442 schuur 1.4  
 443                     STAT_PMS_PROVIDEREND;
 444             
 445                     if (rc.rc!=CMPI_RC_OK)
 446 schuur 1.17         throw CIMException((CIMStatusCode)rc.rc);
 447 schuur 1.4  
 448                     STAT_PMS_PROVIDEREND;
 449                 }
 450                 HandlerCatch(handler);
 451                 
 452                 PEG_METHOD_EXIT();
 453             
 454                 return(response);
 455             }
 456             
 457             Message * CMPIProviderManager::handleEnumerateInstanceNamesRequest(const Message * message) throw()
 458             {
 459                 PEG_METHOD_ENTER(TRC_PROVIDERMANAGER, "CMPIProviderManager::handleEnumerateInstanceNamesRequest");
 460             
 461                 HandlerIntro(EnumerateInstanceNames,message,request,response,
 462                              handler,Array<CIMObjectPath>());
 463                 try {
 464                     Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE,
 465                         "CMPIProviderManager::handleEnumerateInstanceNamesRequest - Host name: $0  Name space: $1  Class name: $2",
 466                         System::getHostName(),
 467                         request->nameSpace.getString(),
 468 schuur 1.4              request->className.getString());
 469                    
 470                    // make target object path
 471                     CIMObjectPath objectPath(
 472                         System::getHostName(),
 473                         request->nameSpace,
 474                         request->className);
 475             
 476                    // build an internal provider name from the request arguments
 477                     ProviderName name(
 478                         objectPath.toString(),
 479                         String::EMPTY,
 480                         String::EMPTY,
 481                         String::EMPTY,
 482                         ProviderType::INSTANCE);
 483             
 484                     // resolve provider name
 485                     name = _resolveProviderName(name);
 486             
 487                     // get cached or load new provider module
 488                     CMPIProvider::OpProviderHolder ph =
 489 schuur 1.10             providerManager.getProvider(name.getPhysicalName(), name.getLogicalName());
 490 schuur 1.4  
 491                     // convert arguments
 492                     OperationContext context;
 493             
 494                     context.insert(IdentityContainer(request->userName));
 495                     context.insert(AcceptLanguageListContainer(request->acceptLanguages));
 496                     context.insert(ContentLanguageListContainer(request->contentLanguages));
 497             
 498             	CMPIProvider & pr=ph.GetProvider();
 499             
 500             	PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
 501                         "Calling provider.enumerateInstanceNames: " + pr.getName());
 502             
 503 schuur 1.7          DDD(cerr<<"--- CMPIProviderManager::enumerateInstanceNames"<<endl);
 504 schuur 1.4  
 505                     CMPIStatus rc={CMPI_RC_OK,NULL};
 506                     CMPI_ContextOnStack eCtx(context);
 507                     CMPI_ObjectPathOnStack eRef(objectPath);
 508                     CMPI_ResultOnStack eRes(handler,&pr.broker);
 509                     CMPI_ThreadContext thr(&pr.broker,&eCtx);
 510             
 511                     CMPIFlags flgs=0;
 512                     eCtx.ft->addEntry(&eCtx,CMPIInvocationFlags,(CMPIValue*)&flgs,CMPI_uint32);
 513             
 514                     CMPIProvider::pm_service_op_lock op_lock(&pr);
 515             
 516                     STAT_GETSTARTTIME;
 517             
 518                     rc=pr.miVector.instMI->ft->enumInstanceNames(pr.miVector.instMI,&eCtx,&eRes,&eRef);
 519             
 520                     STAT_PMS_PROVIDEREND;
 521             
 522                     if (rc.rc!=CMPI_RC_OK)
 523             	   throw CIMException((CIMStatusCode)rc.rc);
 524                 }
 525 schuur 1.4      HandlerCatch(handler);
 526                 
 527             
 528                 PEG_METHOD_EXIT();
 529             
 530                 return(response);
 531             }
 532             
 533             Message * CMPIProviderManager::handleCreateInstanceRequest(const Message * message) throw()
 534             {
 535                 PEG_METHOD_ENTER(TRC_PROVIDERMANAGER,
 536                    "CMPIProviderManager::handleCreateInstanceRequest");
 537             
 538                 HandlerIntro(CreateInstance,message,request,response,
 539                              handler,CIMObjectPath());
 540                 try {
 541                     Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE,
 542                         "CMPIProviderManager::handleCreateInstanceRequest - Host name: $0  Name space: $1  Class name: $2",
 543                         System::getHostName(),
 544                         request->nameSpace.getString(),
 545                         request->newInstance.getPath().getClassName().getString());
 546 schuur 1.4  
 547                     // make target object path
 548                     CIMObjectPath objectPath(
 549                         System::getHostName(),
 550                         request->nameSpace,
 551                         request->newInstance.getPath().getClassName(),
 552                         request->newInstance.getPath().getKeyBindings());
 553             
 554             	ProviderName name(
 555                         objectPath.toString(),
 556                         String::EMPTY,
 557                         String::EMPTY,
 558                         String::EMPTY,
 559                         ProviderType::INSTANCE);
 560             
 561                     // resolve provider name
 562                     name = _resolveProviderName(name);
 563             
 564                     // get cached or load new provider module
 565                     CMPIProvider::OpProviderHolder ph =
 566 schuur 1.10             providerManager.getProvider(name.getPhysicalName(), name.getLogicalName(),
 567 schuur 1.4  	           String::EMPTY);
 568             
 569                     // convert arguments
 570                     OperationContext context;
 571             
 572                     context.insert(IdentityContainer(request->userName));
 573                     context.insert(AcceptLanguageListContainer(request->acceptLanguages));
 574                     context.insert(ContentLanguageListContainer(request->contentLanguages));
 575             
 576                     // forward request
 577              	CMPIProvider & pr=ph.GetProvider();
 578             
 579                     PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
 580                         "Calling provider.createInstance: " +
 581                         ph.GetProvider().getName());
 582             
 583 schuur 1.7          DDD(cerr<<"--- CMPIProviderManager::createInstances"<<endl);
 584 schuur 1.4  	CMPIStatus rc={CMPI_RC_OK,NULL};
 585                     CMPI_ContextOnStack eCtx(context);
 586                     CMPI_ObjectPathOnStack eRef(objectPath);
 587                     CMPI_ResultOnStack eRes(handler,&pr.broker);
 588                     CMPI_InstanceOnStack eInst(request->newInstance);
 589                     CMPI_ThreadContext thr(&pr.broker,&eCtx);
 590             
 591                     CMPIFlags flgs=0;
 592                     eCtx.ft->addEntry(&eCtx,CMPIInvocationFlags,(CMPIValue*)&flgs,CMPI_uint32);
 593             
 594                     CMPIProvider::pm_service_op_lock op_lock(&pr);
 595             
 596                     STAT_GETSTARTTIME;
 597             
 598                     rc=pr.miVector.instMI->ft->createInstance
 599             	   (pr.miVector.instMI,&eCtx,&eRes,&eRef,&eInst);
 600             
 601                     STAT_PMS_PROVIDEREND;
 602             
 603                     if (rc.rc!=CMPI_RC_OK)
 604             	   throw CIMException((CIMStatusCode)rc.rc);
 605 schuur 1.4      }
 606                 HandlerCatch(handler);
 607                 
 608                 PEG_METHOD_EXIT();
 609             
 610                 return(response);
 611             }
 612             
 613             Message * CMPIProviderManager::handleModifyInstanceRequest(const Message * message) throw()
 614             {
 615                 PEG_METHOD_ENTER(TRC_PROVIDERMANAGER,
 616                    "CMPIProviderManager::handleModifyInstanceRequest");
 617             
 618                 HandlerIntroVoid(ModifyInstance,message,request,response,
 619                              handler);
 620                 try {
 621                     Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE,
 622 schuur 1.14             "CMPIProviderManager::handleModifyInstanceRequest - Host name: $0  Name space: $1  Class name: $2",
 623 schuur 1.4              System::getHostName(),
 624                         request->nameSpace.getString(),
 625                         request->modifiedInstance.getPath().getClassName().getString());
 626             
 627                     // make target object path
 628                     CIMObjectPath objectPath(
 629                         System::getHostName(),
 630                         request->nameSpace,
 631                         request->modifiedInstance.getPath ().getClassName(),
 632                         request->modifiedInstance.getPath ().getKeyBindings());
 633             
 634                     ProviderName name(
 635                         objectPath.toString(),
 636                         String::EMPTY,
 637                         String::EMPTY,
 638                         String::EMPTY,
 639                         ProviderType::INSTANCE);
 640             
 641                     // resolve provider name
 642                     name = _resolveProviderName(name);
 643             
 644 schuur 1.4          // get cached or load new provider module
 645                     CMPIProvider::OpProviderHolder ph =
 646 schuur 1.10             providerManager.getProvider(name.getPhysicalName(), name.getLogicalName(), String::EMPTY);
 647 schuur 1.4  
 648                     // convert arguments
 649                     OperationContext context;
 650             
 651                     context.insert(IdentityContainer(request->userName));
 652                     context.insert(AcceptLanguageListContainer(request->acceptLanguages));
 653                     context.insert(ContentLanguageListContainer(request->contentLanguages));
 654             
 655                     // forward request
 656 schuur 1.17         CMPIProvider & pr=ph.GetProvider();
 657 schuur 1.4  
 658                     PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
 659                         "Calling provider.modifyInstance: " + pr.getName());
 660             
 661 schuur 1.7          DDD(cerr<<"--- CMPIProviderManager::modifyInstance"<<endl);
 662 schuur 1.4  
 663 schuur 1.17         CMPIStatus rc={CMPI_RC_OK,NULL};
 664 schuur 1.4          CMPI_ContextOnStack eCtx(context);
 665                     CMPI_ObjectPathOnStack eRef(objectPath);
 666                     CMPI_ResultOnStack eRes(handler,&pr.broker);
 667                     CMPI_InstanceOnStack eInst(request->modifiedInstance);
 668                     CMPI_ThreadContext thr(&pr.broker,&eCtx);
 669             
 670 schuur 1.17         CMPIPropertyList props(request->propertyList);
 671                     
 672 schuur 1.4          CMPIFlags flgs=0;
 673                     if (request->includeQualifiers) flgs|=CMPI_FLAG_IncludeQualifiers;
 674                     eCtx.ft->addEntry(&eCtx,CMPIInvocationFlags,(CMPIValue*)&flgs,CMPI_uint32);
 675             
 676                     CMPIProvider::pm_service_op_lock op_lock(&pr);
 677             
 678                     STAT_GETSTARTTIME;
 679             
 680                     rc=pr.miVector.instMI->ft->setInstance
 681 schuur 1.17         (pr.miVector.instMI,&eCtx,&eRes,&eRef,&eInst,props.getList());
 682 schuur 1.4  
 683                     STAT_PMS_PROVIDEREND;
 684             
 685                     if (rc.rc!=CMPI_RC_OK)
 686             	   throw CIMException((CIMStatusCode)rc.rc);
 687                 }
 688                 HandlerCatch(handler);
 689                 
 690                 PEG_METHOD_EXIT();
 691             
 692                 return(response);
 693             }
 694             
 695             Message * CMPIProviderManager::handleDeleteInstanceRequest(const Message * message) throw()
 696             {
 697                 PEG_METHOD_ENTER(TRC_PROVIDERMANAGER,
 698                    "CMPIProviderManager::handleDeleteInstanceRequest");
 699             
 700                 HandlerIntroVoid(DeleteInstance,message,request,response,
 701                              handler);
 702                 try {
 703 schuur 1.4          Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE,
 704 schuur 1.14             "CMPIProviderManager::handleDeleteInstanceRequest - Host name: $0  Name space: $1  Class name: $2",
 705 schuur 1.4              System::getHostName(),
 706                         request->nameSpace.getString(),
 707                         request->instanceName.getClassName().getString());
 708             
 709                     // make target object path
 710                     CIMObjectPath objectPath(
 711                         System::getHostName(),
 712                         request->nameSpace,
 713                         request->instanceName.getClassName(),
 714                         request->instanceName.getKeyBindings());
 715             
 716                     ProviderName name(
 717                         objectPath.toString(),
 718                         String::EMPTY,
 719                         String::EMPTY,
 720                         String::EMPTY,
 721                         ProviderType::INSTANCE);
 722             
 723                     // resolve provider name
 724                     name = _resolveProviderName(name);
 725             
 726 schuur 1.4          // get cached or load new provider module
 727                     CMPIProvider::OpProviderHolder ph =
 728 schuur 1.10             providerManager.getProvider(name.getPhysicalName(), name.getLogicalName(), String::EMPTY);
 729 schuur 1.4  
 730                     // convert arguments
 731                     OperationContext context;
 732             
 733                     context.insert(IdentityContainer(request->userName));
 734                     context.insert(AcceptLanguageListContainer(request->acceptLanguages));
 735                     context.insert(ContentLanguageListContainer(request->contentLanguages));
 736             
 737                     // forward request
 738              	CMPIProvider & pr=ph.GetProvider();
 739             
 740                     PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
 741                         "Calling provider.deleteInstance: " + pr.getName());
 742             
 743             	CMPIStatus rc={CMPI_RC_OK,NULL};
 744                     CMPI_ContextOnStack eCtx(context);
 745                     CMPI_ObjectPathOnStack eRef(objectPath);
 746                     CMPI_ResultOnStack eRes(handler,&pr.broker);
 747                     CMPI_ThreadContext thr(&pr.broker,&eCtx);
 748             
 749                     CMPIFlags flgs=0;
 750 schuur 1.4          eCtx.ft->addEntry(&eCtx,CMPIInvocationFlags,(CMPIValue*)&flgs,CMPI_uint32);
 751             
 752                     CMPIProvider::pm_service_op_lock op_lock(&pr);
 753             
 754                     STAT_GETSTARTTIME;
 755             
 756                     rc=pr.miVector.instMI->ft->deleteInstance
 757             	   (pr.miVector.instMI,&eCtx,&eRes,&eRef);
 758             
 759                     STAT_PMS_PROVIDEREND;
 760             
 761                     if (rc.rc!=CMPI_RC_OK)
 762             	   throw CIMException((CIMStatusCode)rc.rc);
 763                 }
 764                 HandlerCatch(handler);
 765                 
 766                 PEG_METHOD_EXIT();
 767             
 768                 return(response);
 769             }
 770             
 771 schuur 1.14 Message * CMPIProviderManager::handleExecQueryRequest(const Message * message) throw()
 772 schuur 1.4  {
 773                 PEG_METHOD_ENTER(TRC_PROVIDERMANAGER,
 774 schuur 1.14        "CMPIProviderManager::handleExecQueryRequest");
 775 schuur 1.4  
 776 schuur 1.14     HandlerIntro(ExecQuery,message,request,response,
 777                              handler,Array<CIMObject>());
 778             
 779                 try {  
 780                   Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE,
 781                         "CMPIProviderManager::ExecQueryRequest - Host name: $0  Name space: $1  Class name: $2",
 782                         System::getHostName(),
 783                         request->nameSpace.getString(),
 784                         request->className.getString());
 785             
 786                     // make target object path
 787                     CIMObjectPath objectPath(
 788                         System::getHostName(),
 789                         request->nameSpace,
 790                         request->className);
 791             
 792                     ProviderName name(
 793                         objectPath.toString(),
 794                         String::EMPTY,
 795                         String::EMPTY,
 796                         String::EMPTY,
 797 schuur 1.14             ProviderType::QUERY);
 798             
 799                     // resolve provider name
 800                     name = _resolveProviderName(name);
 801             
 802                     // get cached or load new provider module
 803                     CMPIProvider::OpProviderHolder ph =
 804                         providerManager.getProvider(name.getPhysicalName(), name.getLogicalName(),
 805                            String::EMPTY);
 806 schuur 1.4  
 807 schuur 1.14 	// convert arguments
 808                     OperationContext context;
 809 schuur 1.4  
 810 schuur 1.14         context.insert(IdentityContainer(request->userName));
 811                     context.insert(AcceptLanguageListContainer(request->acceptLanguages));
 812                     context.insert(ContentLanguageListContainer(request->contentLanguages));
 813             
 814                     // forward request
 815             	CMPIProvider & pr=ph.GetProvider();
 816             
 817                     PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
 818                         "Calling provider.execQuery: " + pr.getName());
 819             
 820                     DDD(cerr<<"--- CMPIProviderManager::execQuery"<<endl);
 821             
 822                     const char **props=NULL;
 823             
 824             	CMPIStatus rc={CMPI_RC_OK,NULL};
 825                     CMPI_ContextOnStack eCtx(context);
 826                     CMPI_ObjectPathOnStack eRef(objectPath);
 827                     CMPI_ResultOnStack eRes(handler,&pr.broker);
 828                     CMPI_ThreadContext thr(&pr.broker,&eCtx);
 829                     const CString queryLan=request->queryLanguage.getCString();
 830                     const CString query=request->query.getCString();
 831 schuur 1.14 
 832                     CMPIFlags flgs=0;
 833                     eCtx.ft->addEntry(&eCtx,CMPIInvocationFlags,(CMPIValue*)&flgs,CMPI_uint32);
 834             
 835                     CMPIProvider::pm_service_op_lock op_lock(&pr);
 836             
 837                     STAT_GETSTARTTIME;
 838             
 839                     rc=pr.miVector.instMI->ft->execQuery
 840             	   (pr.miVector.instMI,&eCtx,&eRes,&eRef,CHARS(queryLan),CHARS(query));
 841             
 842                     STAT_PMS_PROVIDEREND;
 843             
 844                     if (rc.rc!=CMPI_RC_OK)
 845             	   throw CIMException((CIMStatusCode)rc.rc);
 846             
 847                     STAT_PMS_PROVIDEREND;
 848                 }
 849                 HandlerCatch(handler);
 850 schuur 1.4  
 851                 PEG_METHOD_EXIT();
 852             
 853                 return(response);
 854             }
 855             
 856             Message * CMPIProviderManager::handleAssociatorsRequest(const Message * message) throw()
 857             {
 858                 PEG_METHOD_ENTER(TRC_PROVIDERMANAGER,
 859                    "CMPIProviderManager::handleAssociatorsRequest");
 860             
 861                 HandlerIntro(Associators,message,request,response,
 862                              handler,Array<CIMObject>());
 863                 try {
 864                     Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE,
 865                         "CMPIProviderManager::handleAssociatorsRequest - Host name: $0  Name space: $1  Class name: $2",
 866                         System::getHostName(),
 867                         request->nameSpace.getString(),
 868                         request->objectName.getClassName().getString());
 869             
 870                     // make target object path
 871 schuur 1.4          CIMObjectPath objectPath(
 872                         System::getHostName(),
 873                         request->nameSpace,
 874                         request->objectName.getClassName());
 875             
 876                     objectPath.setKeyBindings(request->objectName.getKeyBindings());
 877             
 878                     CIMObjectPath assocPath(
 879                         System::getHostName(),
 880                         request->nameSpace,
 881                         request->assocClass.getString());
 882             
 883                      ProviderName name(
 884                         assocPath.toString(),
 885                         String::EMPTY,
 886                         String::EMPTY,
 887                         String::EMPTY,
 888                         ProviderType::ASSOCIATION);
 889             
 890                     // resolve provider name
 891                     name = _resolveProviderName(name);
 892 schuur 1.4  
 893                     // get cached or load new provider module
 894                     CMPIProvider::OpProviderHolder ph =
 895 schuur 1.10             providerManager.getProvider(name.getPhysicalName(), name.getLogicalName(), String::EMPTY);
 896 schuur 1.4  
 897                    // convert arguments
 898                     OperationContext context;
 899             
 900                     context.insert(IdentityContainer(request->userName));
 901                     context.insert(AcceptLanguageListContainer(request->acceptLanguages));
 902                     context.insert(ContentLanguageListContainer(request->contentLanguages));
 903             
 904                     // forward request
 905 schuur 1.17         CMPIProvider & pr=ph.GetProvider();
 906 schuur 1.4  
 907                     PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
 908                         "Calling provider.associators: " + pr.getName());
 909             
 910 schuur 1.7          DDD(cerr<<"--- CMPIProviderManager::associators"<<" role: >"<<request->role<<"< aCls "<<
 911 schuur 1.17         request->assocClass<<endl);
 912 schuur 1.4  
 913 schuur 1.17         CMPIStatus rc={CMPI_RC_OK,NULL};
 914 schuur 1.4          CMPI_ContextOnStack eCtx(context);
 915                     CMPI_ObjectPathOnStack eRef(objectPath);
 916 schuur 1.17         CMPI_ResultOnStack eRes(handler,&pr.broker);
 917 schuur 1.4          CMPI_ThreadContext thr(&pr.broker,&eCtx);
 918                     const CString aClass=request->assocClass.getString().getCString();
 919                     const CString rClass=request->resultClass.getString().getCString();
 920                     const CString rRole=request->role.getCString();
 921                     const CString resRole=request->resultRole.getCString();
 922             
 923 schuur 1.17         CMPIPropertyList props(request->propertyList);
 924                     
 925 schuur 1.4          CMPIFlags flgs=0;
 926                     if (request->includeQualifiers) flgs|=CMPI_FLAG_IncludeQualifiers;
 927                     if (request->includeClassOrigin) flgs|=CMPI_FLAG_IncludeClassOrigin;
 928                     eCtx.ft->addEntry(&eCtx,CMPIInvocationFlags,(CMPIValue*)&flgs,CMPI_uint32);
 929             
 930                     CMPIProvider::pm_service_op_lock op_lock(&pr);
 931             
 932                     STAT_GETSTARTTIME;
 933             
 934                     rc=pr.miVector.assocMI->ft->associators(
 935                                      pr.miVector.assocMI,&eCtx,&eRes,&eRef,CHARS(aClass),
 936 schuur 1.17                          CHARS(rClass),CHARS(rRole),CHARS(resRole),props.getList());
 937 schuur 1.4  
 938                     STAT_PMS_PROVIDEREND;
 939             
 940                     if (rc.rc!=CMPI_RC_OK)
 941             	   throw CIMException((CIMStatusCode)rc.rc);
 942                 }
 943                 HandlerCatch(handler);
 944                 
 945                 PEG_METHOD_EXIT();
 946             
 947                 return(response);
 948             }
 949             
 950             Message * CMPIProviderManager::handleAssociatorNamesRequest(const Message * message) throw()
 951             {
 952                 PEG_METHOD_ENTER(TRC_PROVIDERMANAGER,
 953                    "CMPIProviderManager::handleAssociatorNamesRequest");
 954             
 955                 HandlerIntro(AssociatorNames,message,request,response,
 956                              handler,Array<CIMObjectPath>());
 957                 try {
 958 schuur 1.4          Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE,
 959                         "CMPIProviderManager::handleAssociatorNamesRequest - Host name: $0  Name space: $1  Class name: $2",
 960                         System::getHostName(),
 961                         request->nameSpace.getString(),
 962                         request->objectName.getClassName().getString());
 963             
 964                     // make target object path
 965                     CIMObjectPath objectPath(
 966                         System::getHostName(),
 967                         request->nameSpace,
 968                         request->objectName.getClassName());
 969             
 970                     objectPath.setKeyBindings(request->objectName.getKeyBindings());
 971             
 972                     CIMObjectPath assocPath(
 973                         System::getHostName(),
 974                         request->nameSpace,
 975                         request->assocClass.getString());
 976                   
 977                   ProviderName name(
 978                         assocPath.toString(),
 979 schuur 1.4              String::EMPTY,
 980                         String::EMPTY,
 981                         String::EMPTY,
 982                         ProviderType::ASSOCIATION);
 983             
 984                     // resolve provider name
 985                     name = _resolveProviderName(name);
 986             
 987                     // get cached or load new provider module
 988                     CMPIProvider::OpProviderHolder ph =
 989 schuur 1.10             providerManager.getProvider(name.getPhysicalName(), name.getLogicalName(), String::EMPTY);
 990 schuur 1.4  
 991                     // convert arguments
 992                     OperationContext context;
 993             
 994                     context.insert(IdentityContainer(request->userName));
 995                     context.insert(AcceptLanguageListContainer(request->acceptLanguages));
 996                     context.insert(ContentLanguageListContainer(request->contentLanguages));
 997             
 998                     // forward request
 999              	CMPIProvider & pr=ph.GetProvider();
1000             
1001                     PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
1002                         "Calling provider.associatorNames: " + pr.getName());
1003             
1004 schuur 1.7          DDD(cerr<<"--- CMPIProviderManager::associatorNames"<<" role: >"<<request->role<<"< aCls "<<
1005             	   request->assocClass<<endl);
1006 schuur 1.4  
1007             	CMPIStatus rc={CMPI_RC_OK,NULL};
1008                     CMPI_ContextOnStack eCtx(context);
1009                     CMPI_ObjectPathOnStack eRef(objectPath);
1010             	CMPI_ResultOnStack eRes(handler,&pr.broker);
1011                     CMPI_ThreadContext thr(&pr.broker,&eCtx);
1012                     const CString aClass=request->assocClass.getString().getCString();
1013                     const CString rClass=request->resultClass.getString().getCString();
1014                     const CString rRole=request->role.getCString();
1015                     const CString resRole=request->resultRole.getCString();
1016             
1017                     CMPIFlags flgs=0;
1018                     eCtx.ft->addEntry(&eCtx,CMPIInvocationFlags,(CMPIValue*)&flgs,CMPI_uint32);
1019             
1020                     CMPIProvider::pm_service_op_lock op_lock(&pr);
1021             
1022                     STAT_GETSTARTTIME;
1023             
1024                     rc=pr.miVector.assocMI->ft->associatorNames(
1025                                      pr.miVector.assocMI,&eCtx,&eRes,&eRef,CHARS(aClass),
1026                                      CHARS(rClass),CHARS(rRole),CHARS(resRole));
1027 schuur 1.4  
1028                     STAT_PMS_PROVIDEREND;
1029             
1030                     if (rc.rc!=CMPI_RC_OK)
1031             	   throw CIMException((CIMStatusCode)rc.rc);
1032                 }
1033                 HandlerCatch(handler);
1034                 
1035                 PEG_METHOD_EXIT();
1036             
1037                 return(response);
1038             }
1039             
1040             Message * CMPIProviderManager::handleReferencesRequest(const Message * message) throw()
1041             {
1042                 PEG_METHOD_ENTER(TRC_PROVIDERMANAGER,
1043                    "CMPIProviderManager::handleReferencesRequest");
1044             
1045                 HandlerIntro(References,message,request,response,
1046                              handler,Array<CIMObject>());
1047                 try {
1048 schuur 1.4          Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE,
1049 schuur 1.14             "CMPIProviderManager::handleReferencesRequest - Host name: $0  Name space: $1  Class name: $2",
1050 schuur 1.4              System::getHostName(),
1051                         request->nameSpace.getString(),
1052                         request->objectName.getClassName().getString());
1053             
1054                     // make target object path
1055                     CIMObjectPath objectPath(
1056                         System::getHostName(),
1057                         request->nameSpace,
1058                         request->objectName.getClassName());
1059             
1060                     objectPath.setKeyBindings(request->objectName.getKeyBindings());
1061             
1062                     CIMObjectPath resultPath(
1063                         System::getHostName(),
1064                         request->nameSpace,
1065                         request->resultClass.getString());
1066             
1067                     ProviderName name(
1068                         resultPath.toString(),
1069                         String::EMPTY,
1070                         String::EMPTY,
1071 schuur 1.4              String::EMPTY,
1072                         ProviderType::ASSOCIATION);
1073             
1074                     // resolve provider name
1075                     name = _resolveProviderName(name);
1076             
1077                     // get cached or load new provider module
1078                     CMPIProvider::OpProviderHolder ph =
1079 schuur 1.10             providerManager.getProvider(name.getPhysicalName(), name.getLogicalName(), String::EMPTY);
1080 schuur 1.4  
1081                     // convert arguments
1082                     OperationContext context;
1083             
1084                     context.insert(IdentityContainer(request->userName));
1085                     context.insert(AcceptLanguageListContainer(request->acceptLanguages));
1086                     context.insert(ContentLanguageListContainer(request->contentLanguages));
1087             
1088                     // forward request
1089 schuur 1.17         CMPIProvider & pr=ph.GetProvider();
1090 schuur 1.4  
1091                     PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
1092                         "Calling provider.references: " + pr.getName());
1093             
1094 schuur 1.7          DDD(cerr<<"--- CMPIProviderManager::references"<<" role: >"<<request->role<<"< aCls "<<
1095 schuur 1.17         request->resultClass<<endl);
1096 schuur 1.4  
1097 schuur 1.17         CMPIStatus rc={CMPI_RC_OK,NULL};
1098 schuur 1.4          CMPI_ContextOnStack eCtx(context);
1099                     CMPI_ObjectPathOnStack eRef(objectPath);
1100 schuur 1.17         CMPI_ResultOnStack eRes(handler,&pr.broker);
1101 schuur 1.4          CMPI_ThreadContext thr(&pr.broker,&eCtx);
1102                     const CString rClass=request->resultClass.getString().getCString();
1103                     const CString rRole=request->role.getCString();
1104             
1105 schuur 1.17         CMPIPropertyList props(request->propertyList);
1106                     
1107 schuur 1.4          CMPIFlags flgs=0;
1108                     if (request->includeQualifiers) flgs|=CMPI_FLAG_IncludeQualifiers;
1109                     if (request->includeClassOrigin) flgs|=CMPI_FLAG_IncludeClassOrigin;
1110                     eCtx.ft->addEntry(&eCtx,CMPIInvocationFlags,(CMPIValue*)&flgs,CMPI_uint32);
1111             
1112                     CMPIProvider::pm_service_op_lock op_lock(&pr);
1113             
1114                     STAT_GETSTARTTIME;
1115             
1116                     rc=pr.miVector.assocMI->ft->references(
1117                                      pr.miVector.assocMI,&eCtx,&eRes,&eRef,
1118 schuur 1.17                          CHARS(rClass),CHARS(rRole),props.getList());
1119 schuur 1.4  
1120                     STAT_PMS_PROVIDEREND;
1121             
1122                     if (rc.rc!=CMPI_RC_OK)
1123 schuur 1.17             throw CIMException((CIMStatusCode)rc.rc);
1124 schuur 1.4      }
1125                 HandlerCatch(handler);
1126                 
1127                 PEG_METHOD_EXIT();
1128             
1129                 return(response);
1130             }
1131             
1132             Message * CMPIProviderManager::handleReferenceNamesRequest(const Message * message) throw()
1133             {
1134                 PEG_METHOD_ENTER(TRC_PROVIDERMANAGER,
1135                     "CMPIProviderManager::handleReferenceNamesRequest");
1136             
1137                 HandlerIntro(ReferenceNames,message,request,response,
1138                              handler,Array<CIMObjectPath>());
1139                 try {
1140                     Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE,
1141                         "CMPIProviderManager::handleReferenceNamesRequest - Host name: $0  Name space: $1  Class name: $2",
1142                         System::getHostName(),
1143                         request->nameSpace.getString(),
1144                         request->objectName.getClassName().getString());
1145 schuur 1.4  
1146                     // make target object path
1147                     CIMObjectPath objectPath(
1148                         System::getHostName(),
1149                         request->nameSpace,
1150                         request->objectName.getClassName());
1151             
1152                     objectPath.setKeyBindings(request->objectName.getKeyBindings());
1153             
1154                     CIMObjectPath resultPath(
1155                         System::getHostName(),
1156                         request->nameSpace,
1157                         request->resultClass.getString());
1158             
1159                     ProviderName name(
1160                         resultPath.toString(),
1161                         String::EMPTY,
1162                         String::EMPTY,
1163                         String::EMPTY,
1164                         ProviderType::ASSOCIATION);
1165             
1166 schuur 1.4          // resolve provider name
1167                     name = _resolveProviderName(name);
1168             
1169                     // get cached or load new provider module
1170                     CMPIProvider::OpProviderHolder ph =
1171 schuur 1.10             providerManager.getProvider(name.getPhysicalName(), name.getLogicalName(), String::EMPTY);
1172 schuur 1.4  
1173                     // convert arguments
1174                     OperationContext context;
1175             
1176                     context.insert(IdentityContainer(request->userName));
1177                     context.insert(AcceptLanguageListContainer(request->acceptLanguages));
1178                     context.insert(ContentLanguageListContainer(request->contentLanguages));
1179             
1180               	CMPIProvider & pr=ph.GetProvider();
1181             
1182                     PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
1183                         "Calling provider.referenceNames: " + pr.getName());
1184             
1185 schuur 1.7          DDD(cerr<<"--- CMPIProviderManager::referenceNames"<<" role: >"<<request->role<<"< aCls "<<
1186             	   request->resultClass<<endl);
1187 schuur 1.4  
1188             	CMPIStatus rc={CMPI_RC_OK,NULL};
1189                     CMPI_ContextOnStack eCtx(context);
1190                     CMPI_ObjectPathOnStack eRef(objectPath);
1191             	CMPI_ResultOnStack eRes(handler,&pr.broker);
1192                     CMPI_ThreadContext thr(&pr.broker,&eCtx);
1193                     const CString rClass=request->resultClass.getString().getCString();
1194                     const CString rRole=request->role.getCString();
1195             
1196                     CMPIFlags flgs=0;
1197                     eCtx.ft->addEntry(&eCtx,CMPIInvocationFlags,(CMPIValue*)&flgs,CMPI_uint32);
1198             
1199                     CMPIProvider::pm_service_op_lock op_lock(&pr);
1200             
1201                     STAT_GETSTARTTIME;
1202             
1203                     rc=pr.miVector.assocMI->ft->referenceNames(
1204                                      pr.miVector.assocMI,&eCtx,&eRes,&eRef,
1205                                      CHARS(rClass),CHARS(rRole));
1206             
1207                     STAT_PMS_PROVIDEREND;
1208 schuur 1.4  
1209                     if (rc.rc!=CMPI_RC_OK)
1210             	   throw CIMException((CIMStatusCode)rc.rc);
1211                 }
1212                 HandlerCatch(handler);
1213                 
1214                 PEG_METHOD_EXIT();
1215             
1216                 return(response);
1217             }
1218             
1219             Message * CMPIProviderManager::handleInvokeMethodRequest(const Message * message) throw()
1220             {
1221                 PEG_METHOD_ENTER(TRC_PROVIDERMANAGER,
1222                     "CMPIProviderManager::handleInvokeMethodRequest");
1223             
1224                 HandlerIntroMethod(InvokeMethod,message,request,response,
1225                              handler);
1226                 try {
1227                     Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE,
1228                         "CMPIProviderManager::handleInvokeMethodRequest - Host name: $0  Name space: $1  Class name: $2",
1229 schuur 1.4              System::getHostName(),
1230                         request->nameSpace.getString(),
1231                         request->instanceName.getClassName().getString());
1232             
1233                     // make target object path
1234                     CIMObjectPath objectPath(
1235                         System::getHostName(),
1236                         request->nameSpace,
1237                         request->instanceName.getClassName(),
1238                         request->instanceName.getKeyBindings());
1239             
1240                    ProviderName name(
1241                         objectPath.toString(),
1242                         String::EMPTY,
1243                         String::EMPTY,
1244                         String::EMPTY,
1245                         ProviderType::METHOD);
1246             
1247                     // resolve provider name
1248                     name = _resolveProviderName(name);
1249             
1250 schuur 1.4          // get cached or load new provider module
1251                     CMPIProvider::OpProviderHolder ph =
1252 schuur 1.10             providerManager.getProvider(name.getPhysicalName(), name.getLogicalName(), String::EMPTY);
1253 schuur 1.4  
1254                     // convert arguments
1255                     OperationContext context;
1256             
1257                     context.insert(IdentityContainer(request->userName));
1258                     context.insert(AcceptLanguageListContainer(request->acceptLanguages));
1259                     context.insert(ContentLanguageListContainer(request->contentLanguages));
1260             
1261                     CIMObjectPath instanceReference(request->instanceName);
1262             
1263                     // ATTN: propagate namespace
1264                     instanceReference.setNameSpace(request->nameSpace);
1265             
1266                     // forward request
1267              	CMPIProvider & pr=ph.GetProvider();
1268             
1269                     PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
1270                         "Calling provider.invokeMethod: " + pr.getName());
1271             
1272             	CMPIStatus rc={CMPI_RC_OK,NULL};
1273                     CMPI_ContextOnStack eCtx(context);
1274 schuur 1.4          CMPI_ObjectPathOnStack eRef(objectPath);
1275                     CMPI_ResultOnStack eRes(handler,&pr.broker);
1276                     CMPI_ThreadContext thr(&pr.broker,&eCtx);
1277                     CMPI_ArgsOnStack eArgsIn(request->inParameters);
1278                     Array<CIMParamValue> outArgs;
1279                     CMPI_ArgsOnStack eArgsOut(outArgs);
1280                     CString mName=request->methodName.getString().getCString();
1281             
1282                     CMPIFlags flgs=0;
1283                     eCtx.ft->addEntry(&eCtx,CMPIInvocationFlags,(CMPIValue*)&flgs,CMPI_uint32);
1284             
1285                     CMPIProvider::pm_service_op_lock op_lock(&pr);
1286             
1287                     STAT_GETSTARTTIME;
1288             
1289                     rc=pr.miVector.methMI->ft->invokeMethod(
1290                        pr.miVector.methMI,&eCtx,&eRes,&eRef,CHARS(mName),&eArgsIn,&eArgsOut);
1291             
1292                     STAT_PMS_PROVIDEREND;
1293             
1294                     if (rc.rc!=CMPI_RC_OK)
1295 schuur 1.4  	   throw CIMException((CIMStatusCode)rc.rc);
1296             
1297                    for (int i=0,s=outArgs.size(); i<s; i++)
1298                        handler.deliverParamValue(outArgs[i]);
1299                    handler.complete();
1300                 }
1301                 HandlerCatch(handler);
1302                 
1303                 PEG_METHOD_EXIT();
1304             
1305                 return(response); 
1306             }
1307             /*
1308             struct indProvRecord {
1309                indProvRecord() : enabled(false), count(1), handler(NULL) {}
1310                Boolean enabled;
1311                int count;
1312                EnableIndicationsResponseHandler* handler;
1313             };
1314             
1315             struct indSelectRecord {
1316 schuur 1.4     indSelectRecord() : eSelx(NULL) {}
1317                CMPI_SelectExp *eSelx;
1318             };
1319             
1320             
1321             typedef HashTable<String,indProvRecord*,EqualFunc<String>,HashFunc<String> > IndProvTab;
1322             typedef HashTable<String,indSelectRecord*,EqualFunc<String>,HashFunc<String> > IndSelectTab;
1323             
1324             IndProvTab provTab;
1325             IndSelectTab selxTab;
1326             */
1327             int LocateIndicationProviderNames(const CIMInstance& pInstance, const CIMInstance& pmInstance,
1328                                               String& providerName, String& location)
1329             {
1330                 Uint32 pos = pInstance.findProperty(CIMName ("Name"));
1331                 pInstance.getProperty(pos).getValue().get(providerName);
1332             
1333                 pos = pmInstance.findProperty(CIMName ("Location"));
1334                 pmInstance.getProperty(pos).getValue().get(location);
1335                 return 0;
1336             }
1337 schuur 1.4  
1338             String CMPIProviderManager::getFilter(CIMInstance &subscription)
1339             {
1340                try {
1341                CIMValue filterValue = subscription.getProperty (subscription.findProperty
1342                     ("Filter")).getValue ();
1343                CIMObjectPath filterReference;
1344                filterValue.get(filterReference);
1345                CIMNamespaceName ns("root/PG_InterOp");
1346             
1347                CIMInstance filter=_repository->getInstance(ns,filterReference);
1348             
1349                CIMValue queryValue = filter.getProperty (filter.findProperty
1350                     ("Query")).getValue ();
1351                String query;
1352                queryValue.get(query);
1353                return query;
1354                }
1355                catch (CIMException &e) {
1356 schuur 1.7        cout<<"??? CMPIProviderManager::getFilter"<<e.getCode()<<" "<<e.getMessage()<<" ???"<<endl;
1357 schuur 1.4        abort();
1358               }
1359                catch (...) {
1360 schuur 1.7        cout<<"??? What Happend ???"<<endl;
1361 schuur 1.4        abort();
1362                }
1363 marek  1.12    return String::EMPTY;
1364 schuur 1.4  }
1365             
1366             Message * CMPIProviderManager::handleCreateSubscriptionRequest(const Message * message) throw()
1367             {
1368 schuur 1.14     PEG_METHOD_ENTER(TRC_PROVIDERMANAGER, "CMPIProviderManager::handleCreateSubscriptionRequest");
1369 schuur 1.4  
1370                 HandlerIntroInd(CreateSubscription,message,request,response,
1371                              handler);
1372                 try {
1373                     const CIMObjectPath &x=request->subscriptionInstance.getPath();
1374             
1375 schuur 1.17         String providerName,providerLocation;
1376                     LocateIndicationProviderNames(request->provider, request->providerModule,
1377                     providerName,providerLocation);
1378 schuur 1.4  
1379                     Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE,
1380                         "CMPIProviderManager::handleCreateSubscriptionRequest - Host name: $0  Name space: $1  Provider name(s): $2",
1381                         System::getHostName(),
1382                         request->nameSpace.getString(),
1383                         providerName);
1384             
1385 schuur 1.15         String fileName = _resolvePhysicalName(providerLocation);
1386 schuur 1.4  
1387                     // get cached or load new provider module
1388                     CMPIProvider::OpProviderHolder ph =
1389 schuur 1.10             providerManager.getProvider(fileName, providerName, String::EMPTY);
1390 schuur 1.4  
1391                     indProvRecord *prec=NULL;
1392 schuur 1.17         provTab.lookup(providerName,prec);
1393                     if (prec) prec->count++;
1394 schuur 1.4          else {
1395 schuur 1.17            prec=new indProvRecord();
1396                        provTab.insert(providerName,prec);
1397                     }
1398 schuur 1.4  
1399                     indSelectRecord *srec=new indSelectRecord();
1400                     const CIMObjectPath &sPath=request->subscriptionInstance.getPath();
1401 schuur 1.17         selxTab.insert(sPath.toString(),srec);
1402 schuur 1.4  
1403                     // convert arguments
1404                     OperationContext *context=new OperationContext();
1405             
1406                     context->insert(IdentityContainer(request->userName));
1407                     context->insert(SubscriptionInstanceContainer
1408                         (request->subscriptionInstance));
1409                     context->insert(SubscriptionFilterConditionContainer
1410                         (request->condition, request->queryLanguage));
1411             
1412                     context->insert(SubscriptionLanguageListContainer
1413                         (request->acceptLanguages));
1414                     context->insert(AcceptLanguageListContainer(request->acceptLanguages));
1415                     context->insert(ContentLanguageListContainer(request->contentLanguages));
1416             
1417                     CIMObjectPath subscriptionName = request->subscriptionInstance.getPath();
1418             
1419 schuur 1.17         CMPIProvider & pr=ph.GetProvider();
1420 schuur 1.4  
1421 schuur 1.17         CMPIStatus rc={CMPI_RC_OK,NULL};
1422 schuur 1.4          CMPI_ContextOnStack eCtx(*context);
1423                     CMPI_SelectExp *eSelx=new CMPI_SelectExp(*context,
1424 schuur 1.17         getFilter(request->subscriptionInstance),
1425                     request->queryLanguage);
1426                     srec->eSelx=eSelx;
1427 schuur 1.4          CMPI_ThreadContext thr(&pr.broker,&eCtx);
1428             
1429                     PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
1430                         "Calling provider.createSubscriptionRequest: " + pr.getName());
1431             
1432 schuur 1.7          DDD(cerr<<"--- CMPIProviderManager::createSubscriptionRequest"<<endl);
1433 schuur 1.4  
1434                     for(Uint32 i = 0, n = request->classNames.size(); i < n; i++) {
1435                         CIMObjectPath className(
1436                             System::getHostName(),
1437                             request->nameSpace,
1438                             request->classNames[i]);
1439                         eSelx->classNames.append(className);
1440                     }
1441                     CMPI_ObjectPathOnStack eRef(eSelx->classNames[0]);
1442             
1443                     CIMPropertyList propertyList = request->propertyList;
1444 schuur 1.17         if (!propertyList.isNull()) {
1445 schuur 1.4             Array<CIMName> p=propertyList.getPropertyNameArray();
1446                        int pCount=p.size();
1447                        eSelx->props=(const char**)malloc((1+pCount)*sizeof(char*));
1448                        for (int i=0; i<pCount; i++) {
1449                           eSelx->props[i]=strdup(p[i].getString().getCString());
1450 schuur 1.17            }
1451 schuur 1.4             eSelx->props[pCount]=NULL;
1452                     }
1453             
1454                     Uint16 repeatNotificationPolicy = request->repeatNotificationPolicy;
1455             
1456                     CMPIProvider::pm_service_op_lock op_lock(&pr);
1457             
1458                     STAT_GETSTARTTIME;
1459             
1460                     rc=pr.miVector.indMI->ft->activateFilter(
1461                        pr.miVector.indMI,&eCtx,NULL,eSelx,
1462                        CHARS(request->nameSpace.getString().getCString()),&eRef,false);
1463             
1464                    STAT_PMS_PROVIDEREND;
1465             
1466                     if (rc.rc!=CMPI_RC_OK)
1467 schuur 1.17            throw CIMException((CIMStatusCode)rc.rc);
1468 schuur 1.4      }
1469                 HandlerCatch(handler);
1470                 
1471                 PEG_METHOD_EXIT();
1472             
1473                 return(response);
1474             }
1475             
1476             Message * CMPIProviderManager::handleDeleteSubscriptionRequest(const Message * message) throw()
1477             {
1478                 PEG_METHOD_ENTER(TRC_PROVIDERMANAGER, "CMPIProviderManager::handleDeleteSubscriptionRequest");
1479             
1480                 HandlerIntroInd(DeleteSubscription,message,request,response,
1481                              handler);
1482                 try {
1483             	String providerName,providerLocation;
1484             	LocateIndicationProviderNames(request->provider, request->providerModule,
1485             	   providerName,providerLocation);
1486             
1487                     Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE,
1488                         "CMPIProviderManager::handleDeleteSubscriptionRequest - Host name: $0  Name space: $1  Provider name(s): $2",
1489 schuur 1.4              System::getHostName(),
1490                         request->nameSpace.getString(),
1491                         providerName);
1492             
1493 schuur 1.15         String fileName = _resolvePhysicalName(providerLocation);
1494 schuur 1.4  
1495                     // get cached or load new provider module
1496                     CMPIProvider::OpProviderHolder ph =
1497 schuur 1.10             providerManager.getProvider(fileName, providerName, String::EMPTY);
1498 schuur 1.4  
1499             
1500                     indProvRecord *prec=NULL;
1501             	provTab.lookup(providerName,prec);
1502             	if (--prec->count<=0) {
1503             	   provTab.remove(providerName);
1504             	   prec=NULL;
1505             	}
1506             
1507                     indSelectRecord *srec=NULL;
1508                     const CIMObjectPath &sPath=request->subscriptionInstance.getPath();
1509             	String sPathString=sPath.toString();
1510             	selxTab.lookup(sPathString,srec);
1511             
1512                     CMPI_SelectExp *eSelx=srec->eSelx;
1513                     CMPI_ObjectPathOnStack eRef(eSelx->classNames[0]);
1514             	selxTab.remove(sPathString);
1515             
1516             	// convert arguments
1517                     OperationContext context;
1518             
1519 schuur 1.4          context.insert(IdentityContainer(request->userName));
1520                     context.insert(SubscriptionInstanceContainer
1521                         (request->subscriptionInstance));
1522             
1523                     context.insert(SubscriptionLanguageListContainer
1524                         (request->acceptLanguages));
1525                     context.insert(AcceptLanguageListContainer(request->acceptLanguages));
1526                     context.insert(ContentLanguageListContainer(request->contentLanguages));
1527             
1528                     CIMObjectPath subscriptionName = request->subscriptionInstance.getPath();
1529             
1530               	CMPIProvider & pr=ph.GetProvider();
1531             
1532             	CMPIStatus rc={CMPI_RC_OK,NULL};
1533                     CMPI_ContextOnStack eCtx(context);
1534                     CMPI_ThreadContext thr(&pr.broker,&eCtx);
1535             
1536                     PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
1537                         "Calling provider.deleteSubscriptionRequest: " + pr.getName());
1538             
1539 schuur 1.7          DDD(cerr<<"--- CMPIProviderManager::deleteSubscriptionRequest"<<endl);
1540 schuur 1.4  
1541                     CMPIProvider::pm_service_op_lock op_lock(&pr);
1542             
1543                     STAT_GETSTARTTIME;
1544             
1545                     rc=pr.miVector.indMI->ft->deActivateFilter(
1546                        pr.miVector.indMI,&eCtx,NULL,eSelx,
1547                        CHARS(request->nameSpace.getString().getCString()),&eRef,prec==NULL);
1548             
1549                    delete eSelx;
1550             
1551                    STAT_PMS_PROVIDEREND;
1552             
1553                     if (rc.rc!=CMPI_RC_OK)
1554             	   throw CIMException((CIMStatusCode)rc.rc);
1555                 }
1556                 HandlerCatch(handler);
1557                 
1558                 PEG_METHOD_EXIT();
1559             
1560                 return(response);
1561 schuur 1.4  }
1562             
1563             Message * CMPIProviderManager::handleEnableIndicationsRequest(const Message * message) throw()
1564             {
1565                 PEG_METHOD_ENTER(TRC_PROVIDERMANAGER, "CMPIProviderManager:: handleEnableIndicationsRequest");
1566             
1567                 HandlerIntroInd(EnableIndications,message,request,response,
1568                              handler);
1569                 try {
1570                     String providerName,providerLocation;
1571             	LocateIndicationProviderNames(request->provider, request->providerModule,
1572             	   providerName,providerLocation);
1573             
1574                     indProvRecord *provRec;
1575                     if (provTab.lookup(providerName,provRec)) {
1576                        provRec->enabled=true;
1577                        provRec->handler=new EnableIndicationsResponseHandler(request, response,
1578                           request->provider, ProviderManagerService::providerManagerService);
1579                     }
1580             
1581 schuur 1.15         String fileName = _resolvePhysicalName(providerLocation);
1582 schuur 1.4  
1583                     // get cached or load new provider module
1584                     CMPIProvider::OpProviderHolder ph =
1585 schuur 1.10             providerManager.getProvider(fileName, providerName, String::EMPTY);
1586 schuur 1.4  
1587                     // convert arguments
1588                     OperationContext context;
1589             
1590                     context.insert(AcceptLanguageListContainer(request->acceptLanguages));
1591                     context.insert(ContentLanguageListContainer(request->contentLanguages));
1592             
1593               	CMPIProvider & pr=ph.GetProvider();
1594             
1595             	CMPIStatus rc={CMPI_RC_OK,NULL};
1596                     CMPI_ContextOnStack eCtx(context);
1597                     CMPI_ThreadContext thr(&pr.broker,&eCtx);
1598             
1599                     PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
1600                         "Calling provider.EnableIndicationRequest: " + pr.getName());
1601             
1602 schuur 1.7          DDD(cerr<<"--- CMPIProviderManager::enableIndicationRequest"<<endl);
1603 schuur 1.4  
1604                     CMPIProvider::pm_service_op_lock op_lock(&pr);
1605             
1606                     STAT_GETSTARTTIME;
1607             
1608                     pr.miVector.indMI->ft->enableIndications(
1609                        pr.miVector.indMI);
1610             
1611                    STAT_PMS_PROVIDEREND;
1612                 }
1613                 HandlerCatch(handler);
1614                 
1615                 PEG_METHOD_EXIT();
1616             
1617                 return(response);
1618             }
1619             
1620             Message * CMPIProviderManager::handleDisableIndicationsRequest(const Message * message) throw()
1621             {
1622                 PEG_METHOD_ENTER(TRC_PROVIDERMANAGER, "CMPIProviderManager:: handleDisableIndicationsRequest");
1623             
1624 schuur 1.4      HandlerIntroInd(DisableIndications,message,request,response,
1625                              handler);
1626                 try {
1627                     String providerName,providerLocation;
1628             	LocateIndicationProviderNames(request->provider, request->providerModule,
1629             	   providerName,providerLocation);
1630             
1631                     indProvRecord *provRec;
1632                     if (provTab.lookup(providerName,provRec)) {
1633                        provRec->enabled=false;
1634                        if (provRec->handler) delete provRec->handler;
1635             	   provRec->handler=NULL;
1636                     }
1637             
1638 schuur 1.15         String fileName = _resolvePhysicalName(providerLocation);
1639 schuur 1.4  
1640                     // get cached or load new provider module
1641                     CMPIProvider::OpProviderHolder ph =
1642 schuur 1.10             providerManager.getProvider(fileName, providerName, String::EMPTY);
1643 schuur 1.4  
1644                     // convert arguments
1645                     OperationContext context;
1646             
1647                     context.insert(AcceptLanguageListContainer(request->acceptLanguages));
1648                     context.insert(ContentLanguageListContainer(request->contentLanguages));
1649             
1650               	CMPIProvider & pr=ph.GetProvider();
1651             
1652             	CMPIStatus rc={CMPI_RC_OK,NULL};
1653                     CMPI_ContextOnStack eCtx(context);
1654                     CMPI_ThreadContext thr(&pr.broker,&eCtx);
1655             
1656                     PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
1657                         "Calling provider.DisableIndicationRequest: " + pr.getName());
1658             
1659 schuur 1.7          DDD(cerr<<"--- CMPIProviderManager::disableIndicationRequest"<<endl);
1660 schuur 1.4  
1661                     CMPIProvider::pm_service_op_lock op_lock(&pr);
1662             
1663                     STAT_GETSTARTTIME;
1664             
1665                     pr.miVector.indMI->ft->disableIndications(
1666                        pr.miVector.indMI);
1667             
1668                    STAT_PMS_PROVIDEREND;
1669                 }
1670                 HandlerCatch(handler);
1671                 
1672                 PEG_METHOD_EXIT();
1673             
1674                 return(response);
1675             }
1676             //
1677             // Provider module status
1678             //
1679             static const Uint16 _MODULE_OK       = 2;
1680             static const Uint16 _MODULE_STOPPING = 9;
1681 schuur 1.4  static const Uint16 _MODULE_STOPPED  = 10;
1682             
1683             Message * CMPIProviderManager::handleDisableModuleRequest(const Message * message) throw()
1684             {
1685                 // HACK
1686                 ProviderRegistrationManager * _providerRegistrationManager = GetProviderRegistrationManager();
1687             
1688                 PEG_METHOD_ENTER(TRC_PROVIDERMANAGER, "CMPIProviderManager::handleDisableModuleRequest");
1689             
1690                 CIMDisableModuleRequestMessage * request =
1691                     dynamic_cast<CIMDisableModuleRequestMessage *>(const_cast<Message *>(message));
1692             
1693                 PEGASUS_ASSERT(request != 0);
1694             
1695                 // get provider module name
1696                 String moduleName;
1697                 CIMInstance mInstance = request->providerModule;
1698                 Uint32 pos = mInstance.findProperty(CIMName ("Name"));
1699             
1700                 if(pos != PEG_NOT_FOUND)
1701                 {
1702 schuur 1.4          mInstance.getProperty(pos).getValue().get(moduleName);
1703                 }
1704             
1705                 Boolean disableProviderOnly = request->disableProviderOnly;
1706             
1707                 //
1708                 // get operational status
1709                 //
1710                 Array<Uint16> operationalStatus;
1711             
1712                 if(!disableProviderOnly)
1713                 {
1714                     Uint32 pos2 = mInstance.findProperty(CIMName ("OperationalStatus"));
1715             
1716                     if(pos2 != PEG_NOT_FOUND)
1717                     {
1718                         //
1719                         //  ATTN-CAKG-P2-20020821: Check for null status?
1720                         //
1721                         mInstance.getProperty(pos2).getValue().get(operationalStatus);
1722                     }
1723 schuur 1.4  
1724                     //
1725                     // update module status from OK to Stopping
1726                     //
1727                     for(Uint32 i=0, n = operationalStatus.size(); i < n; i++)
1728                     {
1729                         if(operationalStatus[i] == _MODULE_OK)
1730                         {
1731                             operationalStatus.remove(i);
1732                         }
1733                     }
1734                     operationalStatus.append(_MODULE_STOPPING);
1735             
1736                     if(_providerRegistrationManager->setProviderModuleStatus
1737                         (moduleName, operationalStatus) == false)
1738                     {
1739                         //l10n
1740                         //throw PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED, "set module status failed.");
1741                         throw PEGASUS_CIM_EXCEPTION_L(CIM_ERR_FAILED, MessageLoaderParms(
1742                             "ProviderManager.CMPIProviderManager.SET_MODULE_STATUS_FAILED",
1743                             "set module status failed."));
1744 schuur 1.4          }
1745                 }
1746             
1747                 // Unload providers
1748                 Array<CIMInstance> _pInstances = request->providers;
1749 schuur 1.16     String physicalName=_resolvePhysicalName(request->providerModule.getProperty(
1750             	      request->providerModule.findProperty("Location")).getValue().toString());
1751 schuur 1.4  
1752                 for(Uint32 i = 0, n = _pInstances.size(); i < n; i++)
1753                 {
1754 schuur 1.16         providerManager.unloadProvider(_pInstances[i].getProperty(
1755             	                                  request->providerModule.findProperty
1756                                                       ("Name")).getValue ().toString (),
1757                                                    physicalName);
1758 schuur 1.4      }
1759             
1760                 if(!disableProviderOnly)
1761                 {
1762                     // update module status from Stopping to Stopped
1763                     for(Uint32 i=0, n = operationalStatus.size(); i < n; i++)
1764                     {
1765                         if(operationalStatus[i] == _MODULE_STOPPING)
1766                         {
1767                             operationalStatus.remove(i);
1768                         }
1769                     }
1770             
1771                     operationalStatus.append(_MODULE_STOPPED);
1772             
1773                     if(_providerRegistrationManager->setProviderModuleStatus
1774                         (moduleName, operationalStatus) == false)
1775                     {
1776                         //l10n
1777                         //throw PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED,
1778                         //"set module status failed.");
1779 schuur 1.4              throw PEGASUS_CIM_EXCEPTION_L(CIM_ERR_FAILED, MessageLoaderParms(
1780                             "ProviderManager.CMPIProviderManager.SET_MODULE_STATUS_FAILED",
1781                             "set module status failed."));
1782                     }
1783                 }
1784             
1785                 CIMDisableModuleResponseMessage * response =
1786                     new CIMDisableModuleResponseMessage(
1787                     request->messageId,
1788                     CIMException(),
1789                     request->queueIds.copyAndPop(),
1790                     operationalStatus);
1791             
1792                 PEGASUS_ASSERT(response != 0);
1793             
1794                 // preserve message key
1795                 response->setKey(request->getKey());
1796             
1797                 //
1798                 //  Set HTTP method in response from request
1799                 //
1800 schuur 1.4      response->setHttpMethod (request->getHttpMethod ());
1801             
1802                 PEG_METHOD_EXIT();
1803             
1804                 return(response);
1805             }
1806             
1807             Message * CMPIProviderManager::handleEnableModuleRequest(const Message * message) throw()
1808             {
1809                 // HACK
1810                 ProviderRegistrationManager * _providerRegistrationManager = GetProviderRegistrationManager();
1811             
1812                 PEG_METHOD_ENTER(TRC_PROVIDERMANAGER, "CMPIProviderManager::handleEnableModuleRequest");
1813             
1814                 CIMEnableModuleRequestMessage * request =
1815                     dynamic_cast<CIMEnableModuleRequestMessage *>(const_cast<Message *>(message));
1816             
1817                 PEGASUS_ASSERT(request != 0);
1818             
1819                 //
1820                 // get module status
1821 schuur 1.4      //
1822                 CIMInstance mInstance = request->providerModule;
1823                 Array<Uint16> operationalStatus;
1824                 Uint32 pos = mInstance.findProperty(CIMName ("OperationalStatus"));
1825             
1826                 if(pos != PEG_NOT_FOUND)
1827                 {
1828                     //
1829                     //  ATTN-CAKG-P2-20020821: Check for null status?
1830                     //
1831                     mInstance.getProperty(pos).getValue().get(operationalStatus);
1832                 }
1833             
1834                 // update module status from Stopped to OK
1835                 for(Uint32 i=0, n = operationalStatus.size(); i < n; i++)
1836                 {
1837                     if(operationalStatus[i] == _MODULE_STOPPED)
1838                     {
1839                         operationalStatus.remove(i);
1840                     }
1841                 }
1842 schuur 1.4  
1843                 operationalStatus.append(_MODULE_OK);
1844             
1845                 //
1846                 // get module name
1847                 //
1848                 String moduleName;
1849             
1850                 Uint32 pos2 = mInstance.findProperty(CIMName ("Name"));
1851             
1852                 if(pos2 != PEG_NOT_FOUND)
1853                 {
1854                     mInstance.getProperty(pos2).getValue().get(moduleName);
1855                 }
1856             
1857                 if(_providerRegistrationManager->setProviderModuleStatus
1858                     (moduleName, operationalStatus) == false)
1859                 {
1860                     //l10n
1861                     //throw PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED, "set module status failed.");
1862                     throw PEGASUS_CIM_EXCEPTION_L(CIM_ERR_FAILED, MessageLoaderParms(
1863 schuur 1.4              "ProviderManager.CMPIProviderManager.SET_MODULE_STATUS_FAILED",
1864                         "set module status failed."));
1865                 }
1866             
1867                 CIMEnableModuleResponseMessage * response =
1868                     new CIMEnableModuleResponseMessage(
1869                     request->messageId,
1870                     CIMException(),
1871                     request->queueIds.copyAndPop(),
1872                     operationalStatus);
1873             
1874                 PEGASUS_ASSERT(response != 0);
1875             
1876                 // preserve message key
1877                 response->setKey(request->getKey());
1878             
1879                 //  Set HTTP method in response from request
1880                 response->setHttpMethod (request->getHttpMethod ());
1881             
1882                 PEG_METHOD_EXIT();
1883             
1884 schuur 1.4      return(response);
1885             }
1886             
1887             Message * CMPIProviderManager::handleStopAllProvidersRequest(const Message * message) throw()
1888             {
1889                 PEG_METHOD_ENTER(TRC_PROVIDERMANAGER, "CMPIProviderManager::handleStopAllProvidersRequest");
1890             
1891                 CIMStopAllProvidersRequestMessage * request =
1892                     dynamic_cast<CIMStopAllProvidersRequestMessage *>(const_cast<Message *>(message));
1893             
1894                 PEGASUS_ASSERT(request != 0);
1895             
1896                 CIMStopAllProvidersResponseMessage * response =
1897                     new CIMStopAllProvidersResponseMessage(
1898                     request->messageId,
1899                     CIMException(),
1900                     request->queueIds.copyAndPop());
1901             
1902                 PEGASUS_ASSERT(response != 0);
1903             
1904                 // preserve message key
1905 schuur 1.4      response->setKey(request->getKey());
1906             
1907                 //  Set HTTP method in response from request
1908                 response->setHttpMethod (request->getHttpMethod ());
1909             
1910                 // tell the provider manager to shutdown all the providers
1911 schuur 1.10     providerManager.shutdownAllProviders();
1912 schuur 1.4  
1913                 PEG_METHOD_EXIT();
1914             
1915                 return(response);
1916             }
1917             
1918             Message * CMPIProviderManager::handleUnsupportedRequest(const Message * message) throw()
1919             {
1920                 PEG_METHOD_ENTER(TRC_PROVIDERMANAGER, "CMPIProviderManager::handleUnsupportedRequest");
1921             
1922                 PEG_METHOD_EXIT();
1923             
1924                 // a null response implies unsupported or unknown operation
1925 chip   1.1      return(0);
1926 schuur 1.4  }
1927             
1928             ProviderName CMPIProviderManager::_resolveProviderName(const ProviderName & providerName)
1929             {
1930                 ProviderName temp = findProvider(providerName);
1931             
1932 schuur 1.15     String physicalName=_resolvePhysicalName(temp.getPhysicalName());
1933 schuur 1.4  
1934                 temp.setPhysicalName(physicalName);
1935             
1936                 return(temp);
1937 chip   1.1  }
1938             
1939             PEGASUS_NAMESPACE_END

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2