(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 se.gupta 1.36 // Modified By:	Seema Gupta (gseema@in.ibm.com) for PEP135
  29 chip     1.1  //
  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 kumpf    1.42 #include <Pegasus/Common/Constants.h>
  51 schuur   1.4  
  52               #include <Pegasus/Config/ConfigManager.h>
  53 schuur   1.14 #include <Pegasus/Server/CIMServer.h>
  54 schuur   1.4  
  55 schuur   1.13 #include <Pegasus/ProviderManager2/ProviderType.h>
  56 schuur   1.4  #include <Pegasus/ProviderManager2/ProviderName.h>
  57               #include <Pegasus/ProviderManager2/CMPI/CMPIProvider.h>
  58               #include <Pegasus/ProviderManager2/ProviderManagerService.h>
  59 schuur   1.19 //#include <Pegasus/ProviderManager2/Default/OperationResponseHandler.h>
  60 schuur   1.4  
  61 marek    1.26 #ifdef PEGASUS_ZOS_THREADLEVEL_SECURITY
  62               #include <Pegasus/ProviderManager2/ProviderManagerzOS_inline.h>
  63               #endif
  64               
  65 schuur   1.7  PEGASUS_USING_STD;
  66 chip     1.1  PEGASUS_NAMESPACE_BEGIN
  67               
  68 schuur   1.4  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 dj.gorey 1.25   public:
  80 schuur   1.17    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 dj.gorey 1.25          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.39    _repository=ProviderManagerService::getRepository();
 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 dj.gorey 1.29 Message * CMPIProviderManager::processMessage(Message * request)
 125 chip     1.1  {
 126 schuur   1.4        PEG_METHOD_ENTER(TRC_PROVIDERMANAGER,
 127                       "CMPIProviderManager::processMessage()");
 128               
 129                   Message * response = 0;
 130 dj.gorey 1.25 
 131 schuur   1.4      // 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 dj.gorey 1.29         response = handleGetInstanceRequest(request);
 136 schuur   1.4  
 137                       break;
 138                   case CIM_ENUMERATE_INSTANCES_REQUEST_MESSAGE:
 139 dj.gorey 1.29         response = handleEnumerateInstancesRequest(request);
 140 schuur   1.4  
 141                       break;
 142                   case CIM_ENUMERATE_INSTANCE_NAMES_REQUEST_MESSAGE:
 143 dj.gorey 1.29         response = handleEnumerateInstanceNamesRequest(request);
 144 schuur   1.4  
 145                       break;
 146                   case CIM_CREATE_INSTANCE_REQUEST_MESSAGE:
 147 dj.gorey 1.29         response = handleCreateInstanceRequest(request);
 148 schuur   1.4  
 149                       break;
 150                   case CIM_MODIFY_INSTANCE_REQUEST_MESSAGE:
 151 dj.gorey 1.29         response = handleModifyInstanceRequest(request);
 152 schuur   1.4  
 153                       break;
 154                   case CIM_DELETE_INSTANCE_REQUEST_MESSAGE:
 155 dj.gorey 1.29         response = handleDeleteInstanceRequest(request);
 156 schuur   1.4  
 157                       break;
 158                   case CIM_EXEC_QUERY_REQUEST_MESSAGE:
 159 dj.gorey 1.29         response = handleExecQueryRequest(request);
 160 schuur   1.4  
 161                       break;
 162                   case CIM_ASSOCIATORS_REQUEST_MESSAGE:
 163 dj.gorey 1.29         response = handleAssociatorsRequest(request);
 164 schuur   1.4  
 165                       break;
 166                   case CIM_ASSOCIATOR_NAMES_REQUEST_MESSAGE:
 167 dj.gorey 1.29         response = handleAssociatorNamesRequest(request);
 168 schuur   1.4  
 169                       break;
 170                   case CIM_REFERENCES_REQUEST_MESSAGE:
 171 dj.gorey 1.29         response = handleReferencesRequest(request);
 172 schuur   1.4  
 173                       break;
 174                   case CIM_REFERENCE_NAMES_REQUEST_MESSAGE:
 175 dj.gorey 1.29         response = handleReferenceNamesRequest(request);
 176 schuur   1.4  
 177                       break;
 178                   case CIM_INVOKE_METHOD_REQUEST_MESSAGE:
 179 dj.gorey 1.29         response = handleInvokeMethodRequest(request);
 180 schuur   1.4  
 181                       break;
 182                   case CIM_CREATE_SUBSCRIPTION_REQUEST_MESSAGE:
 183 dj.gorey 1.29         response = handleCreateSubscriptionRequest(request);
 184 schuur   1.4  
 185                       break;
 186               /*    case CIM_MODIFY_SUBSCRIPTION_REQUEST_MESSAGE:
 187 dj.gorey 1.29         response = handleModifySubscriptionRequest(request);
 188 schuur   1.4  
 189                       break;
 190               */  case CIM_DELETE_SUBSCRIPTION_REQUEST_MESSAGE:
 191 dj.gorey 1.29         response = handleDeleteSubscriptionRequest(request);
 192 schuur   1.4  
 193                       break;
 194                   case CIM_ENABLE_INDICATIONS_REQUEST_MESSAGE:
 195 dj.gorey 1.29         response = handleEnableIndicationsRequest(request);
 196 schuur   1.4  
 197                       break;
 198                   case CIM_DISABLE_INDICATIONS_REQUEST_MESSAGE:
 199 dj.gorey 1.29         response = handleDisableIndicationsRequest(request);
 200 schuur   1.4  
 201                       break;
 202 kumpf    1.35 /*    case CIM_EXPORT_INDICATION_REQUEST_MESSAGE:
 203                       response = handleExportIndicationRequest(request);
 204 schuur   1.4          break;
 205 schuur   1.16 */
 206 schuur   1.4      case CIM_DISABLE_MODULE_REQUEST_MESSAGE:
 207 dj.gorey 1.29         response = handleDisableModuleRequest(request);
 208 schuur   1.4  
 209                       break;
 210                   case CIM_ENABLE_MODULE_REQUEST_MESSAGE:
 211 dj.gorey 1.29         response = handleEnableModuleRequest(request);
 212 schuur   1.4  
 213 dj.gorey 1.25         break;
 214 schuur   1.4      case CIM_STOP_ALL_PROVIDERS_REQUEST_MESSAGE:
 215 dj.gorey 1.29         response = handleStopAllProvidersRequest(request);
 216 schuur   1.4  
 217 schuur   1.5          break;
 218 kumpf    1.32     case CIM_INITIALIZE_PROVIDER_REQUEST_MESSAGE:
 219               	response = handleInitializeProviderRequest(request);
 220               
 221               	break;
 222 schuur   1.4      default:
 223 dj.gorey 1.29         response = handleUnsupportedRequest(request);
 224 schuur   1.4  
 225                       break;
 226                   }
 227 dj.gorey 1.25 
 228 schuur   1.4      PEG_METHOD_EXIT();
 229               
 230                   return(response);
 231               }
 232               
 233 kumpf    1.34 Boolean CMPIProviderManager::hasActiveProviders()
 234               {
 235                    return providerManager.hasActiveProviders();
 236               }
 237               
 238               void CMPIProviderManager::unloadIdleProviders()
 239 schuur   1.4  {
 240 kumpf    1.34      providerManager.unloadIdleProviders();
 241 schuur   1.4  }
 242               
 243               
 244               #define CHARS(cstring) (char*)(strlen(cstring)?(const char*)cstring:NULL)
 245               
 246               
 247               #define HandlerIntroBase(type,type1,message,request,response,handler,respType) \
 248                   CIM##type##RequestMessage * request = \
 249                       dynamic_cast<CIM##type##RequestMessage *>(const_cast<Message *>(message)); \
 250                   PEGASUS_ASSERT(request != 0); \
 251                   CIM##type##ResponseMessage * response = \
 252                       new CIM##type##ResponseMessage( \
 253                       request->messageId, \
 254                       CIMException(), \
 255                       request->queueIds.copyAndPop() \
 256                       respType \
 257                   PEGASUS_ASSERT(response != 0); \
 258                   response->setKey(request->getKey()); \
 259                   response->setHttpMethod(request->getHttpMethod()); \
 260 dj.gorey 1.25     type1##ResponseHandler handler(request, response);
 261 schuur   1.4  
 262               #define VOIDINTRO );
 263               #define NOVOIDINTRO(type) ,type);
 264               #define METHODINTRO ,CIMValue(), Array<CIMParamValue>(), request->methodName );
 265               
 266               
 267               #define HandlerIntroVoid(type,message,request,response,handler) \
 268                    HandlerIntroBase(type,type,message,request,response,handler,VOIDINTRO)
 269               
 270               #define HandlerIntroMethod(type,message,request,response,handler) \
 271                    HandlerIntroBase(type,type,message,request,response,handler,METHODINTRO)
 272               
 273               #define HandlerIntroInd(type,message,request,response,handler) \
 274                    HandlerIntroBase(type,Operation,message,request,response,handler,VOIDINTRO)
 275               
 276 kumpf    1.32 #define HandlerIntroInit(type,message,request,response,handler) \
 277                    HandlerIntroBase(type,Operation,message,request,response,handler,VOIDINTRO)
 278               
 279 schuur   1.4  #define HandlerIntro(type,message,request,response,handler,respType) \
 280                    HandlerIntroBase(type,type,message,request,response,handler,NOVOIDINTRO(respType))
 281 dj.gorey 1.25 
 282 schuur   1.4  #define HandlerCatch(handler) \
 283                   catch(CIMException & e)  \
 284                   { PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4, \
 285                               "Exception: " + e.getMessage()); \
 286                       handler.setStatus(e.getCode(), e.getContentLanguages(), e.getMessage()); \
 287                   } \
 288                   catch(Exception & e) \
 289                   { PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4, \
 290                               "Exception: " + e.getMessage()); \
 291                       handler.setStatus(CIM_ERR_FAILED, e.getContentLanguages(), e.getMessage()); \
 292                   } \
 293                   catch(...) \
 294                   { PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4, \
 295                               "Exception: Unknown"); \
 296                       handler.setStatus(CIM_ERR_FAILED, "Unknown error."); \
 297                   }
 298               
 299               
 300               
 301 dj.gorey 1.29 Message * CMPIProviderManager::handleGetInstanceRequest(const Message * message)
 302 schuur   1.4  {
 303                   PEG_METHOD_ENTER(TRC_PROVIDERMANAGER,
 304                       "CMPIProviderManager::handleGetInstanceRequest");
 305               
 306                   HandlerIntro(GetInstance,message,request,response,handler,CIMInstance());
 307               
 308                   try {
 309 dj.gorey 1.25         Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE,
 310 schuur   1.4              "CmpiProviderManager::handleGetInstanceRequest - Host name: $0  Name space: $1  Class name: $2",
 311                           System::getHostName(),
 312                           request->nameSpace.getString(),
 313                           request->instanceName.getClassName().getString());
 314               
 315                       // make target object path
 316                       CIMObjectPath objectPath(
 317                           System::getHostName(),
 318                           request->nameSpace,
 319                           request->instanceName.getClassName(),
 320                           request->instanceName.getKeyBindings());
 321               
 322 schuur   1.39         Boolean remote=false;
 323                       CMPIProvider::OpProviderHolder ph;
 324 schuur   1.40 
 325 schuur   1.4          // resolve provider name
 326 schuur   1.40         ProviderIdContainer pidc = request->operationContext.get(ProviderIdContainer::NAME);
 327                       ProviderName name = _resolveProviderName(pidc);
 328 schuur   1.4  
 329 schuur   1.40         if ((remote=pidc.isRemoteNameSpace())) {
 330 schuur   1.39            ph = providerManager.getRemoteProvider(name.getLocation(), name.getLogicalName());
 331               	}
 332               	else {
 333 schuur   1.4          // get cached or load new provider module
 334 schuur   1.39            ph = providerManager.getProvider(name.getPhysicalName(), name.getLogicalName());
 335 schuur   1.40         }
 336 schuur   1.4  
 337                       // convert arguments
 338                       OperationContext context;
 339               
 340 schuur   1.40         context.insert(request->operationContext.get(IdentityContainer::NAME));
 341                       context.insert(request->operationContext.get(AcceptLanguageListContainer::NAME));
 342                       context.insert(request->operationContext.get(ContentLanguageListContainer::NAME));
 343 schuur   1.4          // forward request
 344 schuur   1.17         CMPIProvider & pr=ph.GetProvider();
 345 schuur   1.4  
 346                       PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
 347                           "Calling provider.getInstance: " + pr.getName());
 348               
 349 schuur   1.7          DDD(cerr<<"--- CMPIProviderManager::getInstance"<<endl);
 350 schuur   1.4  
 351 schuur   1.17         CMPIStatus rc={CMPI_RC_OK,NULL};
 352 schuur   1.4          CMPI_ContextOnStack eCtx(context);
 353                       CMPI_ObjectPathOnStack eRef(objectPath);
 354                       CMPI_ResultOnStack eRes(handler,&pr.broker);
 355                       CMPI_ThreadContext thr(&pr.broker,&eCtx);
 356               
 357 schuur   1.17         CMPIPropertyList props(request->propertyList);
 358 dj.gorey 1.25 
 359 schuur   1.4          CMPIFlags flgs=0;
 360                       if (request->includeQualifiers) flgs|=CMPI_FLAG_IncludeQualifiers;
 361                       if (request->includeClassOrigin) flgs|=CMPI_FLAG_IncludeClassOrigin;
 362                       eCtx.ft->addEntry(&eCtx,CMPIInvocationFlags,(CMPIValue*)&flgs,CMPI_uint32);
 363               
 364 schuur   1.39         if (remote) {
 365 schuur   1.40            CString info=pidc.getRemoteInfo().getCString();
 366 schuur   1.39            eCtx.ft->addEntry(&eCtx,"CMPIRRemoteInfo",(CMPIValue*)(const char*)info,CMPI_chars);
 367                       }
 368               
 369 schuur   1.4          CMPIProvider::pm_service_op_lock op_lock(&pr);
 370               
 371 marek    1.26 #ifdef PEGASUS_ZOS_THREADLEVEL_SECURITY
 372 dj.gorey 1.29                 CIMGetInstanceRequestMessage * req = dynamic_cast<CIMGetInstanceRequestMessage *>(const_cast<Message *>(message));
 373                               int err_num=enablePThreadSecurity(req->userName);
 374                               if (err_num!=0)
 375                               {
 376                                       // need a new CIMException for this
 377                                       throw CIMException(CIM_ERR_ACCESS_DENIED,String(strerror(err_num)));
 378                               }
 379 marek    1.26 #endif
 380               
 381 schuur   1.17         STAT_GETSTARTTIME;
 382 schuur   1.4  
 383                       rc=pr.miVector.instMI->ft->getInstance
 384 schuur   1.17         (pr.miVector.instMI,&eCtx,&eRes,&eRef,props.getList());
 385 schuur   1.4  
 386                       STAT_PMS_PROVIDEREND;
 387               
 388 marek    1.26 #ifdef PEGASUS_ZOS_THREADLEVEL_SECURITY
 389 dj.gorey 1.29                 disablePThreadSecurity(req->userName);
 390 marek    1.26 #endif
 391 schuur   1.4          if (rc.rc!=CMPI_RC_OK)
 392 schuur   1.23            throw CIMException((CIMStatusCode)rc.rc,
 393 dj.gorey 1.25                rc.msg ? CMGetCharsPtr(rc.msg,NULL) : String::EMPTY);
 394 schuur   1.21     }
 395 schuur   1.4      HandlerCatch(handler);
 396 dj.gorey 1.25 
 397 schuur   1.4      PEG_METHOD_EXIT();
 398               
 399                   return(response);
 400               }
 401               
 402 dj.gorey 1.29 Message * CMPIProviderManager::handleEnumerateInstancesRequest(const Message * message)
 403 schuur   1.4  {
 404                   PEG_METHOD_ENTER(TRC_PROVIDERMANAGER,
 405                       "CMPIProviderManager::handleEnumerateInstanceRequest");
 406               
 407                   HandlerIntro(EnumerateInstances,message,request,response,
 408                                handler,Array<CIMInstance>());
 409 dj.gorey 1.25     try {
 410 schuur   1.4        Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE,
 411                           "CMPIProviderManager::handleEnumerateInstancesRequest - Host name: $0  Name space: $1  Class name: $2",
 412                           System::getHostName(),
 413                           request->nameSpace.getString(),
 414                           request->className.getString());
 415               
 416                       // make target object path
 417                       CIMObjectPath objectPath(
 418                           System::getHostName(),
 419                           request->nameSpace,
 420                           request->className);
 421               
 422 schuur   1.39         Boolean remote=false;
 423                       CMPIProvider::OpProviderHolder ph;
 424 schuur   1.40 
 425 schuur   1.4          // resolve provider name
 426 schuur   1.40         ProviderIdContainer pidc = request->operationContext.get(ProviderIdContainer::NAME);
 427                       ProviderName name = _resolveProviderName(pidc);
 428 schuur   1.4  
 429 schuur   1.40         if ((remote=pidc.isRemoteNameSpace())) {
 430 schuur   1.39            ph = providerManager.getRemoteProvider(name.getLocation(), name.getLogicalName());
 431               	}
 432               	else {
 433 schuur   1.4          // get cached or load new provider module
 434 schuur   1.39            ph = providerManager.getProvider(name.getPhysicalName(), name.getLogicalName());
 435 schuur   1.40         }
 436 schuur   1.4  
 437 dj.gorey 1.25         // convert arguments
 438 schuur   1.4          OperationContext context;
 439               
 440 schuur   1.40         context.insert(request->operationContext.get(IdentityContainer::NAME));
 441                       context.insert(request->operationContext.get(AcceptLanguageListContainer::NAME));
 442                       context.insert(request->operationContext.get(ContentLanguageListContainer::NAME));
 443 schuur   1.4  
 444                       CIMPropertyList propertyList(request->propertyList);
 445               
 446                       // forward request
 447 schuur   1.17         CMPIProvider & pr=ph.GetProvider();
 448 schuur   1.4  
 449                       PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
 450                           "Calling provider.enumerateInstances: " + pr.getName());
 451               
 452 schuur   1.7          DDD(cerr<<"--- CMPIProviderManager::enumerateInstances"<<endl);
 453 schuur   1.4  
 454 schuur   1.17         CMPIStatus rc={CMPI_RC_OK,NULL};
 455 schuur   1.4          CMPI_ContextOnStack eCtx(context);
 456                       CMPI_ObjectPathOnStack eRef(objectPath);
 457                       CMPI_ResultOnStack eRes(handler,&pr.broker);
 458                       CMPI_ThreadContext thr(&pr.broker,&eCtx);
 459               
 460 schuur   1.17         CMPIPropertyList props(propertyList);
 461 schuur   1.4  
 462                       CMPIFlags flgs=0;
 463                       if (request->includeQualifiers) flgs|=CMPI_FLAG_IncludeQualifiers;
 464                       if (request->includeClassOrigin) flgs|=CMPI_FLAG_IncludeClassOrigin;
 465                       eCtx.ft->addEntry(&eCtx,CMPIInvocationFlags,(CMPIValue*)&flgs,CMPI_uint32);
 466               
 467 schuur   1.39         if (remote) {
 468 schuur   1.40            CString info=pidc.getRemoteInfo().getCString();
 469 schuur   1.39            eCtx.ft->addEntry(&eCtx,"CMPIRRemoteInfo",(CMPIValue*)(const char*)info,CMPI_chars);
 470                       }
 471               
 472 schuur   1.4          CMPIProvider::pm_service_op_lock op_lock(&pr);
 473               
 474 marek    1.26 #ifdef PEGASUS_ZOS_THREADLEVEL_SECURITY
 475 dj.gorey 1.29                 CIMEnumerateInstancesRequestMessage * req = dynamic_cast<CIMEnumerateInstancesRequestMessage *>(const_cast<Message *>(message));
 476                               int err_num=enablePThreadSecurity(req->userName);
 477                               if (err_num!=0)
 478                               {
 479                                       // need a new CIMException for this
 480                                       throw CIMException(CIM_ERR_ACCESS_DENIED,String(strerror(err_num)));
 481                               }
 482 marek    1.26 #endif
 483               
 484 schuur   1.4          STAT_GETSTARTTIME;
 485               
 486                       rc=pr.miVector.instMI->ft->enumInstances
 487 dj.gorey 1.25         (pr.miVector.instMI,&eCtx,&eRes,&eRef,props.getList());
 488 schuur   1.4  
 489                       STAT_PMS_PROVIDEREND;
 490               
 491 marek    1.26 #ifdef PEGASUS_ZOS_THREADLEVEL_SECURITY
 492 dj.gorey 1.29                 disablePThreadSecurity(req->userName);
 493 marek    1.26 #endif
 494               
 495 schuur   1.4          if (rc.rc!=CMPI_RC_OK)
 496 schuur   1.23         throw CIMException((CIMStatusCode)rc.rc,
 497 dj.gorey 1.25                rc.msg ? CMGetCharsPtr(rc.msg,NULL) : String::EMPTY);
 498 schuur   1.4  
 499                       STAT_PMS_PROVIDEREND;
 500                   }
 501                   HandlerCatch(handler);
 502 dj.gorey 1.25 
 503 schuur   1.4      PEG_METHOD_EXIT();
 504               
 505                   return(response);
 506               }
 507               
 508 dj.gorey 1.29 Message * CMPIProviderManager::handleEnumerateInstanceNamesRequest(const Message * message)
 509 schuur   1.4  {
 510                   PEG_METHOD_ENTER(TRC_PROVIDERMANAGER, "CMPIProviderManager::handleEnumerateInstanceNamesRequest");
 511               
 512                   HandlerIntro(EnumerateInstanceNames,message,request,response,
 513                                handler,Array<CIMObjectPath>());
 514                   try {
 515                       Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE,
 516                           "CMPIProviderManager::handleEnumerateInstanceNamesRequest - Host name: $0  Name space: $1  Class name: $2",
 517                           System::getHostName(),
 518                           request->nameSpace.getString(),
 519                           request->className.getString());
 520 dj.gorey 1.25 
 521 schuur   1.4         // make target object path
 522                       CIMObjectPath objectPath(
 523                           System::getHostName(),
 524                           request->nameSpace,
 525                           request->className);
 526               
 527 schuur   1.39         Boolean remote=false;
 528                       CMPIProvider::OpProviderHolder ph;
 529               
 530 schuur   1.4          // resolve provider name
 531 schuur   1.40         ProviderIdContainer pidc = request->operationContext.get(ProviderIdContainer::NAME);
 532                       ProviderName name = _resolveProviderName(pidc);
 533 schuur   1.4  
 534 schuur   1.40         if ((remote=pidc.isRemoteNameSpace())) {
 535 schuur   1.39            ph = providerManager.getRemoteProvider(name.getLocation(), name.getLogicalName());
 536                       }
 537                       else {
 538 schuur   1.4          // get cached or load new provider module
 539 schuur   1.39            ph = providerManager.getProvider(name.getPhysicalName(), name.getLogicalName());
 540                       }
 541 schuur   1.4  
 542                       // convert arguments
 543                       OperationContext context;
 544               
 545 schuur   1.40         context.insert(request->operationContext.get(IdentityContainer::NAME));
 546                       context.insert(request->operationContext.get(AcceptLanguageListContainer::NAME));
 547                       context.insert(request->operationContext.get(ContentLanguageListContainer::NAME));
 548 dj.gorey 1.25         CMPIProvider & pr=ph.GetProvider();
 549 schuur   1.4  
 550 dj.gorey 1.25         PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
 551 schuur   1.4              "Calling provider.enumerateInstanceNames: " + pr.getName());
 552               
 553 schuur   1.7          DDD(cerr<<"--- CMPIProviderManager::enumerateInstanceNames"<<endl);
 554 schuur   1.4  
 555                       CMPIStatus rc={CMPI_RC_OK,NULL};
 556                       CMPI_ContextOnStack eCtx(context);
 557                       CMPI_ObjectPathOnStack eRef(objectPath);
 558                       CMPI_ResultOnStack eRes(handler,&pr.broker);
 559                       CMPI_ThreadContext thr(&pr.broker,&eCtx);
 560               
 561                       CMPIFlags flgs=0;
 562                       eCtx.ft->addEntry(&eCtx,CMPIInvocationFlags,(CMPIValue*)&flgs,CMPI_uint32);
 563               
 564 schuur   1.39         if (remote) {
 565 schuur   1.40            CString info=pidc.getRemoteInfo().getCString();
 566 schuur   1.39            eCtx.ft->addEntry(&eCtx,"CMPIRRemoteInfo",(CMPIValue*)(const char*)info,CMPI_chars);
 567                       }
 568               
 569 schuur   1.4          CMPIProvider::pm_service_op_lock op_lock(&pr);
 570               
 571 marek    1.26 #ifdef PEGASUS_ZOS_THREADLEVEL_SECURITY
 572 dj.gorey 1.29                 CIMEnumerateInstanceNamesRequestMessage * req = dynamic_cast<CIMEnumerateInstanceNamesRequestMessage *>(const_cast<Message *>(message));
 573                               int err_num=enablePThreadSecurity(req->userName);
 574                               if (err_num!=0)
 575                               {
 576                                       // need a new CIMException for this
 577                                       throw CIMException(CIM_ERR_ACCESS_DENIED,String(strerror(err_num)));
 578                               }
 579 marek    1.26 #endif
 580 schuur   1.4          STAT_GETSTARTTIME;
 581               
 582                       rc=pr.miVector.instMI->ft->enumInstanceNames(pr.miVector.instMI,&eCtx,&eRes,&eRef);
 583               
 584                       STAT_PMS_PROVIDEREND;
 585               
 586 marek    1.26 #ifdef PEGASUS_ZOS_THREADLEVEL_SECURITY
 587 dj.gorey 1.29                 disablePThreadSecurity(req->userName);
 588 marek    1.26 #endif
 589               
 590 schuur   1.4          if (rc.rc!=CMPI_RC_OK)
 591 dj.gorey 1.25            throw CIMException((CIMStatusCode)rc.rc,
 592                              rc.msg ? CMGetCharsPtr(rc.msg,NULL) : String::EMPTY);
 593 schuur   1.4      }
 594                   HandlerCatch(handler);
 595 dj.gorey 1.25 
 596 schuur   1.4  
 597                   PEG_METHOD_EXIT();
 598               
 599                   return(response);
 600               }
 601               
 602 dj.gorey 1.29 Message * CMPIProviderManager::handleCreateInstanceRequest(const Message * message)
 603 schuur   1.4  {
 604                   PEG_METHOD_ENTER(TRC_PROVIDERMANAGER,
 605                      "CMPIProviderManager::handleCreateInstanceRequest");
 606               
 607                   HandlerIntro(CreateInstance,message,request,response,
 608                                handler,CIMObjectPath());
 609                   try {
 610                       Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE,
 611                           "CMPIProviderManager::handleCreateInstanceRequest - Host name: $0  Name space: $1  Class name: $2",
 612                           System::getHostName(),
 613                           request->nameSpace.getString(),
 614                           request->newInstance.getPath().getClassName().getString());
 615               
 616                       // make target object path
 617                       CIMObjectPath objectPath(
 618                           System::getHostName(),
 619                           request->nameSpace,
 620                           request->newInstance.getPath().getClassName(),
 621                           request->newInstance.getPath().getKeyBindings());
 622 schuur   1.39 	request->newInstance.setPath(objectPath);
 623               
 624                       Boolean remote=false;
 625                       CMPIProvider::OpProviderHolder ph;
 626 schuur   1.4  
 627                       // resolve provider name
 628 schuur   1.40         ProviderIdContainer pidc = request->operationContext.get(ProviderIdContainer::NAME);
 629                       ProviderName name = _resolveProviderName(pidc);
 630 schuur   1.4  
 631 schuur   1.40         if ((remote=pidc.isRemoteNameSpace())) {
 632 schuur   1.39            ph = providerManager.getRemoteProvider(name.getLocation(), name.getLogicalName());
 633               	}
 634               	else {
 635 schuur   1.4          // get cached or load new provider module
 636 schuur   1.39            ph = providerManager.getProvider(name.getPhysicalName(), name.getLogicalName());
 637 schuur   1.40         }
 638 schuur   1.4  
 639                       // convert arguments
 640                       OperationContext context;
 641               
 642 schuur   1.40         context.insert(request->operationContext.get(IdentityContainer::NAME));
 643                       context.insert(request->operationContext.get(AcceptLanguageListContainer::NAME));
 644                       context.insert(request->operationContext.get(ContentLanguageListContainer::NAME));
 645 schuur   1.4          // forward request
 646 dj.gorey 1.25         CMPIProvider & pr=ph.GetProvider();
 647 schuur   1.4  
 648                       PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
 649                           "Calling provider.createInstance: " +
 650                           ph.GetProvider().getName());
 651               
 652 schuur   1.7          DDD(cerr<<"--- CMPIProviderManager::createInstances"<<endl);
 653 dj.gorey 1.25         CMPIStatus rc={CMPI_RC_OK,NULL};
 654 schuur   1.4          CMPI_ContextOnStack eCtx(context);
 655                       CMPI_ObjectPathOnStack eRef(objectPath);
 656                       CMPI_ResultOnStack eRes(handler,&pr.broker);
 657                       CMPI_InstanceOnStack eInst(request->newInstance);
 658                       CMPI_ThreadContext thr(&pr.broker,&eCtx);
 659               
 660                       CMPIFlags flgs=0;
 661                       eCtx.ft->addEntry(&eCtx,CMPIInvocationFlags,(CMPIValue*)&flgs,CMPI_uint32);
 662               
 663 schuur   1.39         if (remote) {
 664 schuur   1.40            CString info=pidc.getRemoteInfo().getCString();
 665 schuur   1.39            eCtx.ft->addEntry(&eCtx,"CMPIRRemoteInfo",(CMPIValue*)(const char*)info,CMPI_chars);
 666                       }
 667               
 668 schuur   1.4          CMPIProvider::pm_service_op_lock op_lock(&pr);
 669               
 670 marek    1.26 #ifdef PEGASUS_ZOS_THREADLEVEL_SECURITY
 671 dj.gorey 1.29                 CIMCreateInstanceRequestMessage * req = dynamic_cast<CIMCreateInstanceRequestMessage *>(const_cast<Message *>(message));
 672                               int err_num=enablePThreadSecurity(req->userName);
 673                               if (err_num!=0)
 674                               {
 675                                       // need a new CIMException for this
 676                                       throw CIMException(CIM_ERR_ACCESS_DENIED,String(strerror(err_num)));
 677                               }
 678 marek    1.26 #endif
 679               
 680 schuur   1.4          STAT_GETSTARTTIME;
 681               
 682                       rc=pr.miVector.instMI->ft->createInstance
 683 dj.gorey 1.25            (pr.miVector.instMI,&eCtx,&eRes,&eRef,&eInst);
 684 schuur   1.4  
 685                       STAT_PMS_PROVIDEREND;
 686               
 687 marek    1.26 #ifdef PEGASUS_ZOS_THREADLEVEL_SECURITY
 688 dj.gorey 1.29                 disablePThreadSecurity(req->userName);
 689 marek    1.26 #endif
 690               
 691 schuur   1.4          if (rc.rc!=CMPI_RC_OK)
 692 dj.gorey 1.25            throw CIMException((CIMStatusCode)rc.rc,
 693                              rc.msg ? CMGetCharsPtr(rc.msg,NULL) : String::EMPTY);
 694 schuur   1.4      }
 695                   HandlerCatch(handler);
 696 dj.gorey 1.25 
 697 schuur   1.4      PEG_METHOD_EXIT();
 698               
 699                   return(response);
 700               }
 701               
 702 dj.gorey 1.29 Message * CMPIProviderManager::handleModifyInstanceRequest(const Message * message)
 703 schuur   1.4  {
 704                   PEG_METHOD_ENTER(TRC_PROVIDERMANAGER,
 705                      "CMPIProviderManager::handleModifyInstanceRequest");
 706               
 707                   HandlerIntroVoid(ModifyInstance,message,request,response,
 708                                handler);
 709                   try {
 710                       Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE,
 711 schuur   1.14             "CMPIProviderManager::handleModifyInstanceRequest - Host name: $0  Name space: $1  Class name: $2",
 712 schuur   1.4              System::getHostName(),
 713                           request->nameSpace.getString(),
 714                           request->modifiedInstance.getPath().getClassName().getString());
 715               
 716                       // make target object path
 717                       CIMObjectPath objectPath(
 718                           System::getHostName(),
 719                           request->nameSpace,
 720                           request->modifiedInstance.getPath ().getClassName(),
 721                           request->modifiedInstance.getPath ().getKeyBindings());
 722               
 723 schuur   1.39         Boolean remote=false;
 724                       CMPIProvider::OpProviderHolder ph;
 725               
 726 schuur   1.4          // resolve provider name
 727 schuur   1.40         ProviderIdContainer pidc = request->operationContext.get(ProviderIdContainer::NAME);
 728                       ProviderName name = _resolveProviderName(pidc);
 729 schuur   1.4  
 730 schuur   1.40         if ((remote=pidc.isRemoteNameSpace())) {
 731 schuur   1.39            ph = providerManager.getRemoteProvider(name.getLocation(), name.getLogicalName());
 732                       }
 733                       else {
 734 schuur   1.4          // get cached or load new provider module
 735 schuur   1.39            ph = providerManager.getProvider(name.getPhysicalName(), name.getLogicalName());
 736                       }
 737 schuur   1.4  
 738                       // convert arguments
 739                       OperationContext context;
 740               
 741 schuur   1.40         context.insert(request->operationContext.get(IdentityContainer::NAME));
 742                       context.insert(request->operationContext.get(AcceptLanguageListContainer::NAME));
 743                       context.insert(request->operationContext.get(ContentLanguageListContainer::NAME));
 744 schuur   1.4          // forward request
 745 schuur   1.17         CMPIProvider & pr=ph.GetProvider();
 746 schuur   1.4  
 747                       PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
 748                           "Calling provider.modifyInstance: " + pr.getName());
 749               
 750 schuur   1.7          DDD(cerr<<"--- CMPIProviderManager::modifyInstance"<<endl);
 751 schuur   1.4  
 752 schuur   1.17         CMPIStatus rc={CMPI_RC_OK,NULL};
 753 schuur   1.4          CMPI_ContextOnStack eCtx(context);
 754                       CMPI_ObjectPathOnStack eRef(objectPath);
 755                       CMPI_ResultOnStack eRes(handler,&pr.broker);
 756                       CMPI_InstanceOnStack eInst(request->modifiedInstance);
 757                       CMPI_ThreadContext thr(&pr.broker,&eCtx);
 758               
 759 schuur   1.17         CMPIPropertyList props(request->propertyList);
 760 dj.gorey 1.25 
 761 schuur   1.4          CMPIFlags flgs=0;
 762                       if (request->includeQualifiers) flgs|=CMPI_FLAG_IncludeQualifiers;
 763                       eCtx.ft->addEntry(&eCtx,CMPIInvocationFlags,(CMPIValue*)&flgs,CMPI_uint32);
 764               
 765 schuur   1.39         if (remote) {
 766 schuur   1.40            CString info=pidc.getRemoteInfo().getCString();
 767 schuur   1.39            eCtx.ft->addEntry(&eCtx,"CMPIRRemoteInfo",(CMPIValue*)(const char*)info,CMPI_chars);
 768                       }
 769               
 770 schuur   1.4          CMPIProvider::pm_service_op_lock op_lock(&pr);
 771               
 772 marek    1.26 #ifdef PEGASUS_ZOS_THREADLEVEL_SECURITY
 773 dj.gorey 1.29                 CIMModifyInstanceRequestMessage * req = dynamic_cast<CIMModifyInstanceRequestMessage *>(const_cast<Message *>(message));
 774                               int err_num=enablePThreadSecurity(req->userName);
 775                               if (err_num!=0)
 776                               {
 777                                       // need a new CIMException for this
 778                                       throw CIMException(CIM_ERR_ACCESS_DENIED,String(strerror(err_num)));
 779                               }
 780 marek    1.26 #endif
 781               
 782 schuur   1.4          STAT_GETSTARTTIME;
 783               
 784                       rc=pr.miVector.instMI->ft->setInstance
 785 schuur   1.17         (pr.miVector.instMI,&eCtx,&eRes,&eRef,&eInst,props.getList());
 786 schuur   1.4  
 787                       STAT_PMS_PROVIDEREND;
 788               
 789 marek    1.26 #ifdef PEGASUS_ZOS_THREADLEVEL_SECURITY
 790 dj.gorey 1.29                 disablePThreadSecurity(req->userName);
 791 marek    1.26 #endif
 792               
 793 schuur   1.4          if (rc.rc!=CMPI_RC_OK)
 794 dj.gorey 1.25            throw CIMException((CIMStatusCode)rc.rc,
 795                              rc.msg ? CMGetCharsPtr(rc.msg,NULL) : String::EMPTY);
 796 schuur   1.4      }
 797                   HandlerCatch(handler);
 798 dj.gorey 1.25 
 799 schuur   1.4      PEG_METHOD_EXIT();
 800               
 801                   return(response);
 802               }
 803               
 804 dj.gorey 1.29 Message * CMPIProviderManager::handleDeleteInstanceRequest(const Message * message)
 805 schuur   1.4  {
 806                   PEG_METHOD_ENTER(TRC_PROVIDERMANAGER,
 807                      "CMPIProviderManager::handleDeleteInstanceRequest");
 808               
 809                   HandlerIntroVoid(DeleteInstance,message,request,response,
 810                                handler);
 811                   try {
 812                       Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE,
 813 schuur   1.14             "CMPIProviderManager::handleDeleteInstanceRequest - Host name: $0  Name space: $1  Class name: $2",
 814 schuur   1.4              System::getHostName(),
 815                           request->nameSpace.getString(),
 816                           request->instanceName.getClassName().getString());
 817               
 818                       // make target object path
 819                       CIMObjectPath objectPath(
 820                           System::getHostName(),
 821                           request->nameSpace,
 822                           request->instanceName.getClassName(),
 823                           request->instanceName.getKeyBindings());
 824               
 825 schuur   1.39         Boolean remote=false;
 826                       CMPIProvider::OpProviderHolder ph;
 827 schuur   1.40 
 828 schuur   1.4          // resolve provider name
 829 schuur   1.40         ProviderIdContainer pidc = request->operationContext.get(ProviderIdContainer::NAME);
 830                       ProviderName name = _resolveProviderName(pidc);
 831 schuur   1.4  
 832 schuur   1.40         if ((remote=pidc.isRemoteNameSpace())) {
 833 schuur   1.39            ph = providerManager.getRemoteProvider(name.getLocation(), name.getLogicalName());
 834                       }
 835                       else {
 836 schuur   1.4          // get cached or load new provider module
 837 schuur   1.39            ph = providerManager.getProvider(name.getPhysicalName(), name.getLogicalName());
 838                       }
 839 schuur   1.4  
 840                       // convert arguments
 841                       OperationContext context;
 842               
 843 schuur   1.40         context.insert(request->operationContext.get(IdentityContainer::NAME));
 844                       context.insert(request->operationContext.get(AcceptLanguageListContainer::NAME));
 845                       context.insert(request->operationContext.get(ContentLanguageListContainer::NAME));
 846 schuur   1.4          // forward request
 847 dj.gorey 1.25         CMPIProvider & pr=ph.GetProvider();
 848 schuur   1.4  
 849                       PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
 850                           "Calling provider.deleteInstance: " + pr.getName());
 851               
 852 dj.gorey 1.25         CMPIStatus rc={CMPI_RC_OK,NULL};
 853 schuur   1.4          CMPI_ContextOnStack eCtx(context);
 854                       CMPI_ObjectPathOnStack eRef(objectPath);
 855                       CMPI_ResultOnStack eRes(handler,&pr.broker);
 856                       CMPI_ThreadContext thr(&pr.broker,&eCtx);
 857               
 858                       CMPIFlags flgs=0;
 859                       eCtx.ft->addEntry(&eCtx,CMPIInvocationFlags,(CMPIValue*)&flgs,CMPI_uint32);
 860               
 861 schuur   1.39         if (remote) {
 862 schuur   1.40            CString info=pidc.getRemoteInfo().getCString();
 863 schuur   1.39            eCtx.ft->addEntry(&eCtx,"CMPIRRemoteInfo",(CMPIValue*)(const char*)info,CMPI_chars);
 864                       }
 865               
 866 schuur   1.4          CMPIProvider::pm_service_op_lock op_lock(&pr);
 867               
 868 marek    1.26 #ifdef PEGASUS_ZOS_THREADLEVEL_SECURITY
 869 dj.gorey 1.29                 CIMDeleteInstanceRequestMessage * req = dynamic_cast<CIMDeleteInstanceRequestMessage *>(const_cast<Message *>(message));
 870                               int err_num=enablePThreadSecurity(req->userName);
 871                               if (err_num!=0)
 872                               {
 873                                       // need a new CIMException for this
 874                                       throw CIMException(CIM_ERR_ACCESS_DENIED,String(strerror(err_num)));
 875                               }
 876 marek    1.26 #endif
 877               
 878 schuur   1.4          STAT_GETSTARTTIME;
 879               
 880                       rc=pr.miVector.instMI->ft->deleteInstance
 881 dj.gorey 1.25            (pr.miVector.instMI,&eCtx,&eRes,&eRef);
 882 schuur   1.4  
 883                       STAT_PMS_PROVIDEREND;
 884               
 885 marek    1.26 #ifdef PEGASUS_ZOS_THREADLEVEL_SECURITY
 886 dj.gorey 1.29                 disablePThreadSecurity(req->userName);
 887 marek    1.26 #endif
 888               
 889 schuur   1.4          if (rc.rc!=CMPI_RC_OK)
 890 dj.gorey 1.25            throw CIMException((CIMStatusCode)rc.rc,
 891                              rc.msg ? CMGetCharsPtr(rc.msg,NULL) : String::EMPTY);
 892 schuur   1.4      }
 893                   HandlerCatch(handler);
 894 dj.gorey 1.25 
 895 schuur   1.4      PEG_METHOD_EXIT();
 896               
 897                   return(response);
 898               }
 899               
 900 dj.gorey 1.29 Message * CMPIProviderManager::handleExecQueryRequest(const Message * message)
 901 schuur   1.4  {
 902                   PEG_METHOD_ENTER(TRC_PROVIDERMANAGER,
 903 schuur   1.14        "CMPIProviderManager::handleExecQueryRequest");
 904 schuur   1.4  
 905 schuur   1.14     HandlerIntro(ExecQuery,message,request,response,
 906                                handler,Array<CIMObject>());
 907               
 908 dj.gorey 1.25     try {
 909 schuur   1.14       Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE,
 910                           "CMPIProviderManager::ExecQueryRequest - Host name: $0  Name space: $1  Class name: $2",
 911                           System::getHostName(),
 912                           request->nameSpace.getString(),
 913                           request->className.getString());
 914               
 915                       // make target object path
 916                       CIMObjectPath objectPath(
 917                           System::getHostName(),
 918                           request->nameSpace,
 919                           request->className);
 920               
 921 schuur   1.39         Boolean remote=false;
 922 schuur   1.40 
 923 schuur   1.39         CMPIProvider::OpProviderHolder ph;
 924 schuur   1.40 
 925 schuur   1.14         // resolve provider name
 926 schuur   1.40         ProviderIdContainer pidc = request->operationContext.get(ProviderIdContainer::NAME);
 927                       ProviderName name = _resolveProviderName(pidc);
 928 schuur   1.14 
 929 schuur   1.40         if ((remote=pidc.isRemoteNameSpace())) {
 930 schuur   1.39            ph = providerManager.getRemoteProvider(name.getLocation(), name.getLogicalName());
 931                       }
 932                       else {
 933 schuur   1.14         // get cached or load new provider module
 934 schuur   1.39            ph = providerManager.getProvider(name.getPhysicalName(), name.getLogicalName());
 935                       }
 936 schuur   1.4  
 937 dj.gorey 1.25         // convert arguments
 938 schuur   1.14         OperationContext context;
 939 schuur   1.4  
 940 schuur   1.40         context.insert(request->operationContext.get(IdentityContainer::NAME));
 941                       context.insert(request->operationContext.get(AcceptLanguageListContainer::NAME));
 942                       context.insert(request->operationContext.get(ContentLanguageListContainer::NAME));
 943 schuur   1.14 
 944                       // forward request
 945 dj.gorey 1.25         CMPIProvider & pr=ph.GetProvider();
 946 schuur   1.14 
 947                       PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
 948                           "Calling provider.execQuery: " + pr.getName());
 949               
 950                       DDD(cerr<<"--- CMPIProviderManager::execQuery"<<endl);
 951               
 952                       const char **props=NULL;
 953               
 954 dj.gorey 1.25         CMPIStatus rc={CMPI_RC_OK,NULL};
 955 schuur   1.14         CMPI_ContextOnStack eCtx(context);
 956                       CMPI_ObjectPathOnStack eRef(objectPath);
 957                       CMPI_ResultOnStack eRes(handler,&pr.broker);
 958                       CMPI_ThreadContext thr(&pr.broker,&eCtx);
 959 se.gupta 1.43 		SubscriptionFilterConditionContainer sub_cntr =  request->operationContext.get
 960               										(SubscriptionFilterConditionContainer::NAME);
 961                       const CString queryLan=(sub_cntr.getQueryLanguage()).getCString(); 
 962 schuur   1.14         const CString query=request->query.getCString();
 963               
 964                       CMPIFlags flgs=0;
 965                       eCtx.ft->addEntry(&eCtx,CMPIInvocationFlags,(CMPIValue*)&flgs,CMPI_uint32);
 966               
 967 schuur   1.39         if (remote) {
 968 schuur   1.40            CString info=pidc.getRemoteInfo().getCString();
 969 schuur   1.39            eCtx.ft->addEntry(&eCtx,"CMPIRRemoteInfo",(CMPIValue*)(const char*)info,CMPI_chars);
 970                       }
 971               
 972 schuur   1.14         CMPIProvider::pm_service_op_lock op_lock(&pr);
 973               
 974 marek    1.26 #ifdef PEGASUS_ZOS_THREADLEVEL_SECURITY
 975 dj.gorey 1.29                 CIMExecQueryRequestMessage * req = dynamic_cast<CIMExecQueryRequestMessage *>(const_cast<Message *>(message));
 976                               int err_num=enablePThreadSecurity(req->userName);
 977                               if (err_num!=0)
 978                               {
 979                                       // need a new CIMException for this
 980                                       throw CIMException(CIM_ERR_ACCESS_DENIED,String(strerror(err_num)));
 981                               }
 982 marek    1.26 #endif
 983               
 984 schuur   1.14         STAT_GETSTARTTIME;
 985               
 986                       rc=pr.miVector.instMI->ft->execQuery
 987 dj.gorey 1.25            (pr.miVector.instMI,&eCtx,&eRes,&eRef,CHARS(queryLan),CHARS(query));
 988 schuur   1.14 
 989                       STAT_PMS_PROVIDEREND;
 990               
 991 marek    1.26 #ifdef PEGASUS_ZOS_THREADLEVEL_SECURITY
 992 dj.gorey 1.29                 disablePThreadSecurity(req->userName);
 993 marek    1.26 #endif
 994               
 995 schuur   1.14         if (rc.rc!=CMPI_RC_OK)
 996 dj.gorey 1.25            throw CIMException((CIMStatusCode)rc.rc,
 997                              rc.msg ? CMGetCharsPtr(rc.msg,NULL) : String::EMPTY);
 998 schuur   1.14 
 999                       STAT_PMS_PROVIDEREND;
