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

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

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2