1000                   }
1001                   HandlerCatch(handler);
1002 schuur   1.4  
1003                   PEG_METHOD_EXIT();
1004               
1005                   return(response);
1006               }
1007               
1008 dj.gorey 1.29 Message * CMPIProviderManager::handleAssociatorsRequest(const Message * message)
1009 schuur   1.4  {
1010                   PEG_METHOD_ENTER(TRC_PROVIDERMANAGER,
1011                      "CMPIProviderManager::handleAssociatorsRequest");
1012               
1013                   HandlerIntro(Associators,message,request,response,
1014                                handler,Array<CIMObject>());
1015                   try {
1016                       Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE,
1017                           "CMPIProviderManager::handleAssociatorsRequest - Host name: $0  Name space: $1  Class name: $2",
1018                           System::getHostName(),
1019                           request->nameSpace.getString(),
1020                           request->objectName.getClassName().getString());
1021               
1022                       // make target object path
1023                       CIMObjectPath objectPath(
1024                           System::getHostName(),
1025                           request->nameSpace,
1026                           request->objectName.getClassName());
1027               
1028                       objectPath.setKeyBindings(request->objectName.getKeyBindings());
1029               
1030 schuur   1.4          CIMObjectPath assocPath(
1031                           System::getHostName(),
1032                           request->nameSpace,
1033                           request->assocClass.getString());
1034               
1035 schuur   1.39         Boolean remote=false;
1036 schuur   1.40 
1037 schuur   1.39         CMPIProvider::OpProviderHolder ph;
1038 schuur   1.40 
1039 schuur   1.4          // resolve provider name
1040 schuur   1.40         ProviderIdContainer pidc = request->operationContext.get(ProviderIdContainer::NAME);
1041                       ProviderName name = _resolveProviderName(pidc);
1042 schuur   1.4  
1043 schuur   1.40         if ((remote=pidc.isRemoteNameSpace())) {
1044 schuur   1.39            ph = providerManager.getRemoteProvider(name.getLocation(), name.getLogicalName());
1045                       }
1046                       else {
1047 schuur   1.4          // get cached or load new provider module
1048 schuur   1.39            ph = providerManager.getProvider(name.getPhysicalName(), name.getLogicalName());
1049                       }
1050 schuur   1.4  
1051                      // convert arguments
1052                       OperationContext context;
1053               
1054 schuur   1.40         context.insert(request->operationContext.get(IdentityContainer::NAME));
1055                       context.insert(request->operationContext.get(AcceptLanguageListContainer::NAME));
1056                       context.insert(request->operationContext.get(ContentLanguageListContainer::NAME));
1057 schuur   1.4  
1058                       // forward request
1059 schuur   1.17         CMPIProvider & pr=ph.GetProvider();
1060 schuur   1.4  
1061                       PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
1062                           "Calling provider.associators: " + pr.getName());
1063               
1064 schuur   1.7          DDD(cerr<<"--- CMPIProviderManager::associators"<<" role: >"<<request->role<<"< aCls "<<
1065 schuur   1.17         request->assocClass<<endl);
1066 schuur   1.4  
1067 schuur   1.17         CMPIStatus rc={CMPI_RC_OK,NULL};
1068 schuur   1.4          CMPI_ContextOnStack eCtx(context);
1069                       CMPI_ObjectPathOnStack eRef(objectPath);
1070 schuur   1.17         CMPI_ResultOnStack eRes(handler,&pr.broker);
1071 schuur   1.4          CMPI_ThreadContext thr(&pr.broker,&eCtx);
1072                       const CString aClass=request->assocClass.getString().getCString();
1073                       const CString rClass=request->resultClass.getString().getCString();
1074                       const CString rRole=request->role.getCString();
1075                       const CString resRole=request->resultRole.getCString();
1076               
1077 schuur   1.17         CMPIPropertyList props(request->propertyList);
1078 dj.gorey 1.25 
1079 schuur   1.4          CMPIFlags flgs=0;
1080                       if (request->includeQualifiers) flgs|=CMPI_FLAG_IncludeQualifiers;
1081                       if (request->includeClassOrigin) flgs|=CMPI_FLAG_IncludeClassOrigin;
1082                       eCtx.ft->addEntry(&eCtx,CMPIInvocationFlags,(CMPIValue*)&flgs,CMPI_uint32);
1083               
1084 schuur   1.39         if (remote) {
1085 schuur   1.40            CString info=pidc.getRemoteInfo().getCString();
1086 schuur   1.39            eCtx.ft->addEntry(&eCtx,"CMPIRRemoteInfo",(CMPIValue*)(const char*)info,CMPI_chars);
1087                       }
1088               
1089 schuur   1.4          CMPIProvider::pm_service_op_lock op_lock(&pr);
1090               
1091 dj.gorey 1.29 #ifdef PEGASUS_ZOS_THREADLEVEL_SECURITY
1092                               CIMAssociatorsRequestMessage * req = dynamic_cast<CIMAssociatorsRequestMessage *>(const_cast<Message *>(message));
1093                               int err_num=enablePThreadSecurity(req->userName);
1094                               if (err_num!=0)
1095                               {
1096                                       // need a new CIMException for this
1097                                       throw CIMException(CIM_ERR_ACCESS_DENIED,String(strerror(err_num)));
1098                               }
1099 marek    1.26 #endif
1100               
1101 schuur   1.4          STAT_GETSTARTTIME;
1102               
1103                       rc=pr.miVector.assocMI->ft->associators(
1104                                        pr.miVector.assocMI,&eCtx,&eRes,&eRef,CHARS(aClass),
1105 schuur   1.17                          CHARS(rClass),CHARS(rRole),CHARS(resRole),props.getList());
1106 schuur   1.4  
1107                       STAT_PMS_PROVIDEREND;
1108               
1109 marek    1.26 #ifdef PEGASUS_ZOS_THREADLEVEL_SECURITY
1110 dj.gorey 1.29                 disablePThreadSecurity(req->userName);
1111 marek    1.26 #endif
1112               
1113 schuur   1.4          if (rc.rc!=CMPI_RC_OK)
1114 dj.gorey 1.25            throw CIMException((CIMStatusCode)rc.rc,
1115                              rc.msg ? CMGetCharsPtr(rc.msg,NULL) : String::EMPTY);
1116 schuur   1.4      }
1117                   HandlerCatch(handler);
1118 dj.gorey 1.25 
1119 schuur   1.4      PEG_METHOD_EXIT();
1120               
1121                   return(response);
1122               }
1123               
1124 dj.gorey 1.29 Message * CMPIProviderManager::handleAssociatorNamesRequest(const Message * message)
1125 schuur   1.4  {
1126                   PEG_METHOD_ENTER(TRC_PROVIDERMANAGER,
1127                      "CMPIProviderManager::handleAssociatorNamesRequest");
1128               
1129                   HandlerIntro(AssociatorNames,message,request,response,
1130                                handler,Array<CIMObjectPath>());
1131                   try {
1132                       Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE,
1133                           "CMPIProviderManager::handleAssociatorNamesRequest - Host name: $0  Name space: $1  Class name: $2",
1134                           System::getHostName(),
1135                           request->nameSpace.getString(),
1136                           request->objectName.getClassName().getString());
1137               
1138                       // make target object path
1139                       CIMObjectPath objectPath(
1140                           System::getHostName(),
1141                           request->nameSpace,
1142                           request->objectName.getClassName());
1143               
1144                       objectPath.setKeyBindings(request->objectName.getKeyBindings());
1145               
1146 schuur   1.4          CIMObjectPath assocPath(
1147                           System::getHostName(),
1148                           request->nameSpace,
1149                           request->assocClass.getString());
1150 schuur   1.21 
1151 schuur   1.39         Boolean remote=false;
1152                       CMPIProvider::OpProviderHolder ph;
1153 schuur   1.40 
1154 schuur   1.4          // resolve provider name
1155 schuur   1.40         ProviderIdContainer pidc = request->operationContext.get(ProviderIdContainer::NAME);
1156                       ProviderName name = _resolveProviderName(pidc);
1157 schuur   1.4  
1158 schuur   1.40         if ((remote=pidc.isRemoteNameSpace())) {
1159 schuur   1.39            ph = providerManager.getRemoteProvider(name.getLocation(), name.getLogicalName());
1160                       }
1161                       else {
1162 schuur   1.4          // get cached or load new provider module
1163 schuur   1.39            ph = providerManager.getProvider(name.getPhysicalName(), name.getLogicalName());
1164                       }
1165 schuur   1.4  
1166                       // convert arguments
1167                       OperationContext context;
1168               
1169 schuur   1.40         context.insert(request->operationContext.get(IdentityContainer::NAME));
1170                       context.insert(request->operationContext.get(AcceptLanguageListContainer::NAME));
1171                       context.insert(request->operationContext.get(ContentLanguageListContainer::NAME));
1172 schuur   1.4  
1173                       // forward request
1174 dj.gorey 1.25         CMPIProvider & pr=ph.GetProvider();
1175 schuur   1.4  
1176                       PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
1177                           "Calling provider.associatorNames: " + pr.getName());
1178               
1179 schuur   1.7          DDD(cerr<<"--- CMPIProviderManager::associatorNames"<<" role: >"<<request->role<<"< aCls "<<
1180 dj.gorey 1.25            request->assocClass<<endl);
1181 schuur   1.4  
1182 dj.gorey 1.25         CMPIStatus rc={CMPI_RC_OK,NULL};
1183 schuur   1.4          CMPI_ContextOnStack eCtx(context);
1184                       CMPI_ObjectPathOnStack eRef(objectPath);
1185 dj.gorey 1.25         CMPI_ResultOnStack eRes(handler,&pr.broker);
1186 schuur   1.4          CMPI_ThreadContext thr(&pr.broker,&eCtx);
1187                       const CString aClass=request->assocClass.getString().getCString();
1188                       const CString rClass=request->resultClass.getString().getCString();
1189                       const CString rRole=request->role.getCString();
1190                       const CString resRole=request->resultRole.getCString();
1191               
1192                       CMPIFlags flgs=0;
1193                       eCtx.ft->addEntry(&eCtx,CMPIInvocationFlags,(CMPIValue*)&flgs,CMPI_uint32);
1194               
1195 schuur   1.39         if (remote) {
1196 schuur   1.40            CString info=pidc.getRemoteInfo().getCString();
1197 schuur   1.39            eCtx.ft->addEntry(&eCtx,"CMPIRRemoteInfo",(CMPIValue*)(const char*)info,CMPI_chars);
1198                       }
1199               
1200 schuur   1.4          CMPIProvider::pm_service_op_lock op_lock(&pr);
1201               
1202 dj.gorey 1.29 #ifdef PEGASUS_ZOS_THREADLEVEL_SECURITY
1203                               CIMAssociatorNamesRequestMessage * req = dynamic_cast<CIMAssociatorNamesRequestMessage *>(const_cast<Message *>(message));
1204                               int err_num=enablePThreadSecurity(req->userName);
1205                               if (err_num!=0)
1206                               {
1207                                       // need a new CIMException for this
1208                                       throw CIMException(CIM_ERR_ACCESS_DENIED,String(strerror(err_num)));
1209                               }
1210 marek    1.26 #endif
1211               
1212 schuur   1.4          STAT_GETSTARTTIME;
1213               
1214                       rc=pr.miVector.assocMI->ft->associatorNames(
1215                                        pr.miVector.assocMI,&eCtx,&eRes,&eRef,CHARS(aClass),
1216                                        CHARS(rClass),CHARS(rRole),CHARS(resRole));
1217               
1218                       STAT_PMS_PROVIDEREND;
1219               
1220 marek    1.26 #ifdef PEGASUS_ZOS_THREADLEVEL_SECURITY
1221 dj.gorey 1.29                 disablePThreadSecurity(req->userName);
1222 marek    1.26 #endif
1223               
1224 schuur   1.4          if (rc.rc!=CMPI_RC_OK)
1225 dj.gorey 1.25            throw CIMException((CIMStatusCode)rc.rc,
1226                              rc.msg ? CMGetCharsPtr(rc.msg,NULL) : String::EMPTY);
1227 schuur   1.4      }
1228                   HandlerCatch(handler);
1229 dj.gorey 1.25 
1230 schuur   1.4      PEG_METHOD_EXIT();
1231               
1232                   return(response);
1233               }
1234               
1235 dj.gorey 1.29 Message * CMPIProviderManager::handleReferencesRequest(const Message * message)
1236 schuur   1.4  {
1237                   PEG_METHOD_ENTER(TRC_PROVIDERMANAGER,
1238                      "CMPIProviderManager::handleReferencesRequest");
1239               
1240                   HandlerIntro(References,message,request,response,
1241                                handler,Array<CIMObject>());
1242                   try {
1243                       Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE,
1244 schuur   1.14             "CMPIProviderManager::handleReferencesRequest - Host name: $0  Name space: $1  Class name: $2",
1245 schuur   1.4              System::getHostName(),
1246                           request->nameSpace.getString(),
1247                           request->objectName.getClassName().getString());
1248               
1249                       // make target object path
1250                       CIMObjectPath objectPath(
1251                           System::getHostName(),
1252                           request->nameSpace,
1253                           request->objectName.getClassName());
1254               
1255                       objectPath.setKeyBindings(request->objectName.getKeyBindings());
1256               
1257                       CIMObjectPath resultPath(
1258                           System::getHostName(),
1259                           request->nameSpace,
1260                           request->resultClass.getString());
1261               
1262 schuur   1.39         Boolean remote=false;
1263                       CMPIProvider::OpProviderHolder ph;
1264 schuur   1.40 
1265 schuur   1.4          // resolve provider name
1266 schuur   1.40         ProviderIdContainer pidc = request->operationContext.get(ProviderIdContainer::NAME);
1267                       ProviderName name = _resolveProviderName(pidc);
1268 schuur   1.4  
1269 schuur   1.40         if ((remote=pidc.isRemoteNameSpace())) {
1270 schuur   1.39            ph = providerManager.getRemoteProvider(name.getLocation(), name.getLogicalName());
1271                       }
1272                       else {
1273 schuur   1.4          // get cached or load new provider module
1274 schuur   1.39            ph = providerManager.getProvider(name.getPhysicalName(), name.getLogicalName());
1275                       }
1276 schuur   1.4  
1277                       // convert arguments
1278                       OperationContext context;
1279               
1280 schuur   1.40         context.insert(request->operationContext.get(IdentityContainer::NAME));
1281                       context.insert(request->operationContext.get(AcceptLanguageListContainer::NAME));
1282                       context.insert(request->operationContext.get(ContentLanguageListContainer::NAME));
1283 schuur   1.4          // forward request
1284 schuur   1.17         CMPIProvider & pr=ph.GetProvider();
1285 schuur   1.4  
1286                       PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
1287                           "Calling provider.references: " + pr.getName());
1288               
1289 schuur   1.7          DDD(cerr<<"--- CMPIProviderManager::references"<<" role: >"<<request->role<<"< aCls "<<
1290 schuur   1.17         request->resultClass<<endl);
1291 schuur   1.4  
1292 schuur   1.17         CMPIStatus rc={CMPI_RC_OK,NULL};
1293 schuur   1.4          CMPI_ContextOnStack eCtx(context);
1294                       CMPI_ObjectPathOnStack eRef(objectPath);
1295 schuur   1.17         CMPI_ResultOnStack eRes(handler,&pr.broker);
1296 schuur   1.4          CMPI_ThreadContext thr(&pr.broker,&eCtx);
1297                       const CString rClass=request->resultClass.getString().getCString();
1298                       const CString rRole=request->role.getCString();
1299               
1300 schuur   1.17         CMPIPropertyList props(request->propertyList);
1301 dj.gorey 1.25 
1302 schuur   1.4          CMPIFlags flgs=0;
1303                       if (request->includeQualifiers) flgs|=CMPI_FLAG_IncludeQualifiers;
1304                       if (request->includeClassOrigin) flgs|=CMPI_FLAG_IncludeClassOrigin;
1305                       eCtx.ft->addEntry(&eCtx,CMPIInvocationFlags,(CMPIValue*)&flgs,CMPI_uint32);
1306               
1307 schuur   1.39         if (remote) {
1308 schuur   1.40            CString info=pidc.getRemoteInfo().getCString();
1309 schuur   1.39            eCtx.ft->addEntry(&eCtx,"CMPIRRemoteInfo",(CMPIValue*)(const char*)info,CMPI_chars);
1310                       }
1311               
1312 schuur   1.4          CMPIProvider::pm_service_op_lock op_lock(&pr);
1313               
1314 dj.gorey 1.29 #ifdef PEGASUS_ZOS_THREADLEVEL_SECURITY
1315                               CIMReferencesRequestMessage * req = dynamic_cast<CIMReferencesRequestMessage *>(const_cast<Message *>(message));
1316                               int err_num=enablePThreadSecurity(req->userName);
1317                               if (err_num!=0)
1318                               {
1319                                       // need a new CIMException for this
1320                                       throw CIMException(CIM_ERR_ACCESS_DENIED,String(strerror(err_num)));
1321                               }
1322 marek    1.26 #endif
1323               
1324 schuur   1.4          STAT_GETSTARTTIME;
1325               
1326                       rc=pr.miVector.assocMI->ft->references(
1327                                        pr.miVector.assocMI,&eCtx,&eRes,&eRef,
1328 schuur   1.17                          CHARS(rClass),CHARS(rRole),props.getList());
1329 schuur   1.4  
1330                       STAT_PMS_PROVIDEREND;
1331               
1332 marek    1.26 #ifdef PEGASUS_ZOS_THREADLEVEL_SECURITY
1333 dj.gorey 1.29                 disablePThreadSecurity(req->userName);
1334 marek    1.26 #endif
1335               
1336 schuur   1.4          if (rc.rc!=CMPI_RC_OK)
1337 schuur   1.23             throw CIMException((CIMStatusCode)rc.rc,
1338 dj.gorey 1.25                rc.msg ? CMGetCharsPtr(rc.msg,NULL) : String::EMPTY);
1339 schuur   1.4      }
1340                   HandlerCatch(handler);
1341 dj.gorey 1.25 
1342 schuur   1.4      PEG_METHOD_EXIT();
1343               
1344                   return(response);
1345               }
1346               
1347 dj.gorey 1.29 Message * CMPIProviderManager::handleReferenceNamesRequest(const Message * message)
1348 schuur   1.4  {
1349                   PEG_METHOD_ENTER(TRC_PROVIDERMANAGER,
1350                       "CMPIProviderManager::handleReferenceNamesRequest");
1351               
1352                   HandlerIntro(ReferenceNames,message,request,response,
1353                                handler,Array<CIMObjectPath>());
1354                   try {
1355                       Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE,
1356                           "CMPIProviderManager::handleReferenceNamesRequest - Host name: $0  Name space: $1  Class name: $2",
1357                           System::getHostName(),
1358                           request->nameSpace.getString(),
1359                           request->objectName.getClassName().getString());
1360               
1361                       // make target object path
1362                       CIMObjectPath objectPath(
1363                           System::getHostName(),
1364                           request->nameSpace,
1365                           request->objectName.getClassName());
1366               
1367                       objectPath.setKeyBindings(request->objectName.getKeyBindings());
1368               
1369 schuur   1.4          CIMObjectPath resultPath(
1370                           System::getHostName(),
1371                           request->nameSpace,
1372                           request->resultClass.getString());
1373               
1374 schuur   1.39         Boolean remote=false;
1375                       CMPIProvider::OpProviderHolder ph;
1376 schuur   1.40 
1377 schuur   1.4          // resolve provider name
1378 schuur   1.40         ProviderIdContainer pidc = request->operationContext.get(ProviderIdContainer::NAME);
1379                       ProviderName name = _resolveProviderName(pidc);
1380 schuur   1.4  
1381 schuur   1.40         if ((remote=pidc.isRemoteNameSpace())) {
1382 schuur   1.39            ph = providerManager.getRemoteProvider(name.getLocation(), name.getLogicalName());
1383                       }
1384                       else {
1385 schuur   1.4          // get cached or load new provider module
1386 schuur   1.39            ph = providerManager.getProvider(name.getPhysicalName(), name.getLogicalName());
1387                       }
1388 schuur   1.4  
1389                       // convert arguments
1390                       OperationContext context;
1391               
1392 se.gupta 1.37 		context.insert(request->operationContext.get(IdentityContainer::NAME));
1393 schuur   1.40 		context.insert(request->operationContext.get(AcceptLanguageListContainer::NAME));
1394               	    context.insert(request->operationContext.get(ContentLanguageListContainer::NAME));
1395 dj.gorey 1.25         CMPIProvider & pr=ph.GetProvider();
1396 schuur   1.4  
1397                       PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
1398                           "Calling provider.referenceNames: " + pr.getName());
1399               
1400 schuur   1.7          DDD(cerr<<"--- CMPIProviderManager::referenceNames"<<" role: >"<<request->role<<"< aCls "<<
1401 dj.gorey 1.25            request->resultClass<<endl);
1402 schuur   1.4  
1403 dj.gorey 1.25         CMPIStatus rc={CMPI_RC_OK,NULL};
1404 schuur   1.4          CMPI_ContextOnStack eCtx(context);
1405                       CMPI_ObjectPathOnStack eRef(objectPath);
1406 dj.gorey 1.25         CMPI_ResultOnStack eRes(handler,&pr.broker);
1407 schuur   1.4          CMPI_ThreadContext thr(&pr.broker,&eCtx);
1408                       const CString rClass=request->resultClass.getString().getCString();
1409                       const CString rRole=request->role.getCString();
1410               
1411                       CMPIFlags flgs=0;
1412                       eCtx.ft->addEntry(&eCtx,CMPIInvocationFlags,(CMPIValue*)&flgs,CMPI_uint32);
1413               
1414 schuur   1.39         if (remote) {
1415 schuur   1.40            CString info=pidc.getRemoteInfo().getCString();
1416 schuur   1.39            eCtx.ft->addEntry(&eCtx,"CMPIRRemoteInfo",(CMPIValue*)(const char*)info,CMPI_chars);
1417                       }
1418               
1419 schuur   1.4          CMPIProvider::pm_service_op_lock op_lock(&pr);
1420               
1421 dj.gorey 1.29 #ifdef PEGASUS_ZOS_THREADLEVEL_SECURITY
1422                               CIMReferenceNamesRequestMessage * req = dynamic_cast<CIMReferenceNamesRequestMessage *>(const_cast<Message *>(message));
1423                               int err_num=enablePThreadSecurity(req->userName);
1424                               if (err_num!=0)
1425                               {
1426                                       // need a new CIMException for this
1427                                       throw CIMException(CIM_ERR_ACCESS_DENIED,String(strerror(err_num)));
1428                               }
1429 marek    1.26 #endif
1430               
1431 schuur   1.4          STAT_GETSTARTTIME;
1432               
1433                       rc=pr.miVector.assocMI->ft->referenceNames(
1434                                        pr.miVector.assocMI,&eCtx,&eRes,&eRef,
1435                                        CHARS(rClass),CHARS(rRole));
1436               
1437                       STAT_PMS_PROVIDEREND;
1438               
1439 marek    1.26 #ifdef PEGASUS_ZOS_THREADLEVEL_SECURITY
1440 dj.gorey 1.29                 disablePThreadSecurity(req->userName);
1441 marek    1.26 #endif
1442               
1443 schuur   1.4          if (rc.rc!=CMPI_RC_OK)
1444 dj.gorey 1.25            throw CIMException((CIMStatusCode)rc.rc,
1445                              rc.msg ? CMGetCharsPtr(rc.msg,NULL) : String::EMPTY);
1446 schuur   1.4      }
1447                   HandlerCatch(handler);
1448 dj.gorey 1.25 
1449 schuur   1.4      PEG_METHOD_EXIT();
1450               
1451                   return(response);
1452               }
1453               
1454 dj.gorey 1.29 Message * CMPIProviderManager::handleInvokeMethodRequest(const Message * message)
1455 schuur   1.4  {
1456                   PEG_METHOD_ENTER(TRC_PROVIDERMANAGER,
1457                       "CMPIProviderManager::handleInvokeMethodRequest");
1458               
1459                   HandlerIntroMethod(InvokeMethod,message,request,response,
1460                                handler);
1461                   try {
1462                       Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE,
1463                           "CMPIProviderManager::handleInvokeMethodRequest - Host name: $0  Name space: $1  Class name: $2",
1464                           System::getHostName(),
1465                           request->nameSpace.getString(),
1466                           request->instanceName.getClassName().getString());
1467               
1468                       // make target object path
1469                       CIMObjectPath objectPath(
1470                           System::getHostName(),
1471                           request->nameSpace,
1472                           request->instanceName.getClassName(),
1473                           request->instanceName.getKeyBindings());
1474               
1475 schuur   1.39         Boolean remote=false;
1476                       CMPIProvider::OpProviderHolder ph;
1477 schuur   1.40 
1478 schuur   1.4          // resolve provider name
1479 schuur   1.40         ProviderIdContainer pidc = request->operationContext.get(ProviderIdContainer::NAME);
1480                       ProviderName name = _resolveProviderName(pidc);
1481 schuur   1.4  
1482 schuur   1.40         if ((remote=pidc.isRemoteNameSpace())) {
1483 schuur   1.39            ph = providerManager.getRemoteProvider(name.getLocation(), name.getLogicalName());
1484                       }
1485                       else {
1486 schuur   1.4          // get cached or load new provider module
1487 schuur   1.39            ph = providerManager.getProvider(name.getPhysicalName(), name.getLogicalName());
1488                       }
1489 schuur   1.4  
1490                       // convert arguments
1491                       OperationContext context;
1492               
1493 schuur   1.40         context.insert(request->operationContext.get(IdentityContainer::NAME));
1494                       context.insert(request->operationContext.get(AcceptLanguageListContainer::NAME));
1495                       context.insert(request->operationContext.get(ContentLanguageListContainer::NAME));
1496 schuur   1.4  
1497                       CIMObjectPath instanceReference(request->instanceName);
1498               
1499                       // ATTN: propagate namespace
1500                       instanceReference.setNameSpace(request->nameSpace);
1501               
1502                       // forward request
1503 dj.gorey 1.25         CMPIProvider & pr=ph.GetProvider();
1504 schuur   1.4  
1505                       PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
1506                           "Calling provider.invokeMethod: " + pr.getName());
1507               
1508 dj.gorey 1.25         CMPIStatus rc={CMPI_RC_OK,NULL};
1509 schuur   1.4          CMPI_ContextOnStack eCtx(context);
1510                       CMPI_ObjectPathOnStack eRef(objectPath);
1511                       CMPI_ResultOnStack eRes(handler,&pr.broker);
1512                       CMPI_ThreadContext thr(&pr.broker,&eCtx);
1513                       CMPI_ArgsOnStack eArgsIn(request->inParameters);
1514                       Array<CIMParamValue> outArgs;
1515                       CMPI_ArgsOnStack eArgsOut(outArgs);
1516                       CString mName=request->methodName.getString().getCString();
1517               
1518                       CMPIFlags flgs=0;
1519                       eCtx.ft->addEntry(&eCtx,CMPIInvocationFlags,(CMPIValue*)&flgs,CMPI_uint32);
1520               
1521 schuur   1.39         if (remote) {
1522 schuur   1.40            CString info=pidc.getRemoteInfo().getCString();
1523 schuur   1.39            eCtx.ft->addEntry(&eCtx,"CMPIRRemoteInfo",(CMPIValue*)(const char*)info,CMPI_chars);
1524                       }
1525               
1526 schuur   1.4          CMPIProvider::pm_service_op_lock op_lock(&pr);
1527               
1528 dj.gorey 1.29 #ifdef PEGASUS_ZOS_THREADLEVEL_SECURITY
1529                               CIMInvokeMethodRequestMessage * req = dynamic_cast<CIMInvokeMethodRequestMessage *>(const_cast<Message *>(message));
1530                               int err_num=enablePThreadSecurity(req->userName);
1531                               if (err_num!=0)
1532                               {
1533                                       // need a new CIMException for this
1534                                       throw CIMException(CIM_ERR_ACCESS_DENIED,String(strerror(err_num)));
1535                               }
1536 marek    1.26 #endif
1537 schuur   1.4          STAT_GETSTARTTIME;
1538               
1539                       rc=pr.miVector.methMI->ft->invokeMethod(
1540                          pr.miVector.methMI,&eCtx,&eRes,&eRef,CHARS(mName),&eArgsIn,&eArgsOut);
1541               
1542                       STAT_PMS_PROVIDEREND;
1543               
1544 marek    1.26 #ifdef PEGASUS_ZOS_THREADLEVEL_SECURITY
1545 dj.gorey 1.29                 disablePThreadSecurity(req->userName);
1546 marek    1.26 #endif
1547               
1548 schuur   1.4          if (rc.rc!=CMPI_RC_OK)
1549 dj.gorey 1.25            throw CIMException((CIMStatusCode)rc.rc,
1550                              rc.msg ? CMGetCharsPtr(rc.msg,NULL) : String::EMPTY);
1551 schuur   1.4  
1552                      for (int i=0,s=outArgs.size(); i<s; i++)
1553                          handler.deliverParamValue(outArgs[i]);
1554                      handler.complete();
1555                   }
1556                   HandlerCatch(handler);
1557 dj.gorey 1.25 
1558 schuur   1.4      PEG_METHOD_EXIT();
1559               
1560 dj.gorey 1.25     return(response);
1561 schuur   1.4  }
1562 schuur   1.18 
1563 schuur   1.4  int LocateIndicationProviderNames(const CIMInstance& pInstance, const CIMInstance& pmInstance,
1564                                                 String& providerName, String& location)
1565               {
1566                   Uint32 pos = pInstance.findProperty(CIMName ("Name"));
1567                   pInstance.getProperty(pos).getValue().get(providerName);
1568               
1569                   pos = pmInstance.findProperty(CIMName ("Location"));
1570 dj.gorey 1.25     pmInstance.getProperty(pos).getValue().get(location);
1571 schuur   1.4      return 0;
1572               }
1573               
1574 dj.gorey 1.29 Message * CMPIProviderManager::handleCreateSubscriptionRequest(const Message * message)
1575 schuur   1.4  {
1576 schuur   1.14     PEG_METHOD_ENTER(TRC_PROVIDERMANAGER, "CMPIProviderManager::handleCreateSubscriptionRequest");
1577 schuur   1.4  
1578                   HandlerIntroInd(CreateSubscription,message,request,response,
1579                                handler);
1580                   try {
1581                       const CIMObjectPath &x=request->subscriptionInstance.getPath();
1582 schuur   1.40         CIMInstance req_provider, req_providerModule;
1583                       ProviderIdContainer pidc = (ProviderIdContainer)request->operationContext.get(ProviderIdContainer::NAME);
1584                       req_provider = pidc.getProvider();
1585                       req_providerModule = pidc.getModule();
1586 se.gupta 1.36 
1587 schuur   1.17         String providerName,providerLocation;
1588 se.gupta 1.36         LocateIndicationProviderNames(req_provider, req_providerModule,
1589 schuur   1.17         providerName,providerLocation);
1590 schuur   1.4  
1591                       Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE,
1592                           "CMPIProviderManager::handleCreateSubscriptionRequest - Host name: $0  Name space: $1  Provider name(s): $2",
1593                           System::getHostName(),
1594                           request->nameSpace.getString(),
1595                           providerName);
1596               
1597 schuur   1.39         Boolean remote=false;
1598                       CMPIProvider::OpProviderHolder ph;
1599 schuur   1.40 
1600 schuur   1.15         String fileName = _resolvePhysicalName(providerLocation);
1601 schuur   1.4  
1602 schuur   1.40         if ((remote=pidc.isRemoteNameSpace())) {
1603 schuur   1.39            ph = providerManager.getProvider("CMPIRProxyProvider", providerName);
1604                       }
1605                       else {
1606 schuur   1.4          // get cached or load new provider module
1607 schuur   1.39            ph = providerManager.getProvider(fileName, providerName);
1608                       }
1609 schuur   1.4  
1610                       indProvRecord *prec=NULL;
1611 schuur   1.17         provTab.lookup(providerName,prec);
1612                       if (prec) prec->count++;
1613 schuur   1.4          else {
1614 schuur   1.17            prec=new indProvRecord();
1615                          provTab.insert(providerName,prec);
1616                       }
1617 schuur   1.4  
1618                       indSelectRecord *srec=new indSelectRecord();
1619                       const CIMObjectPath &sPath=request->subscriptionInstance.getPath();
1620 schuur   1.17         selxTab.insert(sPath.toString(),srec);
1621 schuur   1.4  
1622                       // convert arguments
1623                       OperationContext *context=new OperationContext();
1624 schuur   1.40         context->insert(request->operationContext.get(IdentityContainer::NAME));
1625                       context->insert(request->operationContext.get(AcceptLanguageListContainer::NAME));
1626                       context->insert(request->operationContext.get(ContentLanguageListContainer::NAME));
1627                       context->insert(request->operationContext.get(SubscriptionInstanceContainer::NAME));
1628                       context->insert(request->operationContext.get(SubscriptionLanguageListContainer::NAME));
1629                       context->insert(request->operationContext.get(SubscriptionFilterConditionContainer::NAME));
1630 schuur   1.4  
1631 schuur   1.40         CIMObjectPath subscriptionName = request->subscriptionInstance.getPath();
1632 schuur   1.4  
1633 schuur   1.17         CMPIProvider & pr=ph.GetProvider();
1634 schuur   1.4  
1635 schuur   1.17         CMPIStatus rc={CMPI_RC_OK,NULL};
1636 schuur   1.4          CMPI_ContextOnStack eCtx(*context);
1637 se.gupta 1.43         
1638               		SubscriptionFilterConditionContainer sub_cntr =  request->operationContext.get
1639               								(SubscriptionFilterConditionContainer::NAME);
1640               
1641               		CMPI_SelectExp *eSelx=new CMPI_SelectExp(*context,
1642 kumpf    1.33         request->query,
1643 se.gupta 1.43         sub_cntr.getQueryLanguage());
1644 schuur   1.17         srec->eSelx=eSelx;
1645 schuur   1.4          CMPI_ThreadContext thr(&pr.broker,&eCtx);
1646               
1647                       PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
1648                           "Calling provider.createSubscriptionRequest: " + pr.getName());
1649               
1650 schuur   1.7          DDD(cerr<<"--- CMPIProviderManager::createSubscriptionRequest"<<endl);
1651 schuur   1.4  
1652                       for(Uint32 i = 0, n = request->classNames.size(); i < n; i++) {
1653                           CIMObjectPath className(
1654                               System::getHostName(),
1655                               request->nameSpace,
1656                               request->classNames[i]);
1657                           eSelx->classNames.append(className);
1658                       }
1659                       CMPI_ObjectPathOnStack eRef(eSelx->classNames[0]);
1660               
1661                       CIMPropertyList propertyList = request->propertyList;
1662 schuur   1.17         if (!propertyList.isNull()) {
1663 schuur   1.4             Array<CIMName> p=propertyList.getPropertyNameArray();
1664                          int pCount=p.size();
1665                          eSelx->props=(const char**)malloc((1+pCount)*sizeof(char*));
1666                          for (int i=0; i<pCount; i++) {
1667                             eSelx->props[i]=strdup(p[i].getString().getCString());
1668 schuur   1.17            }
1669 schuur   1.4             eSelx->props[pCount]=NULL;
1670                       }
1671               
1672                       Uint16 repeatNotificationPolicy = request->repeatNotificationPolicy;
1673               
1674 schuur   1.39         if (remote) {
1675 schuur   1.40            CString info=pidc.getRemoteInfo().getCString();
1676 schuur   1.39            eCtx.ft->addEntry(&eCtx,"CMPIRRemoteInfo",(CMPIValue*)(const char*)info,CMPI_chars);
1677                       }
1678               
1679 schuur   1.4          CMPIProvider::pm_service_op_lock op_lock(&pr);
1680               
1681 dj.gorey 1.29 #ifdef PEGASUS_ZOS_THREADLEVEL_SECURITY
1682                               CIMCreateSubscriptionRequestMessage * req = dynamic_cast<CIMCreateSubscriptionRequestMessage *>(const_cast<Message *>(message));
1683                               int err_num=enablePThreadSecurity(req->userName);
1684                               if (err_num!=0)
1685                               {
1686                                       // need a new CIMException for this
1687                                       throw CIMException(CIM_ERR_ACCESS_DENIED,String(strerror(err_num)));
1688                               }
1689 marek    1.26 #endif
1690 schuur   1.4          STAT_GETSTARTTIME;
1691               
1692                       rc=pr.miVector.indMI->ft->activateFilter(
1693                          pr.miVector.indMI,&eCtx,NULL,eSelx,
1694 schuur   1.22            CHARS(eSelx->classNames[0].getClassName().getString().getCString()),
1695 dj.gorey 1.25            &eRef,false);
1696 schuur   1.4  
1697                      STAT_PMS_PROVIDEREND;
1698               
1699 marek    1.26 #ifdef PEGASUS_ZOS_THREADLEVEL_SECURITY
1700 dj.gorey 1.29                 disablePThreadSecurity(req->userName);
1701 marek    1.26 #endif
1702               
1703 schuur   1.4          if (rc.rc!=CMPI_RC_OK)
1704 schuur   1.23            throw CIMException((CIMStatusCode)rc.rc,
1705 dj.gorey 1.25                rc.msg ? CMGetCharsPtr(rc.msg,NULL) : String::EMPTY);
1706 schuur   1.4      }
1707                   HandlerCatch(handler);
1708 dj.gorey 1.25 
1709 schuur   1.4      PEG_METHOD_EXIT();
1710               
1711                   return(response);
1712               }
1713               
1714 dj.gorey 1.29 Message * CMPIProviderManager::handleDeleteSubscriptionRequest(const Message * message)
1715 schuur   1.4  {
1716                   PEG_METHOD_ENTER(TRC_PROVIDERMANAGER, "CMPIProviderManager::handleDeleteSubscriptionRequest");
1717               
1718                   HandlerIntroInd(DeleteSubscription,message,request,response,
1719                                handler);
1720                   try {
1721 dj.gorey 1.25         String providerName,providerLocation;
1722 se.gupta 1.36 
1723 schuur   1.40         CIMInstance req_provider, req_providerModule;
1724                       ProviderIdContainer pidc = (ProviderIdContainer)request->operationContext.get(ProviderIdContainer::NAME);
1725                       req_provider = pidc.getProvider();
1726                       req_providerModule = pidc.getModule();
1727 se.gupta 1.36 
1728                       LocateIndicationProviderNames(req_provider, req_providerModule,
1729 dj.gorey 1.25            providerName,providerLocation);
1730 schuur   1.4  
1731                       Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE,
1732                           "CMPIProviderManager::handleDeleteSubscriptionRequest - Host name: $0  Name space: $1  Provider name(s): $2",
1733                           System::getHostName(),
1734                           request->nameSpace.getString(),
1735                           providerName);
1736               
1737 schuur   1.39         Boolean remote=false;
1738                       CMPIProvider::OpProviderHolder ph;
1739 schuur   1.40 
1740 schuur   1.15         String fileName = _resolvePhysicalName(providerLocation);
1741 schuur   1.4  
1742 schuur   1.40         if ((remote=pidc.isRemoteNameSpace())) {
1743 schuur   1.39            ph = providerManager.getProvider("CMPIRProxyProvider", providerName);
1744                       }
1745                       else {
1746 schuur   1.4          // get cached or load new provider module
1747 schuur   1.39            ph = providerManager.getProvider(fileName, providerName);
1748                       }
1749 schuur   1.4  
1750               
1751                       indProvRecord *prec=NULL;
1752 dj.gorey 1.25         provTab.lookup(providerName,prec);
1753                       if (--prec->count<=0) {
1754                          provTab.remove(providerName);
1755                          prec=NULL;
1756                       }
1757 schuur   1.4  
1758                       indSelectRecord *srec=NULL;
1759                       const CIMObjectPath &sPath=request->subscriptionInstance.getPath();
1760 dj.gorey 1.25         String sPathString=sPath.toString();
1761                       selxTab.lookup(sPathString,srec);
1762 schuur   1.4  
1763                       CMPI_SelectExp *eSelx=srec->eSelx;
1764                       CMPI_ObjectPathOnStack eRef(eSelx->classNames[0]);
1765 dj.gorey 1.25         selxTab.remove(sPathString);
1766 schuur   1.4  
1767 dj.gorey 1.25         // convert arguments
1768 schuur   1.4          OperationContext context;
1769 schuur   1.40         context.insert(request->operationContext.get(IdentityContainer::NAME));
1770                       context.insert(request->operationContext.get(AcceptLanguageListContainer::NAME));
1771                       context.insert(request->operationContext.get(ContentLanguageListContainer::NAME));
1772                       context.insert(request->operationContext.get(SubscriptionInstanceContainer::NAME));
1773                       context.insert(request->operationContext.get(SubscriptionLanguageListContainer::NAME));
1774 schuur   1.4  
1775                       CIMObjectPath subscriptionName = request->subscriptionInstance.getPath();
1776               
1777 dj.gorey 1.25         CMPIProvider & pr=ph.GetProvider();
1778 schuur   1.4  
1779 dj.gorey 1.25         CMPIStatus rc={CMPI_RC_OK,NULL};
1780 schuur   1.4          CMPI_ContextOnStack eCtx(context);
1781                       CMPI_ThreadContext thr(&pr.broker,&eCtx);
1782               
1783                       PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
1784                           "Calling provider.deleteSubscriptionRequest: " + pr.getName());
1785               
1786 schuur   1.7          DDD(cerr<<"--- CMPIProviderManager::deleteSubscriptionRequest"<<endl);
1787 schuur   1.4  
1788 schuur   1.39         if (remote) {
1789 schuur   1.40            CString info=pidc.getRemoteInfo().getCString();
1790 schuur   1.39            eCtx.ft->addEntry(&eCtx,"CMPIRRemoteInfo",(CMPIValue*)(const char*)info,CMPI_chars);
1791                       }
1792               
1793 schuur   1.4          CMPIProvider::pm_service_op_lock op_lock(&pr);
1794               
1795 dj.gorey 1.29 #ifdef PEGASUS_ZOS_THREADLEVEL_SECURITY
1796                               CIMDeleteSubscriptionRequestMessage * req = dynamic_cast<CIMDeleteSubscriptionRequestMessage *>(const_cast<Message *>(message));
1797                               int err_num=enablePThreadSecurity(req->userName);
1798                               if (err_num!=0)
1799                               {
1800                                       // need a new CIMException for this
1801                                       throw CIMException(CIM_ERR_ACCESS_DENIED,String(strerror(err_num)));
1802                               }
1803 marek    1.26 #endif
1804 schuur   1.4          STAT_GETSTARTTIME;
1805                       rc=pr.miVector.indMI->ft->deActivateFilter(
1806                          pr.miVector.indMI,&eCtx,NULL,eSelx,
1807 schuur   1.22            CHARS(eSelx->classNames[0].getClassName().getString().getCString()),
1808 dj.gorey 1.25            &eRef,prec==NULL);
1809 schuur   1.4  
1810                      delete eSelx;
1811               
1812                      STAT_PMS_PROVIDEREND;
1813 marek    1.26 
1814               #ifdef PEGASUS_ZOS_THREADLEVEL_SECURITY
1815 dj.gorey 1.29                 disablePThreadSecurity(req->userName);
1816 marek    1.26 #endif
1817 schuur   1.4  
1818                       if (rc.rc!=CMPI_RC_OK)
1819 dj.gorey 1.25            throw CIMException((CIMStatusCode)rc.rc,
1820                              rc.msg ? CMGetCharsPtr(rc.msg,NULL) : String::EMPTY);
1821 schuur   1.4      }
1822                   HandlerCatch(handler);
1823 dj.gorey 1.25 
1824 schuur   1.4      PEG_METHOD_EXIT();
1825               
1826                   return(response);
1827               }
1828               
1829 dj.gorey 1.29 Message * CMPIProviderManager::handleEnableIndicationsRequest(const Message * message)
1830 schuur   1.4  {
1831                   PEG_METHOD_ENTER(TRC_PROVIDERMANAGER, "CMPIProviderManager:: handleEnableIndicationsRequest");
1832               
1833                   HandlerIntroInd(EnableIndications,message,request,response,
1834                                handler);
1835                   try {
1836                       String providerName,providerLocation;
1837 se.gupta 1.36 		CIMInstance req_provider, req_providerModule;
1838 se.gupta 1.37 		ProviderIdContainer pidc = (ProviderIdContainer)request->operationContext.get(ProviderIdContainer::NAME);
1839               		req_provider = pidc.getProvider();
1840               		req_providerModule = pidc.getModule();
1841 se.gupta 1.36 
1842                       LocateIndicationProviderNames(req_provider, req_providerModule,
1843 dj.gorey 1.25            providerName,providerLocation);
1844 schuur   1.4  
1845                       indProvRecord *provRec;
1846                       if (provTab.lookup(providerName,provRec)) {
1847                          provRec->enabled=true;
1848 se.gupta 1.41 		   ProviderIdContainer pidc = request->operationContext.get(ProviderIdContainer::NAME);
1849 kumpf    1.31            provRec->handler=new EnableIndicationsResponseHandler(
1850 se.gupta 1.41                request, response, req_provider, _indicationCallback); 
1851 schuur   1.4          }
1852               
1853 schuur   1.39         Boolean remote=false;
1854                       CMPIProvider::OpProviderHolder ph;
1855 schuur   1.40 
1856 schuur   1.15         String fileName = _resolvePhysicalName(providerLocation);
1857 schuur   1.4  
1858 schuur   1.39 /*        if ((remote=_repository->isRemoteNameSpace(request->nameSpace,remoteInfo))) {
1859                          ph = providerManager.getProvider("CMPIRProxyProvider", providerName);
1860                       }
1861                       else {
1862 schuur   1.4          // get cached or load new provider module
1863 schuur   1.39            ph = providerManager.getProvider(fileName, providerName);
1864                       } */
1865                       ph = providerManager.getProvider(fileName, providerName);
1866 schuur   1.4  
1867                       // convert arguments
1868                       OperationContext context;
1869               
1870 schuur   1.40         context.insert(request->operationContext.get(AcceptLanguageListContainer::NAME));
1871                       context.insert(request->operationContext.get(ContentLanguageListContainer::NAME));
1872 schuur   1.4  
1873 dj.gorey 1.25         CMPIProvider & pr=ph.GetProvider();
1874 schuur   1.4  
1875 dj.gorey 1.25         CMPIStatus rc={CMPI_RC_OK,NULL};
1876 schuur   1.4          CMPI_ContextOnStack eCtx(context);
1877                       CMPI_ThreadContext thr(&pr.broker,&eCtx);
1878               
1879                       PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
1880                           "Calling provider.EnableIndicationRequest: " + pr.getName());
1881               
1882 schuur   1.7          DDD(cerr<<"--- CMPIProviderManager::enableIndicationRequest"<<endl);
1883 schuur   1.4  
1884                       CMPIProvider::pm_service_op_lock op_lock(&pr);
1885 schuur   1.27         ph.GetProvider().protect();
1886 schuur   1.4  
1887                       STAT_GETSTARTTIME;
1888               
1889                       pr.miVector.indMI->ft->enableIndications(
1890                          pr.miVector.indMI);
1891               
1892                      STAT_PMS_PROVIDEREND;
1893                   }
1894                   HandlerCatch(handler);
1895 dj.gorey 1.25 
1896 schuur   1.4      PEG_METHOD_EXIT();
1897               
1898                   return(response);
1899               }
1900               
1901 dj.gorey 1.29 Message * CMPIProviderManager::handleDisableIndicationsRequest(const Message * message)
1902 schuur   1.4  {
1903                   PEG_METHOD_ENTER(TRC_PROVIDERMANAGER, "CMPIProviderManager:: handleDisableIndicationsRequest");
1904               
1905                   HandlerIntroInd(DisableIndications,message,request,response,
1906                                handler);
1907                   try {
1908                       String providerName,providerLocation;
1909 schuur   1.40         CIMInstance req_provider, req_providerModule;
1910                       ProviderIdContainer pidc = (ProviderIdContainer)request->operationContext.get(ProviderIdContainer::NAME);
1911                       req_provider = pidc.getProvider();
1912                       req_providerModule = pidc.getModule();
1913 se.gupta 1.36 
1914                       LocateIndicationProviderNames(req_provider, req_providerModule ,
1915 dj.gorey 1.25            providerName,providerLocation);
1916 schuur   1.4  
1917                       indProvRecord *provRec;
1918                       if (provTab.lookup(providerName,provRec)) {
1919                          provRec->enabled=false;
1920                          if (provRec->handler) delete provRec->handler;
1921 dj.gorey 1.25            provRec->handler=NULL;
1922 schuur   1.4          }
1923               
1924 schuur   1.39         Boolean remote=false;
1925                       CMPIProvider::OpProviderHolder ph;
1926 schuur   1.40 
1927 schuur   1.15         String fileName = _resolvePhysicalName(providerLocation);
1928 schuur   1.4  
1929 schuur   1.39 /*        if ((remote=_repository->isRemoteNameSpace(request->nameSpace,remoteInfo))) {
1930                          ph = providerManager.getProvider("CMPIRProxyProvider", providerName);
1931                       }
1932                       else {
1933 schuur   1.4          // get cached or load new provider module
1934 schuur   1.39            ph = providerManager.getProvider(fileName, providerName);
1935                       } */
1936                       ph = providerManager.getProvider(fileName, providerName);
1937 schuur   1.4  
1938                       // convert arguments
1939                       OperationContext context;
1940               
1941 schuur   1.40 		context.insert(request->operationContext.get(AcceptLanguageListContainer::NAME));
1942               	    context.insert(request->operationContext.get(ContentLanguageListContainer::NAME));
1943 se.gupta 1.37 
1944 dj.gorey 1.25         CMPIProvider & pr=ph.GetProvider();
1945 schuur   1.4  
1946 dj.gorey 1.25         CMPIStatus rc={CMPI_RC_OK,NULL};
1947 schuur   1.4          CMPI_ContextOnStack eCtx(context);
1948                       CMPI_ThreadContext thr(&pr.broker,&eCtx);
1949               
1950                       PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
1951                           "Calling provider.DisableIndicationRequest: " + pr.getName());
1952               
1953 schuur   1.7          DDD(cerr<<"--- CMPIProviderManager::disableIndicationRequest"<<endl);
1954 schuur   1.4  
1955                       CMPIProvider::pm_service_op_lock op_lock(&pr);
1956               
1957                       STAT_GETSTARTTIME;
1958               
1959                       pr.miVector.indMI->ft->disableIndications(
1960                          pr.miVector.indMI);
1961               
1962 schuur   1.27         ph.GetProvider().unprotect();
1963               
1964                       STAT_PMS_PROVIDEREND;
1965 schuur   1.4      }
1966                   HandlerCatch(handler);
1967 dj.gorey 1.25 
1968 schuur   1.4      PEG_METHOD_EXIT();
1969               
1970                   return(response);
1971               }
1972               
1973 dj.gorey 1.29 Message * CMPIProviderManager::handleDisableModuleRequest(const Message * message)
1974 schuur   1.4  {
1975                   PEG_METHOD_ENTER(TRC_PROVIDERMANAGER, "CMPIProviderManager::handleDisableModuleRequest");
1976               
1977                   CIMDisableModuleRequestMessage * request =
1978                       dynamic_cast<CIMDisableModuleRequestMessage *>(const_cast<Message *>(message));
1979               
1980                   PEGASUS_ASSERT(request != 0);
1981               
1982                   // get provider module name
1983                   String moduleName;
1984                   CIMInstance mInstance = request->providerModule;
1985                   Uint32 pos = mInstance.findProperty(CIMName ("Name"));
1986               
1987                   if(pos != PEG_NOT_FOUND)
1988                   {
1989                       mInstance.getProperty(pos).getValue().get(moduleName);
1990                   }
1991               
1992                   Boolean disableProviderOnly = request->disableProviderOnly;
1993               
1994                   Array<Uint16> operationalStatus;
1995 kumpf    1.30     // Assume success.
1996 kumpf    1.42     operationalStatus.append(CIM_MSE_OPSTATUS_VALUE_STOPPED);
1997 schuur   1.4  
1998 kumpf    1.30     //
1999 schuur   1.4      // Unload providers
2000 kumpf    1.30     //
2001 schuur   1.4      Array<CIMInstance> _pInstances = request->providers;
2002 schuur   1.16     String physicalName=_resolvePhysicalName(request->providerModule.getProperty(
2003 dj.gorey 1.25               request->providerModule.findProperty("Location")).getValue().toString());
2004 schuur   1.4  
2005                   for(Uint32 i = 0, n = _pInstances.size(); i < n; i++)
2006                   {
2007 schuur   1.16         providerManager.unloadProvider(_pInstances[i].getProperty(
2008 dj.gorey 1.25                                           request->providerModule.findProperty
2009 schuur   1.16                                           ("Name")).getValue ().toString (),
2010                                                      physicalName);
2011 schuur   1.4      }
2012               
2013                   CIMDisableModuleResponseMessage * response =
2014                       new CIMDisableModuleResponseMessage(
2015                       request->messageId,
2016                       CIMException(),
2017                       request->queueIds.copyAndPop(),
2018                       operationalStatus);
2019               
2020                   PEGASUS_ASSERT(response != 0);
2021               
2022                   // preserve message key
2023                   response->setKey(request->getKey());
2024               
2025                   //
2026                   //  Set HTTP method in response from request
2027                   //
2028                   response->setHttpMethod (request->getHttpMethod ());
2029               
2030                   PEG_METHOD_EXIT();
2031               
2032 schuur   1.4      return(response);
2033               }
2034               
2035 dj.gorey 1.29 Message * CMPIProviderManager::handleEnableModuleRequest(const Message * message)
2036 schuur   1.4  {
2037                   PEG_METHOD_ENTER(TRC_PROVIDERMANAGER, "CMPIProviderManager::handleEnableModuleRequest");
2038               
2039                   CIMEnableModuleRequestMessage * request =
2040                       dynamic_cast<CIMEnableModuleRequestMessage *>(const_cast<Message *>(message));
2041               
2042                   PEGASUS_ASSERT(request != 0);
2043               
2044                   Array<Uint16> operationalStatus;
2045 kumpf    1.42     operationalStatus.append(CIM_MSE_OPSTATUS_VALUE_OK);
2046 schuur   1.4  
2047                   CIMEnableModuleResponseMessage * response =
2048                       new CIMEnableModuleResponseMessage(
2049                       request->messageId,
2050                       CIMException(),
2051                       request->queueIds.copyAndPop(),
2052                       operationalStatus);
2053               
2054                   PEGASUS_ASSERT(response != 0);
2055               
2056                   // preserve message key
2057                   response->setKey(request->getKey());
2058               
2059                   //  Set HTTP method in response from request
2060                   response->setHttpMethod (request->getHttpMethod ());
2061               
2062                   PEG_METHOD_EXIT();
2063               
2064                   return(response);
2065               }
2066               
2067 dj.gorey 1.29 Message * CMPIProviderManager::handleStopAllProvidersRequest(const Message * message)
2068 schuur   1.4  {
2069                   PEG_METHOD_ENTER(TRC_PROVIDERMANAGER, "CMPIProviderManager::handleStopAllProvidersRequest");
2070               
2071                   CIMStopAllProvidersRequestMessage * request =
2072                       dynamic_cast<CIMStopAllProvidersRequestMessage *>(const_cast<Message *>(message));
2073               
2074                   PEGASUS_ASSERT(request != 0);
2075               
2076                   CIMStopAllProvidersResponseMessage * response =
2077                       new CIMStopAllProvidersResponseMessage(
2078                       request->messageId,
2079                       CIMException(),
2080                       request->queueIds.copyAndPop());
2081               
2082                   PEGASUS_ASSERT(response != 0);
2083               
2084                   // preserve message key
2085                   response->setKey(request->getKey());
2086               
2087                   //  Set HTTP method in response from request
2088                   response->setHttpMethod (request->getHttpMethod ());
2089 schuur   1.4  
2090                   // tell the provider manager to shutdown all the providers
2091 schuur   1.10     providerManager.shutdownAllProviders();
2092 schuur   1.4  
2093                   PEG_METHOD_EXIT();
2094               
2095                   return(response);
2096               }
2097               
2098 kumpf    1.32 Message * CMPIProviderManager::handleInitializeProviderRequest(const Message * message)
2099               {
2100                   PEG_METHOD_ENTER(TRC_PROVIDERMANAGER, "CMPIProviderManager::handleInitializeProviderRequest");
2101               
2102                   HandlerIntroInit(InitializeProvider,message,request,response,handler);
2103               
2104                   try
2105                   {
2106                       // resolve provider name
2107               	ProviderName name = _resolveProviderName(
2108               	    request->operationContext.get(ProviderIdContainer::NAME));
2109               
2110                       // get cached or load new provider module
2111                       CMPIProvider::OpProviderHolder ph =
2112 schuur   1.39            providerManager.getProvider(name.getPhysicalName(), name.getLogicalName());
2113 kumpf    1.32 
2114                   }
2115                   HandlerCatch(handler);
2116               
2117                   PEG_METHOD_EXIT();
2118               
2119                   return(response);
2120               }
2121               
2122 dj.gorey 1.29 Message * CMPIProviderManager::handleUnsupportedRequest(const Message * message)
2123 schuur   1.4  {
2124                   PEG_METHOD_ENTER(TRC_PROVIDERMANAGER, "CMPIProviderManager::handleUnsupportedRequest");
2125               
2126                   PEG_METHOD_EXIT();
2127               
2128                   // a null response implies unsupported or unknown operation
2129 chip     1.1      return(0);
2130 schuur   1.4  }
2131               
2132 kumpf    1.30 ProviderName CMPIProviderManager::_resolveProviderName(
2133                   const ProviderIdContainer & providerId)
2134 schuur   1.4  {
2135 kumpf    1.30     String providerName;
2136                   String fileName;
2137 schuur   1.39     String location;
2138 kumpf    1.30     CIMValue genericValue;
2139               
2140                   genericValue = providerId.getProvider().getProperty(
2141                       providerId.getProvider().findProperty("Name")).getValue();
2142                   genericValue.get(providerName);
2143               
2144                   genericValue = providerId.getModule().getProperty(
2145                       providerId.getModule().findProperty("Location")).getValue();
2146 schuur   1.39     genericValue.get(location);
2147                   fileName = _resolvePhysicalName(location);
2148 dj.gorey 1.29 
2149 schuur   1.39     ProviderName name(providerName, fileName, String::EMPTY, 0);
2150                   name.setLocation(location);
2151                   return name;
2152               //    return ProviderName(providerName, fileName, interfaceName, 0);
2153 chip     1.1  }
2154               
2155               PEGASUS_NAMESPACE_END

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2