(file) Return to CIMDirectAccessRep.cpp CVS log (file) (dir) Up to [Pegasus] / pegasus / src / Pegasus / Client

   1 kamal.locahana 1.1.2.1 //%2006////////////////////////////////////////////////////////////////////////
   2                        //
   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                        // Copyright (c) 2006 Hewlett-Packard Development Company, L.P.; IBM Corp.;
  12                        // EMC Corporation; Symantec Corporation; The Open Group.
  13                        //
  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                        // 
  21                        // THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
  22 kamal.locahana 1.1.2.1 // 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                        
  33                        #include <Pegasus/Common/MessageLoader.h>
  34                        #include <Pegasus/Common/Exception.h>
  35                        #include <Pegasus/Compiler/cmdline/cimmof/cmdlineExceptions.h>
  36                        #include <Pegasus/ProviderManager2/CMPI/CMPIProviderManager.h>
  37                        #include <Pegasus/ProviderManagerService/ProviderManagerService.h>
  38                        #include <Pegasus/Server/ProviderRegistrationManager/ProviderRegistrationManager.h>
  39                        #include <Pegasus/Server/CIMOperationRequestDispatcher.h>
  40                        #include <Pegasus/Common/CIMMessage.h>
  41                        #include <Pegasus/Common/System.h>
  42                        #include <Pegasus/HandlerService/IndicationHandlerService.h>
  43 kamal.locahana 1.1.2.1 #include <Pegasus/IndicationService/IndicationService.h>
  44                        #include <Pegasus/ControlProviders/NamespaceProvider/NamespaceProvider.h>
  45                        #include <Pegasus/ControlProviders/InteropProvider/InteropProvider.h>
  46                        #include <Pegasus/ControlProviders/Statistic/CIMOMStatDataProvider.h>
  47                        #include <Pegasus/ControlProviders/ConfigSettingProvider/ConfigSettingProvider.h>
  48                        #include <Pegasus/Client/CIMClientRep.h>
  49                        #include <Pegasus/Client/CIMClient.h>
  50                        #include <Pegasus/Common/Message.h>
  51                        #include <Pegasus/Common/CIMMessage.h>
  52                        #include <Pegasus/Config/ConfigManager.h>
  53                        #include <Pegasus/Common/XmlWriter.h>          // used only for test
  54                        #include <Pegasus/Repository/CIMRepository.h>
  55                        #include <Pegasus/ProviderManager2/Default/DefaultProviderManager.h>
  56                        #include <Pegasus/Common/Thread.h> 
  57                        #include "CIMDirectAccess.h"
  58                        #include "CIMDirectAccessRep.h"
  59                        
  60                        
  61                        
  62                        
  63                        
  64 kamal.locahana 1.1.2.1 PEGASUS_USING_STD;
  65                        PEGASUS_NAMESPACE_BEGIN
  66                        
  67                        
  68                        
  69                        #ifndef PEGASUS_USE_DIRECTACCESS_FOR_LOCAL
  70                        #error  "CIMDirectAccessRep.cpp should not be compiling without this flag"
  71                        #endif
  72                        #if     !(PEGASUS_DIRECTACCESS_BUILDTYPE >= dacimINTEGRATED && \
  73                                  PEGASUS_DIRECTACCESS_BUILDTYPE <= dacimSTANDALONE)
  74                        #error  "PEGASUS_DIRECTACCESS_BUILDTYPE must have value in range."
  75                        #endif
  76                        
  77                        
  78                        extern bool runtime_context_is_directaccess_cim;
  79                        template <class ObjectClass> void removePropagatedAndOriginAttributes( 
  80                                                                      ObjectClass& ); // CIMord
  81                        static String _showPropertyList( const CIMPropertyList& );
  82                        
  83                        static void *reposi__ = NULL,
  84                                    *interoppvdr__ = NULL,
  85 kamal.locahana 1.1.2.1             *nspvdr__ = NULL,
  86                                    *statdatapvdr__ = NULL;
  87                        static CIMOperationRequestDispatcher *opreqdispatch__;
  88                        static CIMDirectAccessRep *this__=NULL;
  89                        
  90                        static CIMDirectAccessRep *_dacim_ = NULL;
  91                        AtomicInt CIMDirectAccessRep::refcount_(0);
  92                        Mutex CIMDirectAccessRep::arequestlock_;
  93                        
  94                        
  95                        //-------------------------------------------------------
  96                        CIMDirectAccessRep *CIMDirectAccessRep::get() {
  97                            AutoMutex a(CIMDirectAccessRep::arequestlock_);
  98                            refcount_++;
  99                            if (!_dacim_) {
 100                                /*return*/ _dacim_ = new CIMDirectAccessRep;
 101                        PEGASUS_ASSERT(_dacim_->opreqdispatch_ == opreqdispatch__);
 102                        PEGASUS_ASSERT(_dacim_ == this__);
 103                                return _dacim_;
 104                            }
 105                        PEGASUS_ASSERT(_dacim_->opreqdispatch_ == opreqdispatch__);
 106 kamal.locahana 1.1.2.1 PEGASUS_ASSERT(_dacim_ == this__);
 107                            return _dacim_;
 108                        }
 109                        
 110                        void CIMDirectAccessRep::release() {
 111                            AutoMutex a(CIMDirectAccessRep::arequestlock_);
 112                            if (refcount_.get() > 0) refcount_--;
 113                            if (refcount_.get() == 0) {
 114                                _dacim_ = NULL;
 115                                delete this;
 116                            }
 117                            else {
 118                        PEGASUS_ASSERT(opreqdispatch_ == opreqdispatch__);
 119                        PEGASUS_ASSERT(this == this__);
 120                            }
 121                        }
 122                        
 123                        
 124                        #define _coutid_ " "<<__FILE__<<"@"<<__LINE__<<": "
 125                        //---------------------------------------------------------------------
 126                        static void chunkCallback( CIMRequestMessage*, CIMResponseMessage* ) {
 127 kamal.locahana 1.1.2.1         cout<<_coutid_<<"fix chunkCallback()"<<endl;
 128                            }
 129                        //------------------------------------------------------
 130                        static void indicationCallback( CIMProcessIndicationRequestMessage *indimsg ) {
 131                                cout<<_coutid_<<"fix indicationCallback()"<<endl;
 132                            }
 133                        //---------------------------------------------------------------------
 134                        void CIMDirectAccessRep::chunkCallback_( CIMRequestMessage*, 
 135                        				                      CIMResponseMessage* ) {
 136                                cout<<_coutid_<<"fix chunkCallback()"<<endl;
 137                            }
 138                        //---------------------------------------------------------------------
 139                        void CIMDirectAccessRep::indicationCallback_( 
 140                                                CIMProcessIndicationRequestMessage *indimsg ) {
 141                                cout<<_coutid_<<"fix indicationCallback()"<<endl;
 142                            }
 143                        
 144                        
 145                        
 146                        //-------------------------------------------------------------
 147                        static Message * controlProviderReceiveMessageCallback(
 148 kamal.locahana 1.1.2.1     Message * message,
 149                            void * instance)
 150                        {
 151                            CIMRequestMessage* request = dynamic_cast<CIMRequestMessage*>(message);
 152                            PEGASUS_ASSERT(request != 0);
 153                        
 154                            AcceptLanguageList* langs = new AcceptLanguageList(
 155                                ((AcceptLanguageListContainer) request->operationContext.get(
 156                                    AcceptLanguageListContainer::NAME)).getLanguages());
 157                            Thread::setLanguages(langs);
 158                        
 159                            ProviderMessageHandler* pmh =
 160                                reinterpret_cast<ProviderMessageHandler*>(instance);
 161                            return pmh->processMessage(request);
 162                        }
 163                        
 164                        
 165                        
 166                        
 167                        
 168                        
 169 kamal.locahana 1.1.2.1 //-------------------------------------------------
 170                        const IdentityContainer& gettainer_identity() {
 171                            // put here, the platform-specific logic to determine id for process 
 172                            // we're running in.
 173                            String s("root");
 174                            const IdentityContainer& id_c( s );
 175                            return id_c;
 176                            }
 177                        //-------------------------------------------------
 178                        const ProviderIdContainer& gettainer_pvdrId() {
 179                            //  
 180                            CIMInstance pvdr_module( CIMName("PG_ProviderModule") );
 181                            pvdr_module.addProperty( CIMProperty( 
 182                        	          CIMName("Location"), String("location")) ); // >>> fix
 183                            CIMInstance pvdr( CIMName("PG_Provider") );
 184                            pvdr.addProperty( CIMProperty( 
 185                        	        CIMName("Name"), String("PvdrName") ));       // >>> fix
 186                            ProviderIdContainer pvdrid_c( pvdr_module, pvdr );
 187                            ProviderIdContainer& pvdrid_c2( pvdrid_c );
 188                            return pvdrid_c2;                                        // >>>fix
 189                            }
 190 kamal.locahana 1.1.2.1 
 191                        
 192                        
 193                        
 194                        #define mkresponse(_t) \
 195                                    responsemsg_ = rm->buildResponse(); \
 196                                    responsemsg_->setType(_t);            
 197                        
 198                        
 199                        //-------------------------------------------------------------------
 200                        Message *CIMDirectAccessRep::dorequest( AutoPtr<CIMRequestMessage>& req ) {
 201                        
 202                            AutoMutex a(CIMDirectAccessRep::arequestlock_);
 203                        
 204                            runtime_context_is_directaccess_cim = true;
 205                            CIMRequestMessage *rm = req.get();
 206                            //Message *response = NULL;
 207                        
 208                        
 209                            CIMOperationRequestMessage *orm = 
 210                                              dynamic_cast<CIMOperationRequestMessage*>(rm);
 211 kamal.locahana 1.1.2.1     PEGASUS_ASSERT(orm != NULL);
 212                        
 213                        
 214                            //String s("root");
 215                            const IdentityContainer& id_c( orm->userName );
 216                            rm->operationContext.insert( id_c );
 217                            orm->queueIds.push( MessageQueue::getNextQueueId() );
 218                                                     // above is needed to avoid stack 
 219                                                     // underflow in a QueueIdStack method
 220                           
 221                        
 222                            CIMException cimexcep;
 223                            try { // keep the following 'if else' in order of most common msg types
 224                                  // before less common.  And put the least common in the switch.
 225                        
 226                                if (rm->getType() == CIM_ENUMERATE_INSTANCE_NAMES_REQUEST_MESSAGE) {
 227                                    responsemsg_ = do_ein_((CIMEnumerateInstanceNamesRequestMessage*)rm);
 228                                    }
 229                                else if (rm->getType() == CIM_ENUMERATE_INSTANCES_REQUEST_MESSAGE) {
 230                                    responsemsg_ = do_ei_( (CIMEnumerateInstancesRequestMessage*)rm );
 231                        PEGASUS_ASSERT(opreqdispatch_ == opreqdispatch__);
 232 kamal.locahana 1.1.2.1 PEGASUS_ASSERT(this == this__);
 233                                    }
 234                                else if (rm->getType() == CIM_GET_INSTANCE_REQUEST_MESSAGE) {
 235                                    responsemsg_ = do_gi_( rm );
 236                                    }
 237                                else if (rm->getType() == CIM_GET_CLASS_REQUEST_MESSAGE) { 
 238                                    responsemsg_ = do_gc_( rm );
 239                                    }
 240                                else if (rm->getType() == CIM_GET_PROPERTY_REQUEST_MESSAGE) {
 241                                    mkresponse(DIRECTACCESSCIM_NOTSUPPORTED_TEMP)
 242                                    }
 243                                else if (rm->getType() == CIM_ENUMERATE_CLASS_NAMES_REQUEST_MESSAGE) {
 244                                    responsemsg_ = do_ecn_( rm );
 245                                    }
 246                                else if (rm->getType() == CIM_ENUMERATE_CLASSES_REQUEST_MESSAGE) {
 247                                    responsemsg_ = do_ec_( rm );
 248                                    }
 249                                else if (rm->getType() == CIM_HANDLE_INDICATION_REQUEST_MESSAGE) {
 250                                    mkresponse(DIRECTACCESSCIM_NOTSUPPORTED_TEMP)
 251                                    }
 252                        
 253 kamal.locahana 1.1.2.1         else {
 254                                    switch(rm->getType()) {
 255                        					
 256                                        case CIM_CREATE_INSTANCE_REQUEST_MESSAGE:
 257                        					responsemsg_ = do_ci_( rm );
 258                        					break;
 259                                        case CIM_DELETE_INSTANCE_REQUEST_MESSAGE:
 260                        					responsemsg_ = do_di_( rm );
 261                        					break;
 262                                        case CIM_MODIFY_INSTANCE_REQUEST_MESSAGE:
 263                                            responsemsg_ = do_mi_( rm );
 264                                            break;
 265                                        case CIM_GET_QUALIFIER_REQUEST_MESSAGE:
 266                        					responsemsg_ = do_gq_( rm );
 267                        					break;
 268                                        case CIM_ENUMERATE_QUALIFIERS_REQUEST_MESSAGE:
 269                        					responsemsg_ = do_eq_( rm );
 270                        					break;
 271                                        case CIM_INVOKE_METHOD_REQUEST_MESSAGE:
 272                        					responsemsg_ = do_invoke_( rm );
 273                        					break;
 274 kamal.locahana 1.1.2.1 					
 275                                        case CIM_DELETE_CLASS_REQUEST_MESSAGE:
 276                        					responsemsg_ = do_dc_( rm );
 277                        					break;
 278                                        case CIM_CREATE_CLASS_REQUEST_MESSAGE:
 279                        					responsemsg_ = do_cc_( rm );
 280                        					break;
 281                                        case CIM_MODIFY_CLASS_REQUEST_MESSAGE:
 282                        					responsemsg_ = do_mc_( rm );
 283                        					break;
 284                                        case CIM_SET_QUALIFIER_REQUEST_MESSAGE:
 285                        					responsemsg_ = do_sq_( rm );
 286                        					break;
 287                                        case CIM_DELETE_QUALIFIER_REQUEST_MESSAGE:
 288                        					responsemsg_ = do_dq_( rm );
 289                        					break;
 290                                        case CIM_SET_PROPERTY_REQUEST_MESSAGE: 
 291                        					responsemsg_ = do_sp_( rm );
 292                        					break;
 293                                        case CIM_ASSOCIATORS_REQUEST_MESSAGE:
 294                        					responsemsg_ = do_ea_( rm );
 295 kamal.locahana 1.1.2.1 					break;
 296                                        case CIM_ASSOCIATOR_NAMES_REQUEST_MESSAGE:
 297                        					responsemsg_ = do_ean_( rm );
 298                        					break;
 299                                        case CIM_REFERENCES_REQUEST_MESSAGE:
 300                        					responsemsg_ = do_er_( rm );
 301                        					break;
 302                                        case CIM_REFERENCE_NAMES_REQUEST_MESSAGE:
 303                        					responsemsg_ = do_ern_( rm );
 304                        					break;
 305                                        case CIM_EXEC_QUERY_REQUEST_MESSAGE:
 306                        					responsemsg_ = do_query_( rm );
 307                        					break;
 308                        
 309                        
 310                        					
 311                                        case CIM_EXPORT_INDICATION_REQUEST_MESSAGE:
 312                                        case CIM_PROCESS_INDICATION_REQUEST_MESSAGE:
 313                                        case CIM_HANDLE_INDICATION_REQUEST_MESSAGE:
 314                                        case CIM_NOTIFY_PROVIDER_REGISTRATION_REQUEST_MESSAGE:
 315                                        case CIM_NOTIFY_PROVIDER_TERMINATION_REQUEST_MESSAGE:
 316 kamal.locahana 1.1.2.1                 case CIM_CREATE_SUBSCRIPTION_REQUEST_MESSAGE:  
 317                                        case CIM_MODIFY_SUBSCRIPTION_REQUEST_MESSAGE:
 318                                        case CIM_DELETE_SUBSCRIPTION_REQUEST_MESSAGE:
 319                                        case CIM_DISABLE_MODULE_REQUEST_MESSAGE:
 320                                        case CIM_ENABLE_MODULE_REQUEST_MESSAGE:
 321                                        case CIM_STOP_ALL_PROVIDERS_REQUEST_MESSAGE:
 322                        
 323                                            mkresponse(DIRECTACCESSCIM_NOTSUPPORTED_TEMP)
 324                                            break;
 325                         
 326                                        default:
 327                                            mkresponse(DIRECTACCESSCIM_NOTSUPPORTED_REQUEST) // fix
 328                                        }
 329                                    }
 330                                }
 331                        
 332                            catch( const CIMException& ce ) { cimexcep = ce; }
 333                            catch( const Exception& e ) { cimexcep = 
 334                                             PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED, e.getMessage()); }
 335                            catch(...) {cimexcep = PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED, String::EMPTY);}
 336                        
 337 kamal.locahana 1.1.2.1 PEGASUS_ASSERT(opreqdispatch_ == opreqdispatch__);
 338                        PEGASUS_ASSERT(this == this__);
 339                        
 340                            if ( cimexcep.getCode() != CIM_ERR_SUCCESS ){
 341                                throw cimexcep;                // throw here, or use return via Message?
 342                                }
 343                        
 344                            runtime_context_is_directaccess_cim = false;    // neded?
 345                        
 346                            return responsemsg_;                                   
 347                            } // dorequest()
 348                        
 349                        
 350                        
 351                        
 352                        
 353                                          /*---------------------------
 354                                           *                           *
 355                                           *                           *
 356                                           *          class            *
 357                                           *                           *
 358 kamal.locahana 1.1.2.1                    *                           *
 359                                           *---------------------------*/
 360                        
 361                        
 362                        //----------------------------------------------------------------
 363                        Message *CIMDirectAccessRep::do_gc_( CIMRequestMessage *req ) {
 364                        
 365                            CIMGetClassRequestMessage *gcr = (CIMGetClassRequestMessage*)req;
 366                            PEG_METHOD_ENTER(TRC_DISPATCHER, "CIMDirectAccessRep::do_gc_()");
 367                            AutoPtr<CIMGetClassResponseMessage> response(
 368                                dynamic_cast<CIMGetClassResponseMessage*>(gcr->buildResponse()) );
 369                            CIMException cimException;
 370                        
 371                            try {
 372                                response->cimClass = reposi_->getClass( 
 373                                                         gcr->nameSpace,
 374                                                         gcr->className,
 375                                                         gcr->localOnly,
 376                                                         gcr->includeQualifiers,
 377                                                         gcr->includeClassOrigin,
 378                                                         gcr->propertyList          );
 379 kamal.locahana 1.1.2.1 
 380                                PEG_LOGGER_TRACE(( Logger::STANDARD_LOG, System::CIMSERVER, 
 381                                    Logger::TRACE,
 382                                    "CIMDirectAccessRep::handleGetClassRequest - Namespace: "
 383                                    "$0  Class name: $1",
 384                                    gcr->nameSpace.getString(),
 385                                    gcr->className.getString()) );
 386                                }
 387                            catch (const CIMException& exception) { cimException = exception; }
 388                            catch (const Exception& exception) {
 389                                cimException =
 390                                    PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED, exception.getMessage());
 391                                }
 392                            catch (...) {
 393                                cimException = PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED, String::EMPTY);
 394                                }
 395                        
 396                            response->cimException = cimException;
 397                            PEG_METHOD_EXIT();
 398                            return response.release();
 399                            } // do_gc_()
 400 kamal.locahana 1.1.2.1 
 401                        
 402                        
 403                        
 404                        //-----------------------------------------------------------------------
 405                        Message *CIMDirectAccessRep::do_ecn_( CIMRequestMessage* req ) {
 406                        
 407                            PEG_METHOD_ENTER(TRC_DISPATCHER,"CIMDirectAccessRep::do_ecn_()");
 408                        	
 409                            CIMEnumerateClassNamesRequestMessage *ecnr = 
 410                                      (CIMEnumerateClassNamesRequestMessage*)req;
 411                        
 412                            AutoPtr<CIMEnumerateClassNamesResponseMessage> response(
 413                                dynamic_cast<CIMEnumerateClassNamesResponseMessage*>(
 414                                    ecnr->buildResponse()));
 415                        
 416                            Array<CIMName> classNames;
 417                            CIMException cimException;
 418                        
 419                            try {
 420                                classNames = reposi_->enumerateClassNames(
 421 kamal.locahana 1.1.2.1             ecnr->nameSpace,
 422                                    ecnr->className,
 423                                    ecnr->deepInheritance);
 424                        
 425                                PEG_LOGGER_TRACE((
 426                                    Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE,
 427                                    "CIMDirectAccessRep::do_ecn_() - "
 428                                        "Namespace: $0  Class name: $1",
 429                                    ecnr->nameSpace.getString(),
 430                                    ecnr->className.getString()));
 431                                }
 432                            catch (const CIMException& exception) { cimException = exception; }
 433                            catch (const Exception& exception)  {
 434                                cimException =
 435                                    PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED, exception.getMessage());
 436                                }
 437                            catch (...)  {
 438                                cimException = PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED, String::EMPTY);
 439                                }
 440                        
 441                            response->classNames = classNames;
 442 kamal.locahana 1.1.2.1     response->cimException = cimException;
 443                            PEG_METHOD_EXIT();
 444                            return response.release();
 445                            } // do_ecn_()
 446                        
 447                        
 448                        
 449                        
 450                        //--------------------------------------------------------------------
 451                        Message *CIMDirectAccessRep::do_ec_( CIMRequestMessage* req ) {
 452                        		
 453                            PEG_METHOD_ENTER(TRC_DISPATCHER,"CIMDirectAccessRep::do_ec_()");
 454                        
 455                        	CIMEnumerateClassesRequestMessage *ecr = 
 456                        			(CIMEnumerateClassesRequestMessage*)req;
 457                        	
 458                            AutoPtr<CIMEnumerateClassesResponseMessage> response(
 459                                dynamic_cast<CIMEnumerateClassesResponseMessage*>(
 460                                    ecr->buildResponse()));
 461                        
 462                            Array<CIMClass> cimClasses;
 463 kamal.locahana 1.1.2.1     CIMException cimException;
 464                        
 465                            try {
 466                                cimClasses = reposi_->enumerateClasses(
 467                                    ecr->nameSpace,
 468                                    ecr->className,
 469                                    ecr->deepInheritance,
 470                                    ecr->localOnly,
 471                                    ecr->includeQualifiers,
 472                                    ecr->includeClassOrigin);
 473                        
 474                                PEG_LOGGER_TRACE((
 475                                   Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE,
 476                                   "CIMDirectAccessRep::handleEnumerateClassesRequest - "
 477                                       "Namespace: $0  Class name: $1",
 478                                   ecr->nameSpace.getString(),
 479                                   ecr->className.getString()));
 480                                }
 481                            catch (const CIMException& exception) {
 482                                cimException = exception;
 483                                }
 484 kamal.locahana 1.1.2.1     catch (const Exception& exception) {
 485                                cimException =
 486                                    PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED, exception.getMessage());
 487                                }
 488                            catch (...) {
 489                                cimException = PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED, String::EMPTY);
 490                                }
 491                        
 492                            response->cimClasses = cimClasses;
 493                            response->cimException = cimException;
 494                            PEG_METHOD_EXIT();
 495                            return response.release();
 496                            } // do_ec_()
 497                        
 498                        
 499                        
 500                        
 501                        //-------------------------------------------------------------
 502                        Message *CIMDirectAccessRep::do_dc_( CIMRequestMessage* request) {
 503                        		
 504                            PEG_METHOD_ENTER(TRC_DISPATCHER,"CIMDirectAccessRep::do_dc_()");
 505 kamal.locahana 1.1.2.1 	CIMDeleteClassRequestMessage *req = 
 506                        			               (CIMDeleteClassRequestMessage*) request; 
 507                            AutoPtr<CIMDeleteClassResponseMessage> response(
 508                                dynamic_cast<CIMDeleteClassResponseMessage*>(
 509                                    req->buildResponse()));
 510                            CIMException cimException;
 511                        
 512                            try  {
 513                                //StatProviderTimeMeasurement providerTime(response.get());
 514                        
 515                                reposi_->deleteClass( req->nameSpace, req->className);
 516                                PEG_LOGGER_TRACE((
 517                                    Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE,
 518                                    "CIMDirectAccessRep::do_dc_() - Namespace: $0  Class Name: $1",
 519                                    req->nameSpace.getString(),
 520                                    req->className.getString()));
 521                                }
 522                            catch (const CIMException& exception)  {
 523                                cimException = exception;
 524                                }
 525                            catch (const Exception& exception)  {
 526 kamal.locahana 1.1.2.1         cimException = PEGASUS_CIM_EXCEPTION( CIM_ERR_FAILED, 
 527                        						                      exception.getMessage());
 528                                }
 529                            catch (...)  {
 530                                cimException = PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED, String::EMPTY);
 531                                }
 532                        
 533                            response->cimException = cimException;
 534                            //_enqueueResponse(request, response.release());
 535                            PEG_METHOD_EXIT();
 536                        	return response.release();
 537                            } // do_dc_()
 538                        
 539                        
 540                        
 541                        //-----------------------------------------------------------------
 542                        Message *CIMDirectAccessRep::do_cc_( CIMRequestMessage* request){
 543                            PEG_METHOD_ENTER(TRC_DISPATCHER,"CIMDirectAccessRep::do_cc_()");
 544                            CIMCreateClassRequestMessage *req = (CIMCreateClassRequestMessage*) request;
 545                            AutoPtr<CIMCreateClassResponseMessage> response(
 546                                dynamic_cast<CIMCreateClassResponseMessage*>(
 547 kamal.locahana 1.1.2.1             req->buildResponse()));
 548                        
 549                            CIMException cimException;
 550                        
 551                            try
 552                            {
 553                                removePropagatedAndOriginAttributes(req->newClass);
 554                        
 555                                //StatProviderTimeMeasurement providerTime(response.get());
 556                        
 557                                reposi_->createClass( req->nameSpace, req->newClass,
 558                                              ((ContentLanguageListContainer)req->operationContext.get(
 559                                              ContentLanguageListContainer::NAME)).getLanguages());
 560                        
 561                                PEG_LOGGER_TRACE((
 562                                    Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE,
 563                                    "CIMDirectAccessRep::do_cc_() - Namespace: $0  Class Name: $1",
 564                                    req->nameSpace.getString(),
 565                                    req->newClass.getClassName().getString()));
 566                            }
 567                            catch (const CIMException& exception)
 568 kamal.locahana 1.1.2.1     {
 569                                cimException = exception;
 570                            }
 571                            catch (const Exception& exception)
 572                            {
 573                                cimException =
 574                                    PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED, exception.getMessage());
 575                            }
 576                            catch (...)
 577                            {
 578                                cimException = PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED, String::EMPTY);
 579                            }
 580                        
 581                            response->cimException = cimException;
 582                        
 583                            //_enqueueResponse(request, response.release());
 584                        
 585                            PEG_METHOD_EXIT();
 586                        	return response.release();
 587                        } // do_cc_()
 588                        
 589 kamal.locahana 1.1.2.1 
 590                        
 591                        
 592                        //--------------------------------------------------------------
 593                        Message *CIMDirectAccessRep::do_mc_( CIMRequestMessage* request){
 594                            PEG_METHOD_ENTER(TRC_DISPATCHER,
 595                               "CIMDirectAccessRep::handleModifyClassRequest");
 596                            CIMModifyClassRequestMessage *req = (CIMModifyClassRequestMessage*) request;
 597                            AutoPtr<CIMModifyClassResponseMessage> response(
 598                                dynamic_cast<CIMModifyClassResponseMessage*>(
 599                                    req->buildResponse()));
 600                        
 601                            CIMException cimException;
 602                        
 603                            try
 604                            {
 605                                removePropagatedAndOriginAttributes(req->modifiedClass);
 606                        
 607                                //StatProviderTimeMeasurement providerTime(response.get());
 608                        
 609                                reposi_->modifyClass(
 610 kamal.locahana 1.1.2.1             req->nameSpace,
 611                                    req->modifiedClass,
 612                                    ((ContentLanguageListContainer)req->operationContext.get(
 613                                        ContentLanguageListContainer::NAME)).getLanguages());
 614                            }
 615                            catch (const CIMException& exception)
 616                            {
 617                                cimException = exception;
 618                            }
 619                            catch (const Exception& exception)
 620                            {
 621                                cimException =
 622                                    PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED, exception.getMessage());
 623                            }
 624                            catch (...)
 625                            {
 626                                cimException = PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED, String::EMPTY);
 627                            }
 628                        
 629                            response->cimException = cimException;
 630                        
 631 kamal.locahana 1.1.2.1     //_enqueueResponse(request, response.release());
 632                            PEG_METHOD_EXIT();
 633                        	return response.release();
 634                            } // do_mc_()
 635                        
 636                        
 637                        
 638                        
 639                                          /*---------------------------
 640                                           *                           *
 641                                           *                           *
 642                                           *       instance            *
 643                                           *                           *
 644                                           *                           *
 645                                           *---------------------------*/
 646                        
 647                        
 648                        
 649                        
 650                        //---------------------------------------------------------------------------
 651                        Message *CIMDirectAccessRep::do_ei_( CIMEnumerateInstancesRequestMessage *req ) {
 652 kamal.locahana 1.1.2.1 
 653                        
 654                            PEG_METHOD_ENTER(TRC_DISPATCHER, "CIMDirectAccessRep::_do_ei_()");
 655                        
 656                            // get the class name
 657                            CIMName className = req->className;
 658                            CIMException checkClassException;
 659                        
 660                        PEGASUS_ASSERT(opreqdispatch_ == opreqdispatch__);
 661                        PEGASUS_ASSERT(this == this__);
 662                        
 663                            CIMClass cimClass = opreqdispatch_->_getClass(
 664                                req->nameSpace,
 665                                className,
 666                                checkClassException);
 667                        
 668                        PEGASUS_ASSERT(opreqdispatch_ == opreqdispatch__);
 669                        PEGASUS_ASSERT(this == this__);
 670                        
 671                            if (checkClassException.getCode() != CIM_ERR_SUCCESS)
 672                            {
 673 kamal.locahana 1.1.2.1         CIMResponseMessage* response = req->buildResponse();
 674                                response->cimException = checkClassException;
 675                        
 676                                //_enqueueResponse(request, response);
 677                        
 678                                PEG_METHOD_EXIT();
 679                                return response;
 680                            }
 681                        
 682                            //CDEBUG("CIMOP ei client propertyList = " <<
 683                            //    _showPropertyList(request->propertyList));
 684                        
 685                            // If DeepInheritance==false and no PropertyList was specified by the
 686                            // client, the provider PropertyList should contain all the properties
 687                            // in the specified class.
 688                            if (!req->deepInheritance && req->propertyList.isNull())
 689                            {
 690                                Array<CIMName> propertyNameArray;
 691                                Uint32 numProperties = cimClass.getPropertyCount();
 692                                for (Uint32 i = 0; i < numProperties; i++)
 693                                {
 694 kamal.locahana 1.1.2.1             propertyNameArray.append(cimClass.getProperty(i).getName());
 695                                }
 696                        
 697                                req->propertyList.set(propertyNameArray);
 698                            }
 699                        
 700                            //CDEBUG("CIMOP ei provider propertyList = " <<
 701                            //    _showPropertyList(req->propertyList));
 702                        
 703                            //
 704                            // Get names of descendent classes:
 705                            //
 706                            CIMException cimException;
 707                            Array<ProviderInfo> providerInfos;
 708                        
 709                            Uint32 providerCount;
 710                        
 711                            // Get list of providers.
 712                            try
 713                            {
 714                                //CDEBUG("Looking up Instance Providers");
 715 kamal.locahana 1.1.2.1         providerInfos = opreqdispatch_->_lookupAllInstanceProviders(
 716                                        req->nameSpace,
 717                                        className,
 718                                        providerCount);
 719                            }
 720                            catch (const CIMException& exception)
 721                            {
 722                                CIMResponseMessage* response = req->buildResponse();
 723                                response->cimException = exception;
 724                        
 725                                //_enqueueResponse(request, response);
 726                        
 727                                PEG_METHOD_EXIT();
 728                                return response;
 729                            }
 730                        
 731                            Uint32 toIssueCount = providerInfos.size();
 732                        
 733                            // Test for "enumerate too Broad" and if so, execute exception.
 734                            // This limits the number of provider invocations, not the number
 735                            // of instances returned.
 736 kamal.locahana 1.1.2.1     if (providerCount > opreqdispatch_->_maximumEnumerateBreadth)
 737                            {
 738                                PEG_LOGGER_TRACE((
 739                                    Logger::STANDARD_LOG,
 740                                    System::CIMSERVER,
 741                                    Logger::TRACE,
 742                                    "Request-too-broad exception.  Namespace: $0  Class Name: $1  "
 743                                    "Limit: $2  ProviderCount: $3",
 744                                    req->nameSpace.getString(),
 745                                    req->className.getString(),
 746                                    opreqdispatch_->_maximumEnumerateBreadth, providerCount));
 747                        
 748                                PEG_TRACE_STRING(
 749                                    TRC_DISPATCHER,
 750                                    Tracer::LEVEL4,
 751                                    Formatter::format(
 752                                        "ERROR Enumerate too broad for class $0. Limit = $1, "
 753                                            "Request = $2",
 754                                        req->className.getString(),
 755                                        opreqdispatch_->_maximumEnumerateBreadth,
 756                                        providerCount));
 757 kamal.locahana 1.1.2.1 
 758                                CIMResponseMessage* response = req->buildResponse();
 759                                response->cimException =
 760                                    PEGASUS_CIM_EXCEPTION_L(CIM_ERR_NOT_SUPPORTED, MessageLoaderParms(
 761                                        "Server.CIMDirectAccessRep.ENUM_REQ_TOO_BROAD",
 762                                        "Enumerate request too Broad"));
 763                        
 764                                //_enqueueResponse(request, response);
 765                        
 766                                PEG_METHOD_EXIT();
 767                                return response;
 768                            }
 769                        
 770                            // If no provider is registered and the repository isn't the default,
 771                            // return CIM_ERR_NOT_SUPPORTED
 772                        
 773                            if ((providerCount == 0) && !(reposi_->isDefaultInstanceProvider()))
 774                            {
 775                        
 776                        
 777                                PEG_TRACE_STRING(
 778 kamal.locahana 1.1.2.1             TRC_DISPATCHER,
 779                                    Tracer::LEVEL4,
 780                                    "CIM_ERROR_NOT_SUPPORTED for " + req->className.getString());
 781                        
 782                                CIMResponseMessage* response = req->buildResponse();
 783                                response->cimException =
 784                                    PEGASUS_CIM_EXCEPTION(CIM_ERR_NOT_SUPPORTED, String::EMPTY);
 785                        
 786                                //_enqueueResponse(request, response);
 787                        
 788                                PEG_METHOD_EXIT();
 789                                return response;
 790                            }
 791                        
 792                            //
 793                            // Get names of descendent classes:
 794                            //
 795                            //CIMException cimException;
 796                            //Array<ProviderInfo> providerInfos;
 797                        
 798                        
 799 kamal.locahana 1.1.2.1 CIMEnumerateInstancesRequestMessage *eirm = 
 800                                                    new CIMEnumerateInstancesRequestMessage(*req);
 801                        
 802                            // We have instances for Providers and possibly repository.
 803                            // Set up an aggregate object and save a copy of the original request.
 804                            OperationAggregate* poA= new OperationAggregate(
 805                                new CIMEnumerateInstancesRequestMessage(*req),
 806                                req->getType(),
 807                                req->messageId,
 808                                req->queueIds.top(),
 809                                req->className);
 810                        
 811                            poA->_aggregationSN = opreqdispatch_->cimOperationAggregationSN++;
 812                            Uint32 numClasses = providerInfos.size();
 813                        
 814                        
 815                             CIMResponseMessage *outerresponse = req->buildResponse();
 816                            // gather up the repository responses and send it to out as one response
 817                            // with many instances
 818                            if (reposi_->isDefaultInstanceProvider())
 819                            {
 820 kamal.locahana 1.1.2.1         // Loop through providerInfos, forwarding requests to repository
 821                                for (Uint32 i = 0; i < numClasses; i++)        // ei loop 1
 822                                {
 823                                    ProviderInfo& providerInfo = providerInfos[i];
 824                        
 825                                    // this class is registered to a provider - skip
 826                                    if (providerInfo.hasProvider) continue;
 827                        
 828                                    PEG_TRACE_STRING(
 829                                        TRC_DISPATCHER,
 830                                        Tracer::LEVEL4,
 831                                        Formatter::format(
 832                                            "EnumerateInstances Req. class $0 to repository, "
 833                                                "No $1 of $2, SN $3",
 834                                            providerInfo.className.getString(),
 835                                            i,
 836                                            numClasses,
 837                                            poA->_aggregationSN));
 838                        
 839                                    AutoPtr<CIMEnumerateInstancesResponseMessage> response(
 840                                        dynamic_cast<CIMEnumerateInstancesResponseMessage*>(
 841 kamal.locahana 1.1.2.1                     req->buildResponse()));
 842                        
 843                                    CIMException cimException;
 844                                    Array<CIMInstance> cimNamedInstances;
 845                        
 846                                    try
 847                                    {
 848                                        //StatProviderTimeMeasurement providerTime(response.get());
 849                                        // Enumerate instances only for this class
 850                                        cimNamedInstances =
 851                                            reposi_->enumerateInstancesForClass(
 852                                                req->nameSpace,
 853                                                providerInfo.className,
 854                                                req->localOnly,
 855                                                req->includeQualifiers,
 856                                                req->includeClassOrigin,
 857                                                req->propertyList);
 858                                    }
 859                                    catch (const CIMException& exception)
 860                                    {
 861                                        cimException = exception;
 862 kamal.locahana 1.1.2.1             }
 863                                    catch (const Exception& exception)
 864                                    {
 865                                        cimException = PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED,
 866                                            exception.getMessage());
 867                                    }
 868                                    catch (...)
 869                                    {
 870                                        cimException = PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED,
 871                                            String::EMPTY);
 872                                    }
 873                        
 874                                    response->cimNamedInstances = cimNamedInstances;
 875                                    response->cimException = cimException;
 876                        
 877                                    poA->appendResponse(response.release());
 878                                } // for all classes and derived classes  -- loop 1  ei
 879                                                                         //  loop 1
 880                                                                         //  loop 1
 881                                                                         //
 882                                                                         //  
 883 kamal.locahana 1.1.2.1 
 884                        
 885                        
 886                                
 887                                Uint32 numberResponses = poA->numberResponses();
 888                                Uint32 totalIssued = providerCount + (numberResponses > 0 ? 1 : 0);
 889                                poA->setTotalIssued(totalIssued);
 890                        
 891                                if (numberResponses > 0)
 892                                {
 893                                    //handleEnumerateInstancesResponseAggregation(poA);   ????
 894                        
 895                                    CIMResponseMessage* response = poA->removeResponse(0);
 896                                    forwardRequestForAggregation_(
 897                                        String(PEGASUS_QUEUENAME_OPREQDISPATCHER),
 898                                        String(),
 899                                        new CIMEnumerateInstancesRequestMessage(*req),
 900                                        poA,
 901                                        response);
 902                                }
 903                            } // if isDefaultInstanceProvider
 904 kamal.locahana 1.1.2.1     else
 905                            {
 906                                // Set the number of expected responses in the OperationAggregate
 907                                poA->setTotalIssued(providerCount);
 908                            }
 909                        
 910                            //CDEBUG("Before Loop to send requests. numClasses = " << numClasses);
 911                        
 912                        
 913                        
 914                            // Loop through providerInfos, forwarding requests to providers
 915                            for (Uint32 i = 0; i < numClasses; i++)                        // loop 2 ei
 916                                                                                           // loop 2 ei
 917                            {
 918                        
 919                        
 920                                ProviderInfo& providerInfo = providerInfos[i];
 921                        
 922                                // this class is NOT registered to a provider - skip
 923                                if ( !providerInfo.hasProvider ) {
 924                                    continue;
 925 kamal.locahana 1.1.2.1             }
 926                        
 927                                if (providerInfo.className == "CIM_Namespace" &&
 928                                    (providerInfo.controlProviderName == "ControlService::InteropProvider") ) {
 929                                    continue;
 930                                    }
 931                        
 932                                PEG_TRACE_STRING(
 933                                    TRC_DISPATCHER,
 934                                    Tracer::LEVEL4,
 935                                    Formatter::format(
 936                                        "EnumerateInstances Req. class $0 to svc \"$1\" for control "
 937                                            "provider \"$2\", No $3 of $4, SN $5",
 938                                        providerInfo.className.getString(),
 939                                        providerInfo.serviceName,
 940                                        providerInfo.controlProviderName,
 941                                        i, numClasses, poA->_aggregationSN));
 942                        
 943                        
 944                        
 945                                CIMEnumerateInstancesRequestMessage *requestCopy =
 946 kamal.locahana 1.1.2.1             new CIMEnumerateInstancesRequestMessage(*req);   //why??
 947                        
 948                                requestCopy->className = providerInfo.className;
 949                        
 950                                CIMException checkClassException;
 951                        
 952                                CIMClass cimClass = opreqdispatch_->_getClass(
 953                                    req->nameSpace,
 954                                    providerInfo.className,
 955                                    checkClassException);
 956                        
 957                                // The following is not correct. Need better way to terminate.
 958                                if (checkClassException.getCode() != CIM_ERR_SUCCESS)
 959                                {
 960                                    CIMResponseMessage* response = req->buildResponse();
 961                        
 962                                    forwardRequestForAggregation_(
 963                                        String(PEGASUS_QUEUENAME_OPREQDISPATCHER),
 964                                        String(),
 965                                        new CIMEnumerateInstancesRequestMessage(*req),   // why ya?
 966                                        poA,
 967 kamal.locahana 1.1.2.1                 response);
 968                                }
 969                        
 970                                if (providerInfo.providerIdContainer.get() != 0)
 971                                {
 972                                    requestCopy /*req*/ ->operationContext.insert(
 973                                        *(providerInfo.providerIdContainer.get()));
 974                                }
 975                                
 976                                //if ( !req->operationContext.contains() )
 977                                //{
 978                                //    req->operationContext.insert();
 979                                //}
 980                        
 981                        #ifdef PEGASUS_ENABLE_OBJECT_NORMALIZATION
 982                                if (opreqdispatch_->_enableNormalization && 
 983                                                providerInfo.hasProviderNormalization)
 984                                {
 985                                    requestCopy /*req*/ ->operationContext.insert(
 986                                        CachedClassDefinitionContainer(cimClass));
 987                                }
 988 kamal.locahana 1.1.2.1 #endif
 989                                                                                  // is ei
 990                        const ProviderIdContainer *pid=providerInfo.providerIdContainer.get();
 991                        if (pid) {
 992                        const CIMName mod=pid->getModule().getClassName();
 993                        const CIMName pvdr=pid->getProvider().getClassName();
 994                        }
 995                        
 996                                if (checkClassException.getCode() == CIM_ERR_SUCCESS)
 997                                {
 998                                    PEG_TRACE_STRING(
 999                                        TRC_DISPATCHER,
1000                                        Tracer::LEVEL4,
1001                                        Formatter::format(
1002                                            "EnumerateInstances Req. Fwd class $0 to svc \"$1\" for "
1003                                                "control provider \"$2\", PropertyList= $3",
1004                                            providerInfo.className.getString(),
1005                                            providerInfo.serviceName,
1006                                            providerInfo.controlProviderName,
1007                                            _showPropertyList(req->propertyList)));
1008                        
1009 kamal.locahana 1.1.2.1             forwardRequestForAggregation_(
1010                                        providerInfo.serviceName,
1011                                        providerInfo.controlProviderName,
1012                                        requestCopy,    // or req??  why need copy?
1013                                        poA,
1014                                        outerresponse);
1015                                }
1016                            } // for all classes and dervied classes -- loop 2 ei
1017                        
1018                        
1019                           
1020                            opreqdispatch_->handleEnumerateInstancesResponseAggregation( poA );    
1021                            outerresponse = poA->removeResponse(Uint32(0));
1022                            outerresponse->setComplete(true);
1023                        
1024                            PEG_METHOD_EXIT();
1025                            return outerresponse;
1026                        } // do_ei_() 
1027                        
1028                        
1029                        
1030 kamal.locahana 1.1.2.1 
1031                        
1032                        //------------------------------------------------------------------------
1033                        Message *CIMDirectAccessRep::do_ein_( CIMRequestMessage *req ) {
1034                        //verify(__FILE__,__LINE__);
1035                        
1036                            PEG_METHOD_ENTER(TRC_DISPATCHER,"CIMDirectAccessRep::do_ein_()");
1037                            CIMEnumerateInstanceNamesRequestMessage *request = 
1038                                             (CIMEnumerateInstanceNamesRequestMessage*)req;
1039                            CIMName className = request->className;
1040                        
1041                            CIMException checkClassException;
1042                        
1043                            CIMClass cimClass = opreqdispatch_->_getClass(
1044                                request->nameSpace,
1045                                className,
1046                                checkClassException);
1047                        
1048                            if (checkClassException.getCode() != CIM_ERR_SUCCESS)
1049                            {
1050                                CIMResponseMessage* response = request->buildResponse();
1051 kamal.locahana 1.1.2.1         response->cimException = checkClassException;
1052                        
1053                                //_enqueueResponse(request, response);
1054                                PEG_METHOD_EXIT();
1055                                return response;
1056                            }
1057                        
1058                            //
1059                            // Get names of descendent classes:
1060                            //
1061                            CIMException cimException;
1062                            Array<ProviderInfo> providerInfos;
1063                        
1064                            // This gets set by _lookupAllInstanceProviders()
1065                            Uint32 providerCount;
1066                        
1067                            try
1068                            {
1069                                providerInfos = opreqdispatch_->_lookupAllInstanceProviders(
1070                                    request->nameSpace,
1071                                    request->className,
1072 kamal.locahana 1.1.2.1             providerCount);
1073                            }
1074                            catch (const CIMException& exception)
1075                            {
1076                                CIMResponseMessage* response = request->buildResponse();
1077                                response->cimException = exception;
1078                        
1079                                //_enqueueResponse(request, response);
1080                                PEG_METHOD_EXIT();
1081                                return response;
1082                            }
1083                        
1084                        
1085                            // Test for "enumerate too Broad" and if so, execute exception.
1086                            // This limits the number of provider invocations, not the number
1087                            // of instances returned.
1088                            if (providerCount > opreqdispatch_->_maximumEnumerateBreadth)
1089                            {
1090                                PEG_LOGGER_TRACE((
1091                                    Logger::STANDARD_LOG,
1092                                    System::CIMSERVER,
1093 kamal.locahana 1.1.2.1             Logger::TRACE,
1094                                    "Request-too-broad exception.  Namespace: $0  "
1095                                        "Class Name: $1 Limit: $2  ProviderCount: $3",
1096                                    request->nameSpace.getString(),
1097                                    request->className.getString(),
1098                                    opreqdispatch_->_maximumEnumerateBreadth, providerCount));
1099                        
1100                                PEG_TRACE_STRING(
1101                                    TRC_DISPATCHER,
1102                                    Tracer::LEVEL4,
1103                                    Formatter::format(
1104                                        "ERROR Enumerate too broad for class $0. "
1105                                            "Limit = $1, Request = $2",
1106                                        request->className.getString(),
1107                                        opreqdispatch_->_maximumEnumerateBreadth,
1108                                        providerCount));
1109                        
1110                                CIMResponseMessage* response = request->buildResponse();
1111                                response->cimException = PEGASUS_CIM_EXCEPTION_L(CIM_ERR_NOT_SUPPORTED,
1112                                    MessageLoaderParms(
1113                                        "Server.CIMDirectAccessRep.ENUM_REQ_TOO_BROAD",
1114 kamal.locahana 1.1.2.1                 "Enumerate request too Broad"));
1115                        
1116                        
1117                                //_enqueueResponse(request, response);
1118                                PEG_METHOD_EXIT();
1119                                return response;
1120                            }
1121                        
1122                            // If no provider is registered and the repository isn't the default,
1123                            // return CIM_ERR_NOT_SUPPORTED
1124                            if ((providerCount == 0) && !(reposi_->isDefaultInstanceProvider()))
1125                            {
1126                                PEG_TRACE_STRING(
1127                                    TRC_DISPATCHER,
1128                                    Tracer::LEVEL4,
1129                                    "CIM_ERROR_NOT_SUPPORTED for " + request->className.getString());
1130                        
1131                                CIMResponseMessage* response = request->buildResponse();
1132                                response->cimException =
1133                                    PEGASUS_CIM_EXCEPTION(CIM_ERR_NOT_SUPPORTED, String::EMPTY);
1134                        
1135 kamal.locahana 1.1.2.1 
1136                                //_enqueueResponse(request, response);
1137                                PEG_METHOD_EXIT();
1138                                return response;
1139                            }
1140                            
1141                        
1142                            // We have instances for Providers and possibly repository.
1143                            // Set up an aggregate object and save a copy of the original request.
1144                            OperationAggregate* poA= new OperationAggregate(
1145                                new CIMEnumerateInstanceNamesRequestMessage(*request),
1146                                request->getType(),
1147                                request->messageId,
1148                                request->queueIds.top(),
1149                                request->className);
1150                        
1151                            poA->_aggregationSN = opreqdispatch_->cimOperationAggregationSN++;
1152                            Uint32 numClasses = providerInfos.size();
1153                        
1154                        
1155                            CIMResponseMessage *globresponse = request->buildResponse();
1156 kamal.locahana 1.1.2.1 
1157                            if (reposi_->isDefaultInstanceProvider())
1158                            {
1159                                    
1160                                
1161                                // Loop through providerInfos, forwarding requests to repository
1162                                for (Uint32 i = 0; i < numClasses; i++) // loop 1  ein
1163                                                                        // loop 1  ein
1164                                                                        // loop 1  ein
1165                                {
1166                                    ProviderInfo& providerInfo = providerInfos[i];
1167                        
1168                        
1169                                    // this class is registered to a provider - skip
1170                                    if (providerInfo.hasProvider) continue;
1171                        
1172                                    // If this class does not have a provider
1173                        
1174                                    PEG_TRACE_STRING(
1175                                        TRC_DISPATCHER,
1176                                        Tracer::LEVEL4,
1177 kamal.locahana 1.1.2.1                 Formatter::format(
1178                                            "EnumerateInstanceNames Req. class $0 to repository, "
1179                                            "No $1 of $2, SN $3",
1180                                            providerInfo.className.getString(),
1181                                            i, numClasses, poA->_aggregationSN));
1182                        
1183                                    AutoPtr<CIMEnumerateInstanceNamesResponseMessage> response(
1184                                        dynamic_cast<CIMEnumerateInstanceNamesResponseMessage*>(
1185                                            request->buildResponse()));
1186                        
1187                                    try {
1188                                        // Enumerate instances only for this class
1189                                        response->instanceNames = 
1190                                                reposi_->enumerateInstanceNamesForClass(
1191                                                request->nameSpace, providerInfo.className );
1192                                        }
1193                                    catch (const CIMException& exception) {
1194                                        response->cimException = exception;
1195                                        }
1196                                    catch (const Exception& exception) {
1197                                        response->cimException = PEGASUS_CIM_EXCEPTION(
1198 kamal.locahana 1.1.2.1                     CIM_ERR_FAILED, exception.getMessage());
1199                                        }
1200                                    catch (...) {
1201                                        response->cimException = PEGASUS_CIM_EXCEPTION(
1202                                            CIM_ERR_FAILED, String::EMPTY);
1203                                        }
1204                        
1205                                    poA->appendResponse(response.release());
1206                                    
1207                                } // for all classes and derived classes -- loop 1 ein
1208                                                                         // loop 1 ein -- end
1209                        
1210                                
1211                        
1212                                Uint32 numberResponses = poA->numberResponses();
1213                                Uint32 totalIssued = providerCount + (numberResponses > 0 ? 1 : 0);
1214                                poA->setTotalIssued(totalIssued);
1215                        
1216                        
1217                                if (numberResponses > 0)
1218                                {
1219 kamal.locahana 1.1.2.1             //opreqdispatch_->handleEnumerateInstanceNamesResponseAggregation(poA);
1220                                    CIMResponseMessage *response = poA->removeResponse(0);  // ????????????  why???
1221                        
1222                                    forwardRequestForAggregation_(                          // from loop 1
1223                                        String(PEGASUS_QUEUENAME_OPREQDISPATCHER),
1224                                        String(),
1225                                        new CIMEnumerateInstanceNamesRequestMessage(*request),
1226                                        poA,
1227                                        response);
1228                                }
1229                            } // if isDefaultInstanceProvider
1230                            else
1231                            {
1232                                // Set the number of expected responses in the OperationAggregate
1233                                poA->setTotalIssued(providerCount);
1234                            }
1235                        
1236                        
1237                        
1238                        
1239                            // Loop through providerInfos, forwarding requests to providers
1240 kamal.locahana 1.1.2.1     for (Uint32 i = 0; i < numClasses; i++)  // loop 2 ein
1241                                                                     // loop 2 ein
1242                                                                     // loop 2 ein
1243                            {
1244                                ProviderInfo& providerInfo = providerInfos[i];
1245                        
1246                                // this class is NOT registered to a provider - skip
1247                                if ( !providerInfo.hasProvider ) continue;
1248                        
1249                                PEG_TRACE_STRING(
1250                                    TRC_DISPATCHER,
1251                                    Tracer::LEVEL4,
1252                                    Formatter::format(
1253                                        "EnumerateInstanceNames Req. class $0 to svc \"$1\" for "
1254                                            "control provider \"$2\", No $3 of $4, SN $5",
1255                                        providerInfo.className.getString(),
1256                                        providerInfo.serviceName,
1257                                        providerInfo.controlProviderName,
1258                                        i,
1259                                        numClasses,
1260                                        poA->_aggregationSN));
1261 kamal.locahana 1.1.2.1 
1262                                CIMEnumerateInstanceNamesRequestMessage* requestCopy =
1263                                    new CIMEnumerateInstanceNamesRequestMessage(*request);
1264                        
1265                                requestCopy->className = providerInfo.className;
1266                        
1267                                CIMException checkClassException;
1268                        
1269                                CIMClass cimClass = opreqdispatch_->_getClass( request->nameSpace,
1270                                                                               providerInfo.className,
1271                                                                               checkClassException );
1272                        
1273                                // The following is not correct. Need better way to terminate.
1274                                if (checkClassException.getCode() != CIM_ERR_SUCCESS)
1275                                {
1276                                    CIMResponseMessage* response = request->buildResponse();
1277                                    forwardRequestForAggregation_(                   // loop 2 ein cim err
1278                                        String(PEGASUS_QUEUENAME_OPREQDISPATCHER),
1279                                        String(),
1280                                        new CIMEnumerateInstanceNamesRequestMessage(*request),
1281                                        poA,
1282 kamal.locahana 1.1.2.1                 response);
1283                                }
1284                        
1285                                if (providerInfo.providerIdContainer.get() != 0)
1286                                {
1287                                    requestCopy->operationContext.insert(         // <-- note 'Copy'
1288                                        *(providerInfo.providerIdContainer.get()));
1289                                }
1290                        const ProviderIdContainer *pid=providerInfo.providerIdContainer.get();
1291                        if (pid){
1292                        const CIMName mod=pid->getModule().getClassName();
1293                        const CIMName pvdr=pid->getProvider().getClassName();
1294                        }
1295                                
1296                        #ifdef PEGASUS_ENABLE_OBJECT_NORMALIZATION
1297                                if (opreqdispatch_->_enableNormalization && 
1298                                                providerInfo.hasProviderNormalization)
1299                                {
1300                                    requestCopy->operationContext.insert(
1301                                        CachedClassDefinitionContainer(cimClass));
1302                                }
1303 kamal.locahana 1.1.2.1 #endif
1304                        
1305                                if (checkClassException.getCode() == CIM_ERR_SUCCESS)
1306                                {
1307                                    forwardRequestForAggregation_(          // loop 2 ein
1308                                        providerInfo.serviceName,
1309                                        providerInfo.controlProviderName,
1310                                        requestCopy,
1311                                        poA,
1312                                        globresponse);
1313                                }
1314                            } // for all classes and derived classes -- loop 2 ein
1315                        
1316                            // now, aggregate whatever responses are in poA.
1317                            opreqdispatch_->handleEnumerateInstanceNamesResponseAggregation(poA);
1318                            globresponse = poA->removeResponse(0);
1319                            globresponse->setComplete(true);
1320                        
1321                            PEG_METHOD_EXIT();
1322                            return globresponse;
1323                            
1324 kamal.locahana 1.1.2.1 } // do_ein_()
1325                        
1326                        
1327                        
1328                        
1329                        
1330                        //-----------------------------------------------------------------
1331                        Message *CIMDirectAccessRep::do_gi_( CIMRequestMessage* req ) {
1332                        
1333                            CIMGetInstanceRequestMessage *gir = (CIMGetInstanceRequestMessage*)req;
1334                        		
1335                            PEG_METHOD_ENTER(TRC_DISPATCHER,"CIMDirectAccessRep::do_gi_()");
1336                        
1337                        	
1338                            // ATTN: Need code here to expand partial instance!
1339                        
1340                            // get the class name
1341                            CIMName className = gir->instanceName.getClassName();
1342                            CIMException checkClassException;
1343                        
1344                            CIMClass cimClass = opreqdispatch_->_getClass( gir->nameSpace,
1345 kamal.locahana 1.1.2.1                                                    className,
1346                                                                           checkClassException );
1347                        
1348                            if (checkClassException.getCode() != CIM_ERR_SUCCESS)
1349                            {
1350                                PEG_LOGGER_TRACE((
1351                                    Logger::STANDARD_LOG,
1352                                    System::CIMSERVER,
1353                                    Logger::TRACE,
1354                                    "CIMDirectAccessRep::do_gi_() - "
1355                                        "CIM exist exception has occurred.  Namespace: $0  "
1356                                        "Class Name: $1",
1357                                    gir->nameSpace.getString(),
1358                                    className.getString()));
1359                        
1360                                CIMResponseMessage *response = gir->buildResponse();
1361                                response->cimException = checkClassException;
1362                                return response;
1363                                PEG_METHOD_EXIT();
1364                            }
1365                            //String serviceName;
1366 kamal.locahana 1.1.2.1     //String controlProviderName;
1367                            //ProviderIdContainer* providerIdContainer = 0;
1368                        
1369                            ProviderInfo providerInfo = opreqdispatch_->_lookupNewInstanceProvider(
1370                                                                             gir->nameSpace,
1371                                                                             className );
1372                        
1373                            if (providerInfo.hasProvider) {
1374                                CIMGetInstanceRequestMessage* requestCopy =
1375                                    new CIMGetInstanceRequestMessage(*gir);
1376                        
1377                                if (providerInfo.providerIdContainer.get() != 0)
1378                                {
1379                                    requestCopy->operationContext.insert(
1380                                        *providerInfo.providerIdContainer.get());
1381                        
1382                                    //delete providerIdContainer;
1383                                    //providerIdContainer = 0;
1384                                }
1385                        
1386                        #ifdef PEGASUS_ENABLE_OBJECT_NORMALIZATION
1387 kamal.locahana 1.1.2.1         if (opreqdispatch_->_enableNormalization && providerInfo.hasProviderNormalization)
1388                                {
1389                                    requestCopy->operationContext.insert(
1390                                        CachedClassDefinitionContainer(cimClass));
1391                                }
1392                        #endif
1393                        
1394                                CIMGetInstanceRequestMessage* requestCallbackCopy =
1395                                    new CIMGetInstanceRequestMessage(*requestCopy);  // fix
1396                        
1397                                Message *rsp = forwardRequestToProvider_(
1398                                    providerInfo.className,
1399                                    providerInfo.serviceName,
1400                                    providerInfo.controlProviderName,
1401                                    requestCopy,
1402                                    requestCallbackCopy);
1403                        
1404                                 PEG_METHOD_EXIT();
1405                                 return rsp;
1406                                 }
1407                        
1408 kamal.locahana 1.1.2.1 	
1409                            // not internal or found provider, try default provider
1410                            AutoPtr<CIMGetInstanceResponseMessage> response(
1411                                dynamic_cast<CIMGetInstanceResponseMessage*>(
1412                                    gir->buildResponse()));
1413                        
1414                            if (reposi_->isDefaultInstanceProvider()) {
1415                        			
1416                        		
1417                                CIMException cimException;
1418                                CIMInstance cimInstance;
1419                        
1420                                try {
1421                        
1422                                    cimInstance = reposi_->getInstance(
1423                                            gir->nameSpace,
1424                                            gir->instanceName,
1425                                            gir->localOnly,
1426                                            gir->includeQualifiers,
1427                                            gir->includeClassOrigin,
1428                                            gir->propertyList);
1429 kamal.locahana 1.1.2.1             }
1430                                catch (const CIMException& exception) {
1431                                    cimException = exception;
1432                                    }
1433                                catch (const Exception& exception) {
1434                                    cimException =
1435                                        PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED, exception.getMessage());
1436                                    }
1437                                catch (...) {
1438                                    cimException = PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED, String::EMPTY);
1439                                    }
1440                        
1441                                response->cimInstance = cimInstance;
1442                                response->cimException = cimException;
1443                                return response.release();
1444                                }
1445                        	
1446                            else {
1447                        		// No provider is registered and the repository isn't the default
1448                                response->cimException =
1449                                    PEGASUS_CIM_EXCEPTION(CIM_ERR_NOT_SUPPORTED, String::EMPTY);
1450 kamal.locahana 1.1.2.1         return response.release();
1451                                }
1452                        
1453                            PEG_METHOD_EXIT();
1454                            return NULL;          // ebbfix
1455                            } // do_gi_()
1456                        
1457                        
1458                        
1459                        
1460                        
1461                        //-----------------------------------------------------------------------
1462                        Message *CIMDirectAccessRep::do_ci_( CIMRequestMessage* request ) {
1463                        		
1464                            PEG_METHOD_ENTER(TRC_DISPATCHER,"CIMDirectAccessRep::do_ci_()");
1465                        
1466                            CIMCreateInstanceRequestMessage *req = 
1467                        			          (CIMCreateInstanceRequestMessage*)request;
1468                        	
1469                            // get the class name
1470                            CIMName className = req->newInstance.getClassName();
1471 kamal.locahana 1.1.2.1 	
1472                            CIMException checkClassException;
1473                        
1474                            opreqdispatch_->_checkExistenceOfClass( req->nameSpace, className, 
1475                        					                        checkClassException);
1476                        
1477                            if (checkClassException.getCode() != CIM_ERR_SUCCESS)
1478                            {
1479                                PEG_LOGGER_TRACE((
1480                                    Logger::STANDARD_LOG,
1481                                    System::CIMSERVER,
1482                                    Logger::TRACE,
1483                                    "CIMDirectAccessRep::do_ci_() - "
1484                                        "CIM exist exception has occurred.  Namespace: $0  "
1485                                        "Class Name: $1",
1486                                    req->nameSpace.getString(),
1487                                    className.getString()));
1488                        
1489                                CIMResponseMessage* response = req->buildResponse();
1490                                response->cimException = checkClassException;
1491                        
1492 kamal.locahana 1.1.2.1         //_enqueueResponse(request, response);
1493                        
1494                                PEG_METHOD_EXIT();
1495                                return response;
1496                            }
1497                        
1498                            //String serviceName;
1499                            //String controlProviderName;
1500                            //ProviderIdContainer* providerIdContainer = 0;
1501                        
1502                            ProviderInfo providerInfo =
1503                                opreqdispatch_->_lookupNewInstanceProvider( req->nameSpace, className );
1504                        
1505                            if (providerInfo.hasProvider)
1506                            {
1507                                CIMCreateInstanceRequestMessage* requestCopy =    // fix
1508                                    new CIMCreateInstanceRequestMessage(*req);
1509                        
1510                                removePropagatedAndOriginAttributes(requestCopy->newInstance);
1511                        
1512                                if (providerInfo.providerIdContainer.get() != 0)
1513 kamal.locahana 1.1.2.1         {
1514                                    requestCopy->operationContext.insert(
1515                                        *providerInfo.providerIdContainer.get());
1516                        
1517                                    //delete providerIdContainer;
1518                                    //providerIdContainer = 0;
1519                                }
1520                        
1521                                CIMCreateInstanceRequestMessage* requestCallbackCopy =
1522                                    new CIMCreateInstanceRequestMessage(*requestCopy);
1523                        
1524                        		
1525                                return forwardRequestToProvider_(
1526                        					providerInfo.className,
1527                        					providerInfo.serviceName,
1528                        					providerInfo.controlProviderName,
1529                        					requestCopy,
1530                        					requestCallbackCopy);
1531                        
1532                                PEG_METHOD_EXIT();
1533                               
1534 kamal.locahana 1.1.2.1     }
1535                            else if (reposi_->isDefaultInstanceProvider())
1536                            {
1537                                AutoPtr<CIMCreateInstanceResponseMessage> response(
1538                                    dynamic_cast<CIMCreateInstanceResponseMessage*>(
1539                                        req->buildResponse()));
1540                        
1541                                CIMException cimException;
1542                                CIMObjectPath instanceName;
1543                        
1544                        		
1545                                try
1546                                {
1547                                    removePropagatedAndOriginAttributes( req->newInstance );
1548                        
1549                                    //StatProviderTimeMeasurement providerTime(response.get());
1550                        
1551                                    
1552                                    instanceName = reposi_->createInstance(
1553                                        req->nameSpace,
1554                        #if 1 // temp code; despite being a const parm, deep under createInstance()
1555 kamal.locahana 1.1.2.1       // it can change!   E.g. in CIMPropertyRep::resolve() (at least). 
1556                              // (this is temp for the classOrigin problem found in Client.cpp)
1557                                        req->newInstance.clone(),
1558                        #else            
1559                                        req->newInstance,
1560                        #endif                
1561                                        ((ContentLanguageListContainer)req->operationContext.get(
1562                                            ContentLanguageListContainer::NAME)).getLanguages());
1563                        
1564                                    PEG_LOGGER_TRACE((
1565                                        Logger::STANDARD_LOG,
1566                                        System::CIMSERVER,
1567                                        Logger::TRACE,
1568                                        "CIMDirectAccessRep::handleCreateInstanceRequest - "
1569                                            "Namespace: $0  Instance name: $1",
1570                                        req->nameSpace.getString(),
1571                                        req->newInstance.getClassName().getString()));
1572                                }
1573                                catch (const CIMException& exception)
1574                                {
1575                                    cimException = exception;
1576 kamal.locahana 1.1.2.1         }
1577                                catch (const Exception& exception)
1578                                {
1579                                    cimException =
1580                                        PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED, exception.getMessage());
1581                                }
1582                                catch (...)
1583                                {
1584                                    cimException = PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED, String::EMPTY);
1585                                }
1586                        
1587                                response->instanceName = instanceName;
1588                                response->cimException = cimException;
1589                        
1590                                //_enqueueResponse(request, response.release());
1591                                return response.release();
1592                            }
1593                            else // No provider is registered and the repository isn't the default
1594                            {
1595                                CIMResponseMessage* response = request->buildResponse();
1596                                response->cimException =
1597 kamal.locahana 1.1.2.1             PEGASUS_CIM_EXCEPTION(CIM_ERR_NOT_SUPPORTED, String::EMPTY);
1598                        
1599                                //_enqueueResponse(request, response);
1600                                return response;
1601                            }
1602                        
1603                            CIMResponseMessage *response = request->buildResponse();
1604                            response->cimException =
1605                                    PEGASUS_CIM_EXCEPTION(CIM_ERR_NOT_SUPPORTED, 
1606                        							      "No provider, no default provider, no nothing");
1607                            PEG_METHOD_EXIT();
1608                            return response;
1609                        } // do_ci_()
1610                        
1611                        
1612                        
1613                        
1614                        
1615                        //---------------------------------------------------------------------
1616                        Message *CIMDirectAccessRep::do_di_( CIMRequestMessage* request ){
1617                        		
1618 kamal.locahana 1.1.2.1     PEG_METHOD_ENTER(TRC_DISPATCHER,"CIMDirectAccessRep::do_di_()");
1619                        
1620                            CIMDeleteInstanceRequestMessage *req = 
1621                        			               (CIMDeleteInstanceRequestMessage*)request;
1622                        	
1623                            // get the class name
1624                            CIMName className = req->instanceName.getClassName();
1625                        
1626                            CIMException checkClassException;
1627                        
1628                            opreqdispatch_->_checkExistenceOfClass(req->nameSpace, 
1629                        					                       className, 
1630                        										   checkClassException);
1631                        
1632                            if (checkClassException.getCode() != CIM_ERR_SUCCESS)
1633                            {
1634                                PEG_LOGGER_TRACE((
1635                                    Logger::STANDARD_LOG,
1636                                    System::CIMSERVER,
1637                                    Logger::TRACE,
1638                                    "CIMDirectAccessRep::do_ci_() - "
1639 kamal.locahana 1.1.2.1                 "CIM exist exception has occurred.  Namespace: $0  "
1640                                        "Class Name: $1",
1641                                    req->nameSpace.getString(),
1642                                    className.getString()));
1643                        
1644                                CIMResponseMessage* response = req->buildResponse();
1645                                response->cimException = checkClassException;
1646                        
1647                                //_enqueueResponse(request, response);
1648                        
1649                                PEG_METHOD_EXIT();
1650                                return response;
1651                            }
1652                        
1653                            //String serviceName;
1654                            //String controlProviderName;
1655                            //ProviderIdContainer* providerIdContainer = 0;
1656                        
1657                            ProviderInfo providerInfo =
1658                                opreqdispatch_->_lookupNewInstanceProvider( req->nameSpace, className);
1659                        
1660 kamal.locahana 1.1.2.1     if (providerInfo.hasProvider)
1661                            {
1662                                CIMDeleteInstanceRequestMessage* requestCopy =
1663                                    new CIMDeleteInstanceRequestMessage(*req);
1664                        
1665                                if (providerInfo.providerIdContainer.get() != 0)
1666                                {
1667                                    requestCopy->operationContext.insert(
1668                                        *providerInfo.providerIdContainer.get());
1669                        
1670                                    //delete providerIdContainer;
1671                                    //providerIdContainer = 0;
1672                                }
1673                        
1674                                CIMDeleteInstanceRequestMessage* requestCallbackCopy =
1675                                    new CIMDeleteInstanceRequestMessage(*requestCopy);    // fix
1676                        
1677                                return forwardRequestToProvider_(
1678                                    providerInfo.className,
1679                                    providerInfo.serviceName,
1680                                    providerInfo.controlProviderName,
1681 kamal.locahana 1.1.2.1             requestCopy,
1682                                    requestCallbackCopy);
1683                        
1684                                PEG_METHOD_EXIT();
1685                                //return;
1686                            }
1687                            else if (reposi_->isDefaultInstanceProvider())
1688                            {
1689                                AutoPtr<CIMDeleteInstanceResponseMessage> response(
1690                                    dynamic_cast<CIMDeleteInstanceResponseMessage*>(
1691                                        req->buildResponse()));
1692                        
1693                                CIMException cimException;
1694                        
1695                                try
1696                                {
1697                                    //StatProviderTimeMeasurement providerTime(response.get());
1698                        
1699                                    reposi_->deleteInstance( req->nameSpace, req->instanceName);
1700                        
1701                                    PEG_LOGGER_TRACE((
1702 kamal.locahana 1.1.2.1                 Logger::STANDARD_LOG,
1703                                        System::CIMSERVER,
1704                                        Logger::TRACE,
1705                                        "CIMDirectAccessRep::do_di_() - "
1706                                            "Namespace: $0  Instance Name: $1",
1707                                        req->nameSpace.getString(),
1708                                        req->instanceName.toString()));
1709                                }
1710                                catch (const CIMException& exception)
1711                                {
1712                                    cimException = exception;
1713                                }
1714                                catch (const Exception& exception)
1715                                {
1716                                    cimException =
1717                                        PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED, exception.getMessage());
1718                                }
1719                                catch (...)
1720                                {
1721                                    cimException = PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED, String::EMPTY);
1722                                }
1723 kamal.locahana 1.1.2.1 
1724                                response->cimException = cimException;
1725                        
1726                                //_enqueueResponse(request, response.release());
1727                        		return response.release();
1728                            }
1729                            else // No provider is registered and the repository isn't the default
1730                            {
1731                                CIMResponseMessage* response = req->buildResponse();
1732                                response->cimException =
1733                                    PEGASUS_CIM_EXCEPTION(CIM_ERR_NOT_SUPPORTED, 
1734                                                          "No provider found"   );
1735                        
1736                                //_enqueueResponse(request, response);
1737                        		return response;
1738                            }
1739                        
1740                            CIMResponseMessage* response = req->buildResponse();
1741                            response->cimException = PEGASUS_CIM_EXCEPTION(CIM_ERR_NOT_SUPPORTED, 
1742                        					                       "This msg should never happen.");
1743                            PEG_METHOD_EXIT();
1744 kamal.locahana 1.1.2.1     return response;
1745                        } // do_di_()
1746                        
1747                        
1748                        
1749                        
1750                        //---------------------------------------------------------------------
1751                        Message *CIMDirectAccessRep::do_mi_( CIMRequestMessage* request ) {
1752                            
1753                            PEG_METHOD_ENTER(TRC_DISPATCHER,"CIMDirectAccessRep::do_mi_()");
1754                            CIMModifyInstanceRequestMessage *req = 
1755                        			               (CIMModifyInstanceRequestMessage*)request;
1756                        
1757                            // ATTN: Who makes sure the instance name and the instance match?
1758                            // ATTN: KS May 28. Change following to reflect new instancelookup
1759                            // get the class name
1760                            CIMName className = req->modifiedInstance.getClassName();
1761                        
1762                            CIMException checkClassException;
1763                        
1764                            opreqdispatch_->_checkExistenceOfClass(req->nameSpace, className, 
1765 kamal.locahana 1.1.2.1                                            checkClassException);
1766                        
1767                            if (checkClassException.getCode() != CIM_ERR_SUCCESS)
1768                            {
1769                                PEG_LOGGER_TRACE((
1770                                    Logger::STANDARD_LOG,
1771                                    System::CIMSERVER,
1772                                    Logger::TRACE,
1773                                    "CIMDirectAccessRep::do_mi_() - "
1774                                        "CIM exist exception has occurred.  Namespace: $0  "
1775                                        "Class Name: $1",
1776                                    req->nameSpace.getString(),
1777                                    className.getString()));
1778                        
1779                                CIMResponseMessage* response = req->buildResponse();
1780                                response->cimException = checkClassException;
1781                        
1782                                //_enqueueResponse(request, response);
1783                        
1784                                PEG_METHOD_EXIT();
1785                                return response;
1786 kamal.locahana 1.1.2.1     }
1787                        
1788                            ProviderInfo providerInfo = 
1789                                opreqdispatch_->_lookupNewInstanceProvider( req->nameSpace,  
1790                                                                            className );
1791                        
1792                            if (providerInfo.hasProvider)
1793                            {
1794                                CIMModifyInstanceRequestMessage* requestCopy =    // fix?
1795                                    new CIMModifyInstanceRequestMessage(*req);
1796                                removePropagatedAndOriginAttributes(requestCopy->modifiedInstance);
1797                                if (providerInfo.providerIdContainer.get() != 0)
1798                                {
1799                                    requestCopy->operationContext.insert(
1800                                        *providerInfo.providerIdContainer.get());
1801                                }
1802                        
1803                                CIMModifyInstanceRequestMessage* requestCallbackCopy =
1804                                    new CIMModifyInstanceRequestMessage(*requestCopy);
1805                        
1806                                PEG_METHOD_EXIT();
1807 kamal.locahana 1.1.2.1         return forwardRequestToProvider_(
1808                                    providerInfo.className,
1809                                    providerInfo.serviceName,
1810                                    providerInfo.controlProviderName,
1811                                    requestCopy,
1812                                    requestCallbackCopy);
1813                            }
1814                            
1815                            else if (reposi_->isDefaultInstanceProvider())
1816                            {
1817                                // translate and forward request to repository
1818                                CIMException cimException;
1819                        
1820                                AutoPtr<CIMModifyInstanceResponseMessage> response(
1821                                    dynamic_cast<CIMModifyInstanceResponseMessage*>(
1822                                        req->buildResponse()));
1823                        
1824                                try
1825                                {
1826                                    removePropagatedAndOriginAttributes(req->modifiedInstance);
1827                        
1828 kamal.locahana 1.1.2.1             StatProviderTimeMeasurement providerTime(response.get());
1829                        
1830                                    reposi_->modifyInstance(
1831                                        req->nameSpace,
1832                                        req->modifiedInstance,
1833                                        req->includeQualifiers, req->propertyList,
1834                                        ((ContentLanguageListContainer)req->operationContext.get(
1835                                            ContentLanguageListContainer::NAME)).getLanguages());
1836                        
1837                                    PEG_LOGGER_TRACE((
1838                                        Logger::STANDARD_LOG,
1839                                        System::CIMSERVER,
1840                                        Logger::TRACE,
1841                                        "CIMDirectAccessRep::do_mi_() - "
1842                                            "Namespace: $0  Instance name: $1",
1843                                        req->nameSpace.getString(),
1844                                        req->modifiedInstance.getClassName().getString()));
1845                               }
1846                               catch (const CIMException& exception)
1847                               {
1848                                   cimException = exception;
1849 kamal.locahana 1.1.2.1        }
1850                               catch (const Exception& exception)
1851                               {
1852                                   cimException =
1853                                       PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED, exception.getMessage());
1854                               }
1855                               catch (...)
1856                               {
1857                                   cimException = PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED, String::EMPTY);
1858                               }
1859                        
1860                               response->cimException = cimException;
1861                               //_enqueueResponse(request, response.release());
1862                               return response.release();
1863                            }
1864                            
1865                            else // No provider is registered and the repository isn't the default
1866                            {
1867                                CIMResponseMessage* response = req->buildResponse();
1868                                response->cimException =
1869                                    PEGASUS_CIM_EXCEPTION(CIM_ERR_NOT_SUPPORTED, 
1870 kamal.locahana 1.1.2.1                                   "No provider found");
1871                        
1872                                //_enqueueResponse(request, response);
1873                                return response;
1874                            }
1875                        
1876                            CIMResponseMessage* response = req->buildResponse();
1877                            response->cimException = PEGASUS_CIM_EXCEPTION(CIM_ERR_NOT_SUPPORTED, 
1878                                                               "this msg should never happen");
1879                            PEG_METHOD_EXIT();
1880                            return response;
1881                        
1882                        } // do_mi_()
1883                        
1884                        
1885                        
1886                        
1887                        
1888                                          /*---------------------------------------
1889                                           *                                       *
1890                                           *                                       *
1891 kamal.locahana 1.1.2.1                    *       association & reference         *
1892                                           *                                       *
1893                                           *                                       *
1894                                           *---------------------------------------*/
1895                        
1896                        
1897                        
1898                        //---------------------------------------------------------------------------
1899                        Message *CIMDirectAccessRep::do_ea_( CIMRequestMessage* request){
1900                        		
1901                            PEG_METHOD_ENTER(TRC_DISPATCHER,
1902                                "CIMDirectAccessRep::handleAssociatorsRequest");
1903                            CIMAssociatorsRequestMessage *req=(CIMAssociatorsRequestMessage*)request;
1904                            if (!opreqdispatch_->_enableAssociationTraversal)
1905                            {
1906                                CIMResponseMessage* response = req->buildResponse();
1907                                response->cimException =
1908                                    PEGASUS_CIM_EXCEPTION(CIM_ERR_NOT_SUPPORTED, "Associators");
1909                        
1910                                //_enqueueResponse(request, response);
1911                        
1912 kamal.locahana 1.1.2.1         PEG_METHOD_EXIT();
1913                                return response;
1914                            }
1915                        
1916                            // Validate role parameter syntax
1917                            if ((req->role != String::EMPTY) && (!CIMName::legal(req->role)))
1918                            {
1919                                CIMResponseMessage* response = req->buildResponse();
1920                                response->cimException =
1921                                    PEGASUS_CIM_EXCEPTION(CIM_ERR_INVALID_PARAMETER, req->role);
1922                        
1923                                //_enqueueResponse(request, response);
1924                        
1925                                PEG_METHOD_EXIT();
1926                                return response;
1927                            }
1928                        
1929                            // Validate resultRole parameter syntax
1930                            if ((req->resultRole != String::EMPTY) &&
1931                                (!CIMName::legal(req->resultRole)))
1932                            {
1933 kamal.locahana 1.1.2.1         CIMResponseMessage* response = req->buildResponse();
1934                                response->cimException = PEGASUS_CIM_EXCEPTION(
1935                                    CIM_ERR_INVALID_PARAMETER, req->resultRole);
1936                        
1937                                //_enqueueResponse(request, response);
1938                        
1939                                PEG_METHOD_EXIT();
1940                                return response;
1941                            }
1942                        
1943                            CIMException checkClassException;
1944                            opreqdispatch_->_checkExistenceOfClass(req->nameSpace,
1945                                                   req->objectName.getClassName(),
1946                                                   checkClassException);
1947                            if (checkClassException.getCode() != CIM_ERR_SUCCESS)
1948                            {
1949                                if (checkClassException.getCode() == CIM_ERR_INVALID_CLASS)
1950                                {
1951                                    checkClassException = PEGASUS_CIM_EXCEPTION(
1952                                        CIM_ERR_INVALID_PARAMETER, req->objectName.toString());
1953                                }
1954 kamal.locahana 1.1.2.1 
1955                                CIMResponseMessage* response = req->buildResponse();
1956                                response->cimException = checkClassException;
1957                        
1958                                //_enqueueResponse(request, response);
1959                        
1960                                PEG_METHOD_EXIT();
1961                                return response;
1962                            }
1963                        
1964                            PEG_LOGGER_TRACE((Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE,
1965                                "CIMDirectAccessRep::handleAssociators - "
1966                                    "Namespace: $0  Class name: $1",
1967                                req->nameSpace.getString(),
1968                                req->objectName.toString()));
1969                        
1970                            //  ATTN-CAKG-P2-20020726:  The following condition does not correctly
1971                            //  distinguish instanceNames from classNames in every case
1972                            //  The instanceName of a singleton instance of a keyless class also
1973                            //  has no key bindings
1974                            Boolean isClassRequest =
1975 kamal.locahana 1.1.2.1         (req->objectName.getKeyBindings().size() == 0) ? true : false;
1976                        
1977                            if (isClassRequest)
1978                            {
1979                                //
1980                                // For Class requests, get the results from the repository
1981                                //
1982                        
1983                                Tracer::trace(TRC_DISPATCHER, Tracer::LEVEL4,
1984                                              "Associators executing Class request");
1985                        
1986                                AutoPtr<CIMAssociatorsResponseMessage> response(
1987                                    dynamic_cast<CIMAssociatorsResponseMessage*>(
1988                                        req->buildResponse()));
1989                        
1990                                try
1991                                {
1992                                    //StatProviderTimeMeasurement providerTime(response.get());
1993                        
1994                                    response->cimObjects = reposi_->associators(
1995                                        req->nameSpace,
1996 kamal.locahana 1.1.2.1                 req->objectName,
1997                                        req->assocClass,
1998                                        req->resultClass,
1999                                        req->role,
2000                                        req->resultRole,
2001                                        req->includeQualifiers,
2002                                        req->includeClassOrigin,
2003                                        req->propertyList);
2004                                }
2005                                catch (const CIMException& exception)
2006                                {
2007                                    response->cimException = exception;
2008                                }
2009                                catch (const Exception& exception)
2010                                {
2011                                    response->cimException = PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED,
2012                                                                         exception.getMessage());
2013                                }
2014                                catch (...)
2015                                {
2016                                    response->cimException = PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED,
2017 kamal.locahana 1.1.2.1                                                  String::EMPTY);
2018                                }
2019                        
2020                                //_enqueueResponse(request, response.release());
2021                        		return response.release();
2022                            }
2023                            else
2024                            {
2025                                //
2026                                // For Instance requests, get results from providers and the repository
2027                                //
2028                        
2029                                //
2030                                // Determine list of providers for this request
2031                                //
2032                        
2033                                Array<ProviderInfo> providerInfos;
2034                                Uint32 providerCount;
2035                                try
2036                                {
2037                                    providerInfos = opreqdispatch_->_lookupAllAssociationProviders(
2038 kamal.locahana 1.1.2.1                 req->nameSpace,
2039                                        req->objectName,
2040                                        req->assocClass,
2041                                        String::EMPTY,
2042                                        providerCount);
2043                                }
2044                                catch (const CIMException& cimException)
2045                                {
2046                                    CIMResponseMessage* response = req->buildResponse();
2047                                    response->cimException = cimException;
2048                                    //_enqueueResponse(request, response);
2049                                    PEG_METHOD_EXIT();
2050                                    return response;
2051                                }
2052                        
2053                                Tracer::trace(TRC_DISPATCHER, Tracer::LEVEL4,
2054                                              "providerCount = %u.", providerCount);
2055                        
2056                                // If no provider is registered and the repository isn't the default,
2057                                // return CIM_ERR_NOT_SUPPORTED
2058                        
2059 kamal.locahana 1.1.2.1         if ((providerCount == 0) && !reposi_->isDefaultInstanceProvider())
2060                                {
2061                                    PEG_TRACE_STRING(
2062                                        TRC_DISPATCHER,
2063                                        Tracer::LEVEL4,
2064                                        "CIM_ERR_NOT_SUPPORTED for " + req->className.getString());
2065                        
2066                                    CIMResponseMessage* response = req->buildResponse();
2067                                    response->cimException =
2068                                        PEGASUS_CIM_EXCEPTION(CIM_ERR_NOT_SUPPORTED, String::EMPTY);
2069                        
2070                                    //_enqueueResponse(request, response);
2071                        
2072                                    PEG_METHOD_EXIT();
2073                                    return response;
2074                                }
2075                        
2076                                //
2077                                // Get the instances from the repository, as necessary
2078                                //
2079                        
2080 kamal.locahana 1.1.2.1         // Hold the repository results in a response message.
2081                                // If not using the repository, this pointer is null.
2082                                AutoPtr<CIMAssociatorsResponseMessage> response;
2083                        
2084                                if (reposi_->isDefaultInstanceProvider())
2085                                {
2086                                    response.reset(dynamic_cast<CIMAssociatorsResponseMessage*>(
2087                                        req->buildResponse()));
2088                        
2089                                    try
2090                                    {
2091                                        //StatProviderTimeMeasurement providerTime(response.get());
2092                        
2093                                        response->cimObjects = reposi_->associators(
2094                                            req->nameSpace,
2095                                            req->objectName,
2096                                            req->assocClass,
2097                                            req->resultClass,
2098                                            req->role,
2099                                            req->resultRole,
2100                                            req->includeQualifiers,
2101 kamal.locahana 1.1.2.1                     req->includeClassOrigin,
2102                                            req->propertyList);
2103                                    }
2104                                    catch (const CIMException& exception)
2105                                    {
2106                                        response->cimException = exception;
2107                                    }
2108                                    catch (const Exception& exception)
2109                                    {
2110                                        response->cimException = PEGASUS_CIM_EXCEPTION(
2111                                            CIM_ERR_FAILED, exception.getMessage());
2112                                    }
2113                                    catch (...)
2114                                    {
2115                                        response->cimException = PEGASUS_CIM_EXCEPTION(
2116                                            CIM_ERR_FAILED, String::EMPTY);
2117                                    }
2118                        
2119                                    Tracer::trace(TRC_DISPATCHER, Tracer::LEVEL4,
2120                                        "Associators repository access: class = %s, count = %u.",
2121                                            (const char*)req->objectName.toString().getCString(),
2122 kamal.locahana 1.1.2.1                     response->cimObjects.size());
2123                                }
2124                        
2125                                //
2126                                // If we have no providers to call, just return what we've got
2127                                //
2128                        
2129                                if (providerCount == 0)
2130                                {
2131                                     //_enqueueResponse(request, response.release());
2132                                     PEG_METHOD_EXIT();
2133                                     return response.release();
2134                                }
2135                        
2136                                //
2137                                // Set up an aggregate object and save the original request message
2138                                //
2139                        
2140                                OperationAggregate* poA = new OperationAggregate(
2141                                    new CIMAssociatorsRequestMessage(*req),
2142                                    req->getType(),
2143 kamal.locahana 1.1.2.1             req->messageId,
2144                                    req->queueIds.top(),
2145                                    req->objectName.getClassName(),
2146                                    req->nameSpace);
2147                        
2148                                //poA->_aggregationSN = cimOperationAggregationSN++;
2149                        
2150                                // Include the repository response in the aggregation, if applicable
2151                                if (response.get() != 0)
2152                                {
2153                                    poA->setTotalIssued(providerCount+1);
2154                                    // send the repository's results
2155                                    return forwardRequestForAggregation_(
2156                                        String(PEGASUS_QUEUENAME_OPREQDISPATCHER),
2157                                        String(),
2158                                        new CIMAssociatorsRequestMessage(*req),
2159                                        poA,
2160                                        response.release());
2161                                }
2162                                else
2163                                {
2164 kamal.locahana 1.1.2.1             poA->setTotalIssued(providerCount);
2165                                }
2166                                for (Uint32 i = 0; i < providerInfos.size(); i++)
2167                                {
2168                                    if (providerInfos[i].hasProvider)
2169                                    {
2170                                        CIMAssociatorsRequestMessage* requestCopy =
2171                                            new CIMAssociatorsRequestMessage(*req);
2172                                        // Insert the association class name to limit the provider
2173                                        // to this class.
2174                                        requestCopy->assocClass = providerInfos[i].className;
2175                        
2176                                        if (providerInfos[i].providerIdContainer.get() != 0)
2177                                            requestCopy->operationContext.insert(
2178                                                *(providerInfos[i].providerIdContainer.get()));
2179                        
2180                                        PEG_TRACE_STRING(TRC_DISPATCHER, Tracer::LEVEL4,
2181                                            "Forwarding to provider for class " +
2182                                            providerInfos[i].className.getString());
2183                                        forwardRequestForAggregation_(providerInfos[i].serviceName,
2184                                            providerInfos[i].controlProviderName, requestCopy, poA);
2185 kamal.locahana 1.1.2.1                 // Note: poA must not be referenced after last "forwardRequest"
2186                                    }
2187                                }
2188                            }  // End of instance processing
2189                        
2190                            PEG_METHOD_EXIT();
2191                            return NULL;               //fix
2192                        } // do_ea_()
2193                        
2194                        
2195                        
2196                        
2197                        //---------------------------------------------------------------------
2198                        Message *CIMDirectAccessRep::do_ean_(CIMRequestMessage* request){
2199                            PEG_METHOD_ENTER(TRC_DISPATCHER,
2200                                "CIMDirectAccessRep::handleAssociatorNamesRequest");
2201                            CIMAssociatorNamesRequestMessage *req=(CIMAssociatorNamesRequestMessage*)request;
2202                            if (!opreqdispatch_->_enableAssociationTraversal)
2203                            {
2204                                CIMResponseMessage* response = req->buildResponse();
2205                                response->cimException =
2206 kamal.locahana 1.1.2.1             PEGASUS_CIM_EXCEPTION(CIM_ERR_NOT_SUPPORTED, "AssociatorNames");
2207                        
2208                                //_enqueueResponse(request, response);
2209                        
2210                                PEG_METHOD_EXIT();
2211                                return response;
2212                            }
2213                        
2214                            // Validate role parameter syntax
2215                            if ((req->role != String::EMPTY) && (!CIMName::legal(req->role)))
2216                            {
2217                                CIMResponseMessage* response = req->buildResponse();
2218                                response->cimException =
2219                                    PEGASUS_CIM_EXCEPTION(CIM_ERR_INVALID_PARAMETER, req->role);
2220                        
2221                                //_enqueueResponse(request, response);
2222                        
2223                                PEG_METHOD_EXIT();
2224                                return response;
2225                            }
2226                        
2227 kamal.locahana 1.1.2.1     // Validate resultRole parameter syntax
2228                            if ((req->resultRole != String::EMPTY) &&
2229                                (!CIMName::legal(req->resultRole)))
2230                            {
2231                                CIMResponseMessage* response = req->buildResponse();
2232                                response->cimException = PEGASUS_CIM_EXCEPTION(
2233                                    CIM_ERR_INVALID_PARAMETER, req->resultRole);
2234                        
2235                                //_enqueueResponse(request, response);
2236                        
2237                                PEG_METHOD_EXIT();
2238                                return response;
2239                            }
2240                        
2241                            CIMException checkClassException;
2242                            opreqdispatch_->_checkExistenceOfClass(req->nameSpace,
2243                                                   req->objectName.getClassName(),
2244                                                   checkClassException);
2245                            if (checkClassException.getCode() != CIM_ERR_SUCCESS)
2246                            {
2247                                if (checkClassException.getCode() == CIM_ERR_INVALID_CLASS)
2248 kamal.locahana 1.1.2.1         {
2249                                    checkClassException = PEGASUS_CIM_EXCEPTION(
2250                                        CIM_ERR_INVALID_PARAMETER, req->objectName.toString());
2251                                }
2252                        
2253                                CIMResponseMessage* response = req->buildResponse();
2254                                response->cimException = checkClassException;
2255                        
2256                                //_enqueueResponse(request, response);
2257                        
2258                                PEG_METHOD_EXIT();
2259                                return response;
2260                            }
2261                        
2262                            PEG_LOGGER_TRACE((Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE,
2263                                "CIMDirectAccessRep::handleAssociatorNames - "
2264                                    "Namespace: $0  Class name: $1",
2265                                req->nameSpace.getString(),
2266                                req->objectName.toString()));
2267                        
2268                            //  ATTN-CAKG-P2-20020726:  The following condition does not correctly
2269 kamal.locahana 1.1.2.1     //  distinguish instanceNames from classNames in every case
2270                            //  The instanceName of a singleton instance of a keyless class also
2271                            //  has no key bindings
2272                            Boolean isClassRequest =
2273                                (req->objectName.getKeyBindings().size() == 0) ? true : false;
2274                        
2275                            if (isClassRequest)
2276                            {
2277                                //
2278                                // For Class requests, get the results from the repository
2279                                //
2280                        
2281                                Tracer::trace(TRC_DISPATCHER, Tracer::LEVEL4,
2282                                              "AssociatorNames executing Class request");
2283                        
2284                                AutoPtr<CIMAssociatorNamesResponseMessage> response(
2285                                    dynamic_cast<CIMAssociatorNamesResponseMessage*>(
2286                                        req->buildResponse()));
2287                        
2288                                try
2289                                {
2290 kamal.locahana 1.1.2.1             //StatProviderTimeMeasurement providerTime(response.get());
2291                        
2292                                    response->objectNames = reposi_->associatorNames(
2293                                        req->nameSpace,
2294                                        req->objectName,
2295                                        req->assocClass,
2296                                        req->resultClass,
2297                                        req->role,
2298                                        req->resultRole);
2299                                }
2300                                catch (const CIMException& exception)
2301                                {
2302                                    response->cimException = exception;
2303                                }
2304                                catch (const Exception& exception)
2305                                {
2306                                    response->cimException = PEGASUS_CIM_EXCEPTION(
2307                                        CIM_ERR_FAILED, exception.getMessage());
2308                                }
2309                                catch (...)
2310                                {
2311 kamal.locahana 1.1.2.1             response->cimException = PEGASUS_CIM_EXCEPTION(
2312                                        CIM_ERR_FAILED, String::EMPTY);
2313                                }
2314                        
2315                                //_enqueueResponse(request, response.release());
2316                        		return response.release();
2317                            }
2318                            else
2319                            {
2320                                //
2321                                // For Instance requests, get results from providers and the repository
2322                                //
2323                        
2324                                //
2325                                // Determine list of providers for this request
2326                                //
2327                        
2328                                Array<ProviderInfo> providerInfos;
2329                                Uint32 providerCount;
2330                                try
2331                                {
2332 kamal.locahana 1.1.2.1             providerInfos = opreqdispatch_->_lookupAllAssociationProviders(
2333                                        req->nameSpace,
2334                                        req->objectName,
2335                                        req->assocClass,
2336                                        String::EMPTY,
2337                                        providerCount);
2338                                }
2339                                catch (const CIMException& cimException)
2340                                {
2341                                    CIMResponseMessage* response = req->buildResponse();
2342                                    response->cimException = cimException;
2343                        
2344                                    //_enqueueResponse(request, response);
2345                                    PEG_METHOD_EXIT();
2346                                    return response;
2347                                }
2348                        
2349                                Tracer::trace(TRC_DISPATCHER, Tracer::LEVEL4,
2350                                              "providerCount = %u.", providerCount);
2351                        
2352                                // If no provider is registered and the repository isn't the default,
2353 kamal.locahana 1.1.2.1         // return CIM_ERR_NOT_SUPPORTED
2354                        
2355                                if ((providerCount == 0) && !reposi_->isDefaultInstanceProvider())
2356                                {
2357                                    PEG_TRACE_STRING(
2358                                        TRC_DISPATCHER,
2359                                        Tracer::LEVEL4,
2360                                        "CIM_ERR_NOT_SUPPORTED for " + req->className.getString());
2361                        
2362                                    CIMResponseMessage* response = req->buildResponse();
2363                                    response->cimException =
2364                                        PEGASUS_CIM_EXCEPTION(CIM_ERR_NOT_SUPPORTED, String::EMPTY);
2365                        
2366                                    //_enqueueResponse(request, response);
2367                        
2368                                    PEG_METHOD_EXIT();
2369                                    return response;
2370                                }
2371                        
2372                                //
2373                                // Get the instances from the repository, as necessary
2374 kamal.locahana 1.1.2.1         //
2375                        
2376                                // Hold the repository results in a response message.
2377                                // If not using the repository, this pointer is null.
2378                                AutoPtr<CIMAssociatorNamesResponseMessage> response;
2379                        
2380                                if (reposi_->isDefaultInstanceProvider())
2381                                {
2382                                    response.reset(dynamic_cast<CIMAssociatorNamesResponseMessage*>(
2383                                        req->buildResponse()));
2384                        
2385                                    try
2386                                    {
2387                                        //StatProviderTimeMeasurement providerTime(response.get());
2388                        
2389                                        response->objectNames = reposi_->associatorNames(
2390                                            req->nameSpace,
2391                                            req->objectName,
2392                                            req->assocClass,
2393                                            req->resultClass,
2394                                            req->role,
2395 kamal.locahana 1.1.2.1                     req->resultRole);
2396                                    }
2397                                    catch (const CIMException& exception)
2398                                    {
2399                                        response->cimException = exception;
2400                                    }
2401                                    catch (const Exception& exception)
2402                                    {
2403                                        response->cimException = PEGASUS_CIM_EXCEPTION(
2404                                            CIM_ERR_FAILED, exception.getMessage());
2405                                    }
2406                                    catch (...)
2407                                    {
2408                                        response->cimException = PEGASUS_CIM_EXCEPTION(
2409                                            CIM_ERR_FAILED, String::EMPTY);
2410                                    }
2411                        
2412                                    Tracer::trace(TRC_DISPATCHER, Tracer::LEVEL4,
2413                                        "AssociatorNames repository access: class = %s, count = %u.",
2414                                            (const char*)req->objectName.toString().getCString(),
2415                                            response->objectNames.size());
2416 kamal.locahana 1.1.2.1         }
2417                        
2418                                //
2419                                // If we have no providers to call, just return what we've got
2420                                //
2421                        
2422                                if (providerCount == 0)
2423                                {
2424                                     //_enqueueResponse(request, response.release());
2425                                     PEG_METHOD_EXIT();
2426                                     return response.release();
2427                                }
2428                        
2429                                //
2430                                // Set up an aggregate object and save the original request message
2431                                //
2432                        
2433                                OperationAggregate* poA = new OperationAggregate(
2434                                    new CIMAssociatorNamesRequestMessage(*req),
2435                                    req->getType(),
2436                                    req->messageId,
2437 kamal.locahana 1.1.2.1             req->queueIds.top(),
2438                                    req->objectName.getClassName(),
2439                                    req->nameSpace);
2440                        
2441                                 //poA->_aggregationSN = cimOperationAggregationSN++;
2442                        
2443                                 // Include the repository response in the aggregation, if applicable
2444                                 if (response.get() != 0)
2445                                {
2446                                    poA->setTotalIssued(providerCount+1);
2447                                    // send the repository's results
2448                                    return forwardRequestForAggregation_(
2449                                        String(PEGASUS_QUEUENAME_OPREQDISPATCHER),
2450                                        String(),
2451                                        new CIMAssociatorNamesRequestMessage(*req),
2452                                        poA,
2453                                        response.release());
2454                                }
2455                                else
2456                                {
2457                                    poA->setTotalIssued(providerCount);
2458 kamal.locahana 1.1.2.1         }
2459                        
2460                        		
2461                                for (Uint32 i = 0; i < providerInfos.size(); i++)
2462                                {
2463                                    if (providerInfos[i].hasProvider)
2464                                    {
2465                                        CIMAssociatorNamesRequestMessage* requestCopy =
2466                                            new CIMAssociatorNamesRequestMessage(*req);
2467                                        // Insert the association class name to limit the provider
2468                                        // to this class.
2469                                        requestCopy->assocClass = providerInfos[i].className;
2470                        
2471                                        if (providerInfos[i].providerIdContainer.get() != 0)
2472                                            requestCopy->operationContext.insert(
2473                                                *(providerInfos[i].providerIdContainer.get()));
2474                        
2475                                        PEG_TRACE_STRING(TRC_DISPATCHER, Tracer::LEVEL4,
2476                                            "Forwarding to provider for class " +
2477                                            providerInfos[i].className.getString());
2478                                        forwardRequestForAggregation_(providerInfos[i].serviceName,    // fix
2479 kamal.locahana 1.1.2.1                     providerInfos[i].controlProviderName, requestCopy, poA);
2480                                        // Note: poA must not be referenced after last "forwardRequest"
2481                                    }
2482                                }
2483                            }  // End of instance processing
2484                        
2485                            PEG_METHOD_EXIT();
2486                            return NULL;             // fix
2487                        } // do_ean_()
2488                        
2489                        
2490                        
2491                        
2492                        //-----------------------------------------------------------------
2493                        Message *CIMDirectAccessRep::do_er_( CIMRequestMessage* request){
2494                            PEG_METHOD_ENTER(TRC_DISPATCHER,
2495                                "CIMDirectAccessRep::handleReferencesRequest");
2496                            CIMReferencesRequestMessage *req = (CIMReferencesRequestMessage*)request;
2497                            if (!opreqdispatch_->_enableAssociationTraversal)
2498                            {
2499                                CIMResponseMessage* response = req->buildResponse();
2500 kamal.locahana 1.1.2.1         response->cimException =
2501                                    PEGASUS_CIM_EXCEPTION(CIM_ERR_NOT_SUPPORTED, "References");
2502                        
2503                                //_enqueueResponse(request, response);
2504                        
2505                                PEG_METHOD_EXIT();
2506                                return response;
2507                            }
2508                        
2509                            // Validate role parameter syntax
2510                            if ((req->role != String::EMPTY) && (!CIMName::legal(req->role)))
2511                            {
2512                                CIMResponseMessage* response = req->buildResponse();
2513                                response->cimException =
2514                                    PEGASUS_CIM_EXCEPTION(CIM_ERR_INVALID_PARAMETER, req->role);
2515                        
2516                                //_enqueueResponse(request, response);
2517                        
2518                                PEG_METHOD_EXIT();
2519                                return response;
2520                            }
2521 kamal.locahana 1.1.2.1 
2522                            CIMException checkClassException;
2523                            opreqdispatch_->_checkExistenceOfClass(
2524                                req->nameSpace,
2525                                req->objectName.getClassName(),
2526                                checkClassException);
2527                            if (checkClassException.getCode() != CIM_ERR_SUCCESS)
2528                            {
2529                                if (checkClassException.getCode() == CIM_ERR_INVALID_CLASS)
2530                                {
2531                                    checkClassException = PEGASUS_CIM_EXCEPTION(
2532                                        CIM_ERR_INVALID_PARAMETER, req->objectName.toString());
2533                                }
2534                        
2535                                CIMResponseMessage* response = req->buildResponse();
2536                                response->cimException = checkClassException;
2537                        
2538                                //_enqueueResponse(request, response);
2539                        
2540                                PEG_METHOD_EXIT();
2541                                return response;
2542 kamal.locahana 1.1.2.1     }
2543                        
2544                            PEG_LOGGER_TRACE((Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE,
2545                                "CIMDirectAccessRep::handleReferences - "
2546                                    "Namespace: $0  Class name: $1",
2547                                req->nameSpace.getString(),
2548                                req->objectName.toString()));
2549                        
2550                            //  ATTN-CAKG-P2-20020726:  The following condition does not correctly
2551                            //  distinguish instanceNames from classNames in every case
2552                            //  The instanceName of a singleton instance of a keyless class also
2553                            //  has no key bindings
2554                            Boolean isClassRequest =
2555                                (req->objectName.getKeyBindings().size() == 0) ? true : false;
2556                        
2557                            if (isClassRequest)
2558                            {
2559                                //
2560                                // For Class requests, get the results from the repository
2561                                //
2562                        
2563 kamal.locahana 1.1.2.1         Tracer::trace(TRC_DISPATCHER, Tracer::LEVEL4,
2564                                              "References executing Class request");
2565                        
2566                                AutoPtr<CIMReferencesResponseMessage> response(
2567                                    dynamic_cast<CIMReferencesResponseMessage*>(
2568                                        req->buildResponse()));
2569                        
2570                                try
2571                                {
2572                                    //StatProviderTimeMeasurement providerTime(response.get());
2573                        
2574                                    response->cimObjects = reposi_->references(
2575                                        req->nameSpace,
2576                                        req->objectName,
2577                                        req->resultClass,
2578                                        req->role,
2579                                        req->includeQualifiers,
2580                                        req->includeClassOrigin,
2581                                        req->propertyList);
2582                                }
2583                                catch (const CIMException& exception)
2584 kamal.locahana 1.1.2.1         {
2585                                    response->cimException = exception;
2586                                }
2587                                catch (const Exception& exception)
2588                                {
2589                                    response->cimException = PEGASUS_CIM_EXCEPTION(
2590                                        CIM_ERR_FAILED, exception.getMessage());
2591                                }
2592                                catch (...)
2593                                {
2594                                    response->cimException = PEGASUS_CIM_EXCEPTION(
2595                                        CIM_ERR_FAILED, String::EMPTY);
2596                                }
2597                        
2598                                //_enqueueResponse(request, response.release());
2599                        		return response.release();
2600                            }
2601                            else
2602                            {
2603                                //
2604                                // For Instance requests, get results from providers and the repository
2605 kamal.locahana 1.1.2.1         //
2606                        
2607                                //
2608                                // Determine list of providers for this request
2609                                //
2610                        
2611                                Array<ProviderInfo> providerInfos;
2612                                Uint32 providerCount;
2613                                try
2614                                {
2615                                    providerInfos = opreqdispatch_->_lookupAllAssociationProviders(
2616                                        req->nameSpace,
2617                                        req->objectName,
2618                                        req->resultClass,
2619                                        String::EMPTY,
2620                                        providerCount);
2621                                }
2622                                catch (const CIMException& cimException)
2623                                {
2624                                    CIMResponseMessage* response = request->buildResponse();
2625                                    response->cimException = cimException;
2626 kamal.locahana 1.1.2.1 
2627                                    //_enqueueResponse(request, response);
2628                                    PEG_METHOD_EXIT();
2629                                    return response;
2630                                }
2631                        
2632                                Tracer::trace(TRC_DISPATCHER, Tracer::LEVEL4,
2633                                              "providerCount = %u.", providerCount);
2634                        
2635                                // If no provider is registered and the repository isn't the default,
2636                                // return CIM_ERR_NOT_SUPPORTED
2637                        
2638                                if ((providerCount == 0) && !reposi_->isDefaultInstanceProvider())
2639                                {
2640                                    PEG_TRACE_STRING(
2641                                        TRC_DISPATCHER,
2642                                        Tracer::LEVEL4,
2643                                        "CIM_ERR_NOT_SUPPORTED for " + req->className.getString());
2644                        
2645                                    CIMResponseMessage* response = req->buildResponse();
2646                                    response->cimException =
2647 kamal.locahana 1.1.2.1                 PEGASUS_CIM_EXCEPTION(CIM_ERR_NOT_SUPPORTED, String::EMPTY);
2648                        
2649                                    //_enqueueResponse(request, response);
2650                        
2651                                    PEG_METHOD_EXIT();
2652                                    return response;
2653                        		}
2654                        
2655                                //
2656                                // Get the instances from the repository, as necessary
2657                                //
2658                        
2659                                // Hold the repository results in a response message.
2660                                // If not using the repository, this pointer is null.
2661                                AutoPtr<CIMReferencesResponseMessage> response;
2662                        
2663                                if (reposi_->isDefaultInstanceProvider())
2664                                {
2665                                    response.reset(dynamic_cast<CIMReferencesResponseMessage*>(
2666                                        req->buildResponse()));
2667                        
2668 kamal.locahana 1.1.2.1             try
2669                                    {
2670                                        //StatProviderTimeMeasurement providerTime(response.get());
2671                        
2672                                        response->cimObjects = reposi_->references(
2673                                            req->nameSpace,
2674                                            req->objectName,
2675                                            req->resultClass,
2676                                            req->role,
2677                                            req->includeQualifiers,
2678                                            req->includeClassOrigin,
2679                                            req->propertyList);
2680                                    }
2681                                    catch (const CIMException& exception)
2682                                    {
2683                                        response->cimException = exception;
2684                                    }
2685                                    catch (const Exception& exception)
2686                                    {
2687                                        response->cimException = PEGASUS_CIM_EXCEPTION(
2688                                            CIM_ERR_FAILED, exception.getMessage());
2689 kamal.locahana 1.1.2.1             }
2690                                    catch (...)
2691                                    {
2692                                        response->cimException = PEGASUS_CIM_EXCEPTION(
2693                                            CIM_ERR_FAILED, String::EMPTY);
2694                                    }
2695                        
2696                                    Tracer::trace(TRC_DISPATCHER, Tracer::LEVEL4,
2697                                        "References repository access: class = %s, count = %u.",
2698                                            (const char*)req->objectName.toString().getCString(),
2699                                            response->cimObjects.size());
2700                                }
2701                        
2702                                //
2703                                // If we have no providers to call, just return what we've got
2704                                //
2705                        
2706                                if (providerCount == 0)
2707                                {
2708                                     //_enqueueResponse(request, response.release());
2709                                     PEG_METHOD_EXIT();
2710 kamal.locahana 1.1.2.1              return response.release();
2711                                }
2712                        
2713                                //
2714                                // Set up an aggregate object and save the original request message
2715                                //
2716                        
2717                                OperationAggregate* poA = new OperationAggregate(
2718                                    new CIMReferencesRequestMessage(*req),
2719                                    req->getType(),
2720                                    req->messageId,
2721                                    req->queueIds.top(),
2722                                    req->objectName.getClassName(),
2723                                    req->nameSpace);
2724                        
2725                                 //poA->_aggregationSN = cimOperationAggregationSN++;
2726                        
2727                                // Include the repository response in the aggregation, if applicable
2728                                if (response.get() != 0)
2729                                {
2730                                    poA->setTotalIssued(providerCount+1);
2731 kamal.locahana 1.1.2.1             // send the repository's results
2732                                    return forwardRequestForAggregation_(
2733                                        String(PEGASUS_QUEUENAME_OPREQDISPATCHER),
2734                                        String(),
2735                                        new CIMReferencesRequestMessage(*req),
2736                                        poA,
2737                                        response.release());
2738                                }
2739                                else
2740                                {
2741                                    poA->setTotalIssued(providerCount);
2742                                }
2743                        
2744                        		
2745                                for (Uint32 i = 0; i < providerInfos.size(); i++)
2746                                {
2747                                    if (providerInfos[i].hasProvider)
2748                                    {
2749                                        CIMReferencesRequestMessage* requestCopy =
2750                                            new CIMReferencesRequestMessage(*req);
2751                                        // Insert the association class name to limit the provider
2752 kamal.locahana 1.1.2.1                 // to this class.
2753                                        requestCopy->resultClass = providerInfos[i].className;
2754                        
2755                                        if (providerInfos[i].providerIdContainer.get() != 0)
2756                                            requestCopy->operationContext.insert(
2757                                                *(providerInfos[i].providerIdContainer.get()));
2758                        
2759                                        PEG_TRACE_STRING(TRC_DISPATCHER, Tracer::LEVEL4,
2760                                            "Forwarding to provider for class " +
2761                                            providerInfos[i].className.getString());
2762                                        forwardRequestForAggregation_(providerInfos[i].serviceName,     // fix
2763                                            providerInfos[i].controlProviderName, requestCopy, poA);
2764                                        // Note: poA must not be referenced after last "forwardRequest"
2765                                    }
2766                                }
2767                            }  // End of instance processing
2768                        
2769                            PEG_METHOD_EXIT();
2770                            return NULL;
2771                        } // do_er_()
2772                        
2773 kamal.locahana 1.1.2.1 
2774                        
2775                        
2776                        //--------------------------------------------------------------------
2777                        Message *CIMDirectAccessRep::do_ern_( CIMRequestMessage* request){
2778                            PEG_METHOD_ENTER(TRC_DISPATCHER,
2779                                "CIMDirectAccessRep::handleReferenceNamesRequest");
2780                            CIMReferenceNamesRequestMessage *req = 
2781                        			                (CIMReferenceNamesRequestMessage*)request;
2782                            if (!opreqdispatch_->_enableAssociationTraversal)
2783                            {
2784                                CIMResponseMessage* response = req->buildResponse();
2785                                response->cimException =
2786                                    PEGASUS_CIM_EXCEPTION(CIM_ERR_NOT_SUPPORTED, "ReferenceNames");
2787                        
2788                                //_enqueueResponse(request, response);
2789                        
2790                                PEG_METHOD_EXIT();
2791                                return response;
2792                            }
2793                        
2794 kamal.locahana 1.1.2.1     // Validate role parameter syntax
2795                            if ((req->role != String::EMPTY) && (!CIMName::legal(req->role)))
2796                            {
2797                                CIMResponseMessage* response = req->buildResponse();
2798                                response->cimException =
2799                                    PEGASUS_CIM_EXCEPTION(CIM_ERR_INVALID_PARAMETER, req->role);
2800                        
2801                                //_enqueueResponse(request, response);
2802                        
2803                                PEG_METHOD_EXIT();
2804                                return response;
2805                            }
2806                        
2807                            CIMException checkClassException;
2808                            opreqdispatch_->_checkExistenceOfClass(req->nameSpace,
2809                                                   req->objectName.getClassName(),
2810                                                   checkClassException);
2811                            if (checkClassException.getCode() != CIM_ERR_SUCCESS)
2812                            {
2813                                if (checkClassException.getCode() == CIM_ERR_INVALID_CLASS)
2814                                {
2815 kamal.locahana 1.1.2.1             checkClassException = PEGASUS_CIM_EXCEPTION(
2816                                        CIM_ERR_INVALID_PARAMETER, req->objectName.toString());
2817                                }
2818                        
2819                                CIMResponseMessage* response = req->buildResponse();
2820                                response->cimException = checkClassException;
2821                        
2822                                //_enqueueResponse(request, response);
2823                        
2824                                PEG_METHOD_EXIT();
2825                                return response;
2826                            }
2827                        
2828                            PEG_LOGGER_TRACE((Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE,
2829                                "CIMDirectAccessRep::handleReferenceNames - "
2830                                    "Namespace: $0  Class name: $1",
2831                                req->nameSpace.getString(),
2832                                req->objectName.toString()));
2833                        
2834                            //  ATTN-CAKG-P2-20020726:  The following condition does not correctly
2835                            //  distinguish instanceNames from classNames in every case
2836 kamal.locahana 1.1.2.1     //  The instanceName of a singleton instance of a keyless class also
2837                            //  has no key bindings
2838                            Boolean isClassRequest =
2839                                (req->objectName.getKeyBindings().size() == 0) ? true : false;
2840                        
2841                            if (isClassRequest)
2842                            {
2843                                //
2844                                // For Class requests, get the results from the repository
2845                                //
2846                        
2847                                Tracer::trace(TRC_DISPATCHER, Tracer::LEVEL4,
2848                                              "ReferenceNames executing Class request");
2849                        
2850                                AutoPtr<CIMReferenceNamesResponseMessage> response(
2851                                    dynamic_cast<CIMReferenceNamesResponseMessage*>(
2852                                        req->buildResponse()));
2853                        
2854                                try
2855                                {
2856                                    //StatProviderTimeMeasurement providerTime(response.get());
2857 kamal.locahana 1.1.2.1 
2858                                    response->objectNames = reposi_->referenceNames(
2859                                        req->nameSpace,
2860                                        req->objectName,
2861                                        req->resultClass,
2862                                        req->role);
2863                                }
2864                                catch (const CIMException& exception)
2865                                {
2866                                    response->cimException = exception;
2867                                }
2868                                catch (const Exception& exception)
2869                                {
2870                                    response->cimException = PEGASUS_CIM_EXCEPTION(
2871                                        CIM_ERR_FAILED, exception.getMessage());
2872                                }
2873                                catch (...)
2874                                {
2875                                    response->cimException = PEGASUS_CIM_EXCEPTION(
2876                                        CIM_ERR_FAILED, String::EMPTY);
2877                                }
2878 kamal.locahana 1.1.2.1 
2879                                //_enqueueResponse(request, response.release());
2880                        		return response.release();
2881                            }
2882                            else
2883                            {
2884                                //
2885                                // For Instance requests, get results from providers and the repository
2886                                //
2887                        
2888                                //
2889                                // Determine list of providers for this request
2890                                //
2891                        
2892                                Array<ProviderInfo> providerInfos;
2893                                Uint32 providerCount;
2894                                try
2895                                {
2896                                    providerInfos = opreqdispatch_->_lookupAllAssociationProviders(
2897                                        req->nameSpace,
2898                                        req->objectName,
2899 kamal.locahana 1.1.2.1                 req->resultClass,
2900                                        String::EMPTY,
2901                                        providerCount);
2902                                }
2903                                catch (const CIMException& cimException)
2904                                {
2905                                    CIMResponseMessage* response = req->buildResponse();
2906                                    response->cimException = cimException;
2907                        
2908                                    //_enqueueResponse(request, response);
2909                                    PEG_METHOD_EXIT();
2910                                    return response;
2911                                }
2912                        
2913                                Tracer::trace(TRC_DISPATCHER, Tracer::LEVEL4,
2914                                              "providerCount = %u.", providerCount);
2915                        
2916                                // If no provider is registered and the repository isn't the default,
2917                                // return CIM_ERR_NOT_SUPPORTED
2918                        
2919                                if ((providerCount == 0) && !reposi_->isDefaultInstanceProvider())
2920 kamal.locahana 1.1.2.1         {
2921                                    PEG_TRACE_STRING(
2922                                        TRC_DISPATCHER,
2923                                        Tracer::LEVEL4,
2924                                        "CIM_ERR_NOT_SUPPORTED for " + req->className.getString());
2925                        
2926                                    CIMResponseMessage* response = req->buildResponse();
2927                                    response->cimException =
2928                                        PEGASUS_CIM_EXCEPTION(CIM_ERR_NOT_SUPPORTED, String::EMPTY);
2929                        
2930                                    //_enqueueResponse(request, response);
2931                        
2932                                    PEG_METHOD_EXIT();
2933                                    return response;
2934                                }
2935                        
2936                                //
2937                                // Get the instances from the repository, as necessary
2938                                //
2939                        
2940                                // Hold the repository results in a response message.
2941 kamal.locahana 1.1.2.1         // If not using the repository, this pointer is null.
2942                                AutoPtr<CIMReferenceNamesResponseMessage> response;
2943                        
2944                                if (reposi_->isDefaultInstanceProvider())
2945                                {
2946                                    response.reset(dynamic_cast<CIMReferenceNamesResponseMessage*>(
2947                                        req->buildResponse()));
2948                        
2949                                    try
2950                                    {
2951                                        //StatProviderTimeMeasurement providerTime(response.get());
2952                        
2953                                        response->objectNames = reposi_->referenceNames(
2954                                            req->nameSpace,
2955                                            req->objectName,
2956                                            req->resultClass,
2957                                            req->role);
2958                                    }
2959                                    catch (const CIMException& exception)
2960                                    {
2961                                        response->cimException = exception;
2962 kamal.locahana 1.1.2.1             }
2963                                    catch (const Exception& exception)
2964                                    {
2965                                        response->cimException = PEGASUS_CIM_EXCEPTION(
2966                                            CIM_ERR_FAILED, exception.getMessage());
2967                                    }
2968                                    catch (...)
2969                                    {
2970                                        response->cimException = PEGASUS_CIM_EXCEPTION(
2971                                            CIM_ERR_FAILED, String::EMPTY);
2972                                    }
2973                        
2974                                    Tracer::trace(TRC_DISPATCHER, Tracer::LEVEL4,
2975                                        "ReferenceNames repository access: class = %s, count = %u.",
2976                                            (const char*)req->objectName.toString().getCString(),
2977                                            response->objectNames.size());
2978                                }
2979                        
2980                                //
2981                                // If we have no providers to call, just return what we've got
2982                                //
2983 kamal.locahana 1.1.2.1 
2984                                if (providerCount == 0)
2985                                {
2986                                     //_enqueueResponse(request, response.release());
2987                                     PEG_METHOD_EXIT();
2988                                     return response.release();
2989                                }
2990                        
2991                                //
2992                                // Set up an aggregate object and save the original request message
2993                                //
2994                        
2995                                OperationAggregate* poA = new OperationAggregate(
2996                                    new CIMReferenceNamesRequestMessage(*req),
2997                                    req->getType(),
2998                                    req->messageId,
2999                                    req->queueIds.top(),
3000                                    req->objectName.getClassName(),
3001                                    req->nameSpace);
3002                        
3003                                //poA->_aggregationSN = cimOperationAggregationSN++;
3004 kamal.locahana 1.1.2.1 
3005                                // Include the repository response in the aggregation, if applicable
3006                                if (response.get() != 0)
3007                                {
3008                                    poA->setTotalIssued(providerCount+1);
3009                                    return forwardRequestForAggregation_(
3010                                        String(PEGASUS_QUEUENAME_OPREQDISPATCHER),
3011                                        String(),
3012                                        new CIMReferenceNamesRequestMessage(*req),
3013                                        poA,
3014                                        response.release());
3015                                }
3016                                else
3017                                {
3018                                    poA->setTotalIssued(providerCount);
3019                                }
3020                        
3021                        		
3022                                for (Uint32 i = 0; i < providerInfos.size(); i++)
3023                                {
3024                                    if (providerInfos[i].hasProvider)
3025 kamal.locahana 1.1.2.1             {
3026                                        CIMReferenceNamesRequestMessage* requestCopy =
3027                                            new CIMReferenceNamesRequestMessage(*req);
3028                                        // Insert the association class name to limit the provider
3029                                        // to this class.
3030                                        requestCopy->resultClass = providerInfos[i].className;
3031                        
3032                                        if (providerInfos[i].providerIdContainer.get() != 0)
3033                                            requestCopy->operationContext.insert(
3034                                                *(providerInfos[i].providerIdContainer.get()));
3035                        
3036                                        PEG_TRACE_STRING(TRC_DISPATCHER, Tracer::LEVEL4,
3037                                            "Forwarding to provider for class " +
3038                                            providerInfos[i].className.getString());
3039                                        forwardRequestForAggregation_(providerInfos[i].serviceName,    // fix
3040                                            providerInfos[i].controlProviderName, requestCopy, poA);
3041                                        // Note: poA must not be referenced after last "forwardRequest"
3042                                    }
3043                                }
3044                            }  // End of instance processing
3045                        
3046 kamal.locahana 1.1.2.1     PEG_METHOD_EXIT();
3047                            return NULL;
3048                        } // do_ern_()
3049                        
3050                        
3051                        
3052                        
3053                        
3054                        
3055                                          /*---------------------------
3056                                           *                           *
3057                                           *                           *
3058                                           *        qualifier          *
3059                                           *                           *
3060                                           *                           *
3061                                           *---------------------------*/
3062                        
3063                        
3064                        
3065                        //-----------------------------------------------------------------
3066                        Message *CIMDirectAccessRep::do_gq_( CIMRequestMessage* request) {
3067 kamal.locahana 1.1.2.1     PEG_METHOD_ENTER(TRC_DISPATCHER, "CIMDirectAccessRep::do_gq_()");
3068                        	CIMGetQualifierRequestMessage *req = 
3069                        			       (CIMGetQualifierRequestMessage*) request;	
3070                            AutoPtr<CIMGetQualifierResponseMessage> response(
3071                                dynamic_cast<CIMGetQualifierResponseMessage*>(
3072                                    req->buildResponse()));
3073                        
3074                            try {
3075                                //StatProviderTimeMeasurement providerTime(response.get());
3076                                response->cimQualifierDecl = reposi_->getQualifier(
3077                                    req->nameSpace, req->qualifierName);
3078                                PEG_LOGGER_TRACE((
3079                                    Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE,
3080                                    "CIMDirectAccessRep::do_gq_() - Namespace: $0  Qualifier Name: $1",
3081                                    req->nameSpace.getString(),
3082                                    req->qualifierName.getString()));
3083                                }
3084                            catch (const CIMException& exception)   {
3085                                response->cimException = exception;
3086                                }
3087                            catch (const Exception& exception)    {
3088 kamal.locahana 1.1.2.1         response->cimException = PEGASUS_CIM_EXCEPTION(
3089                                    CIM_ERR_FAILED, exception.getMessage());
3090                                }
3091                            catch (...)  {
3092                                response->cimException = PEGASUS_CIM_EXCEPTION(
3093                                    CIM_ERR_FAILED, String::EMPTY);
3094                                }
3095                        
3096                            //_enqueueResponse(request, response.release());
3097                            PEG_METHOD_EXIT();
3098                        	return response.release();
3099                            } // do_gq_()
3100                        
3101                        
3102                        
3103                        
3104                        //----------------------------------------------------------------
3105                        Message *CIMDirectAccessRep::do_sq_( CIMRequestMessage* request){
3106                            PEG_METHOD_ENTER(TRC_DISPATCHER,
3107                                "CIMDirectAccessRep::handleSetQualifierRequest");
3108                            CIMSetQualifierRequestMessage *req = (CIMSetQualifierRequestMessage*) request;
3109 kamal.locahana 1.1.2.1     AutoPtr<CIMSetQualifierResponseMessage> response(
3110                                dynamic_cast<CIMSetQualifierResponseMessage*>(
3111                                    req->buildResponse()));
3112                        
3113                            try
3114                            {
3115                                //StatProviderTimeMeasurement providerTime(response.get());
3116                        
3117                                reposi_->setQualifier(
3118                                    req->nameSpace,
3119                                    req->qualifierDeclaration,
3120                                    ((ContentLanguageListContainer)req->operationContext.get(
3121                                        ContentLanguageListContainer::NAME)).getLanguages());
3122                        
3123                                PEG_LOGGER_TRACE((
3124                                    Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE,
3125                                "CIMDirectAccessRep::handleSetQualifierRequest - "
3126                                    "Namespace: $0  Qualifier Name: $1",
3127                                req->nameSpace.getString(),
3128                                req->qualifierDeclaration.getName().getString()));
3129                            }
3130 kamal.locahana 1.1.2.1     catch (const CIMException& exception)
3131                            {
3132                                response->cimException = exception;
3133                            }
3134                            catch (const Exception& exception)
3135                            {
3136                                response->cimException = PEGASUS_CIM_EXCEPTION(
3137                                    CIM_ERR_FAILED, exception.getMessage());
3138                            }
3139                            catch (...)
3140                            {
3141                                response->cimException = PEGASUS_CIM_EXCEPTION(
3142                                    CIM_ERR_FAILED, String::EMPTY);
3143                            }
3144                        
3145                            //_enqueueResponse(request, response.release());
3146                        
3147                            PEG_METHOD_EXIT();
3148                        	return response.release();
3149                        } // do_sq_()
3150                        
3151 kamal.locahana 1.1.2.1 
3152                        
3153                        //-------------------------------------------------------------------
3154                        Message *CIMDirectAccessRep::do_dq_( CIMRequestMessage* request){
3155                            PEG_METHOD_ENTER(TRC_DISPATCHER,
3156                                "CIMDirectAccessRep::handleDeleteQualifierRequest");
3157                            CIMDeleteQualifierRequestMessage *req = (CIMDeleteQualifierRequestMessage*)request;
3158                            AutoPtr<CIMDeleteQualifierResponseMessage> response(
3159                                dynamic_cast<CIMDeleteQualifierResponseMessage*>(
3160                                    req->buildResponse()));
3161                        
3162                            try
3163                            {
3164                                //StatProviderTimeMeasurement providerTime(response.get());
3165                        
3166                                reposi_->deleteQualifier(
3167                                    req->nameSpace, req->qualifierName);
3168                        
3169                                PEG_LOGGER_TRACE((
3170                                    Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE,
3171                                    "CIMDirectAccessRep::handleDeleteQualifierRequest - "
3172 kamal.locahana 1.1.2.1                 "Namespace: $0  Qualifier Name: $1",
3173                                    req->nameSpace.getString(),
3174                                    req->qualifierName.getString()));
3175                            }
3176                            catch (const CIMException& exception)
3177                            {
3178                                response->cimException = exception;
3179                            }
3180                            catch (const Exception& exception)
3181                            {
3182                                response->cimException = PEGASUS_CIM_EXCEPTION(
3183                                    CIM_ERR_FAILED, exception.getMessage());
3184                            }
3185                            catch (...)
3186                            {
3187                                response->cimException = PEGASUS_CIM_EXCEPTION(
3188                                    CIM_ERR_FAILED, String::EMPTY);
3189                            }
3190                        
3191                            //_enqueueResponse(request, response.release());
3192                        
3193 kamal.locahana 1.1.2.1     PEG_METHOD_EXIT();
3194                        	return response.release();
3195                        } // do_dq_()
3196                        
3197                        
3198                        
3199                        
3200                        //--------------------------------------------------------------------
3201                        Message *CIMDirectAccessRep::do_eq_( CIMRequestMessage* request){
3202                            PEG_METHOD_ENTER(TRC_DISPATCHER,
3203                                "CIMDirectAccessRep::handleEnumerateQualifiersRequest");
3204                            CIMEnumerateQualifiersRequestMessage *req = 
3205                        			                  (CIMEnumerateQualifiersRequestMessage*)request;
3206                            AutoPtr<CIMEnumerateQualifiersResponseMessage> response(
3207                                dynamic_cast<CIMEnumerateQualifiersResponseMessage*>(
3208                                    req->buildResponse()));
3209                        
3210                            try
3211                            {
3212                                //StatProviderTimeMeasurement providerTime(response.get());
3213                        
3214 kamal.locahana 1.1.2.1         response->qualifierDeclarations = reposi_->enumerateQualifiers(
3215                                    req->nameSpace);
3216                        
3217                                PEG_LOGGER_TRACE((
3218                                    Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE,
3219                                    "CIMDirectAccessRep::handleEnumerateQualifiersRequest - "
3220                                        "Namespace: $0",
3221                                    req->nameSpace.getString()));
3222                            }
3223                            catch (const CIMException& exception)
3224                            {
3225                                response->cimException = exception;
3226                            }
3227                            catch (const Exception& exception)
3228                            {
3229                                response->cimException = PEGASUS_CIM_EXCEPTION(
3230                                    CIM_ERR_FAILED, exception.getMessage());
3231                            }
3232                            catch (...)
3233                            {
3234                                response->cimException = PEGASUS_CIM_EXCEPTION(
3235 kamal.locahana 1.1.2.1             CIM_ERR_FAILED, String::EMPTY);
3236                            }
3237                        
3238                            //_enqueueResponse(request, response.release());
3239                        
3240                            PEG_METHOD_EXIT();
3241                        	return response.release();
3242                        } // do_eq_()
3243                        
3244                        
3245                        
3246                        
3247                        
3248                                  /*---------------------------*
3249                        		   *                           *
3250                        		   *                           *
3251                        		   *       property            *
3252                        		   *                           *
3253                        		   *                           *
3254                        		   *---------------------------*/
3255                        
3256 kamal.locahana 1.1.2.1 
3257                        //----------------------------------------------------------------
3258                        Message *CIMDirectAccessRep::do_gp_( CIMRequestMessage* request){
3259                           PEG_METHOD_ENTER(TRC_DISPATCHER,
3260                              "CIMDirectAccessRep::handleGetPropertyRequest");
3261                           CIMGetPropertyRequestMessage *req = (CIMGetPropertyRequestMessage*)request;
3262                           CIMName className = req->instanceName.getClassName();
3263                        
3264                           // check the class name for an "external provider"
3265                           // Assumption here is that there are no "internal" property requests.
3266                           // teATTN: KS 20030402 - This needs cleanup along with the setproperty.
3267                        
3268                           ProviderInfo providerInfo = opreqdispatch_->_lookupInstanceProvider(
3269                                                          req->nameSpace, className);
3270                        
3271                           if (providerInfo.hasProvider)
3272                           {
3273                               CIMGetPropertyRequestMessage* requestCopy =
3274                                   new CIMGetPropertyRequestMessage(*req);
3275                        
3276                               if (providerInfo.providerIdContainer.get() != 0)
3277 kamal.locahana 1.1.2.1        {
3278                                   requestCopy->operationContext.insert(
3279                                       *providerInfo.providerIdContainer.get());
3280                               }
3281                        
3282                               CIMGetPropertyRequestMessage* requestCallbackCopy =
3283                                   new CIMGetPropertyRequestMessage(*requestCopy);
3284                        
3285                               return forwardRequestToProvider_( //Service(
3286                        		   providerInfo.className,
3287                                   PEGASUS_QUEUENAME_PROVIDERMANAGER_CPP,
3288                        		   providerInfo.controlProviderName,
3289                                   requestCopy,
3290                                   requestCallbackCopy);
3291                        
3292                               PEG_METHOD_EXIT();
3293                               //return;
3294                           }
3295                           else if (reposi_->isDefaultInstanceProvider())
3296                           {
3297                              AutoPtr<CIMGetPropertyResponseMessage> response(
3298 kamal.locahana 1.1.2.1           dynamic_cast<CIMGetPropertyResponseMessage*>(req->buildResponse()));
3299                        
3300                              try
3301                              {
3302                                  //StatProviderTimeMeasurement providerTime(response.get());
3303                        
3304                                  response->value = reposi_->getProperty(
3305                                      req->nameSpace,
3306                                      req->instanceName,
3307                                      req->propertyName);
3308                              }
3309                              catch (const CIMException& exception)
3310                              {
3311                                  response->cimException = exception;
3312                              }
3313                              catch (const Exception& exception)
3314                              {
3315                                  response->cimException = PEGASUS_CIM_EXCEPTION(
3316                                      CIM_ERR_FAILED, exception.getMessage());
3317                              }
3318                              catch (...)
3319 kamal.locahana 1.1.2.1       {
3320                                  response->cimException = PEGASUS_CIM_EXCEPTION(
3321                                      CIM_ERR_FAILED, String::EMPTY);
3322                              }
3323                        
3324                              //_enqueueResponse(request, response.release());
3325                              return response.release();
3326                           }
3327                           // (else) // No provider is registered and the repository isn't the default
3328                           CIMResponseMessage* response = req->buildResponse();
3329                           response->cimException =
3330                                   PEGASUS_CIM_EXCEPTION(CIM_ERR_NOT_SUPPORTED, String::EMPTY);
3331                           //_enqueueResponse(request, response);
3332                           return response;
3333                           } // do_gp_()
3334                        
3335                        
3336                        
3337                        
3338                        
3339                        //--------------------------------------------------------------
3340 kamal.locahana 1.1.2.1 Message *CIMDirectAccessRep::do_sp_( CIMRequestMessage* request){
3341                            PEG_METHOD_ENTER(TRC_DISPATCHER,
3342                                "CIMDirectAccessRep::handleSetPropertyRequest");
3343                            CIMSetPropertyRequestMessage *req = (CIMSetPropertyRequestMessage*)request;
3344                            {
3345                                CIMException cimException;
3346                                try {
3347                                    opreqdispatch_->_fixSetPropertyValueType(req);
3348                                    }
3349                                catch (CIMException& exception) {
3350                                    cimException = exception;
3351                                    }
3352                                catch (const Exception& exception) {
3353                                    cimException =
3354                                        PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED, exception.getMessage());
3355                                    }
3356                                catch (...) {
3357                                    cimException = PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED, String::EMPTY);
3358                                     }
3359                        
3360                                if (cimException.getCode() != CIM_ERR_SUCCESS)
3361 kamal.locahana 1.1.2.1         {
3362                                    PEG_LOGGER_TRACE((
3363                                        Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE,
3364                                        "CIMDirectAccessRep::handleSetPropertyRequest - "
3365                                            "CIM exception has occurred."));
3366                        
3367                                    CIMResponseMessage* response = req->buildResponse();
3368                                    response->cimException = cimException;
3369                        
3370                                    //_enqueueResponse(request, response);
3371                                    PEG_METHOD_EXIT();
3372                                    return response;
3373                                }
3374                            }
3375                        
3376                            CIMName className = req->instanceName.getClassName();
3377                        
3378                            // check the class name for an "external provider"
3379                            ProviderInfo providerInfo = opreqdispatch_->_lookupInstanceProvider(
3380                                                                  req->nameSpace, className);
3381                        
3382 kamal.locahana 1.1.2.1     if (providerInfo.hasProvider)
3383                            {
3384                                CIMSetPropertyRequestMessage* requestCopy = 
3385                        				             new CIMSetPropertyRequestMessage(*req);
3386                        
3387                                if (providerInfo.providerIdContainer.get() != 0)
3388                                {
3389                                    requestCopy->operationContext.insert(
3390                                        *providerInfo.providerIdContainer.get());
3391                                }
3392                        
3393                                CIMSetPropertyRequestMessage* requestCallbackCopy =
3394                                                      new CIMSetPropertyRequestMessage(*requestCopy);
3395                        
3396                                return forwardRequestToProvider_(   //Service(
3397                        		    providerInfo.className,
3398                                    PEGASUS_QUEUENAME_PROVIDERMANAGER_CPP,
3399                        			providerInfo.controlProviderName,
3400                                    requestCopy,
3401                                    requestCallbackCopy);
3402                        
3403 kamal.locahana 1.1.2.1         PEG_METHOD_EXIT();
3404                            }
3405                            else if (reposi_->isDefaultInstanceProvider())
3406                            {
3407                                AutoPtr<CIMSetPropertyResponseMessage> response(
3408                                    dynamic_cast<CIMSetPropertyResponseMessage*>(
3409                                        request->buildResponse()));
3410                        
3411                                try
3412                                {
3413                                    //StatProviderTimeMeasurement providerTime(response.get());
3414                        
3415                                    reposi_->setProperty(
3416                                        req->nameSpace,
3417                                        req->instanceName,
3418                                        req->propertyName,
3419                                        req->newValue,
3420                                        ((ContentLanguageListContainer)req->operationContext.get(
3421                                            ContentLanguageListContainer::NAME)).getLanguages());
3422                        
3423                                    PEG_LOGGER_TRACE((
3424 kamal.locahana 1.1.2.1                 Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE,
3425                                        "CIMDirectAccessRep::handleSetPropertyRequest - "
3426                                            "Namespace: $0  Instance Name: $1  Property Name: $2  New "
3427                                            "Value: $3",
3428                                        req->nameSpace.getString(),
3429                                        req->instanceName.getClassName().getString(),
3430                                        req->propertyName.getString(),
3431                                        req->newValue.toString()));
3432                                }
3433                                catch (const CIMException& exception)
3434                                {
3435                                    response->cimException = exception;
3436                                }
3437                                catch (const Exception& exception)
3438                                {
3439                                    response->cimException = PEGASUS_CIM_EXCEPTION(
3440                                        CIM_ERR_FAILED, exception.getMessage());
3441                                }
3442                                catch (...)
3443                                {
3444                                    response->cimException = PEGASUS_CIM_EXCEPTION(
3445 kamal.locahana 1.1.2.1                 CIM_ERR_FAILED, String::EMPTY);
3446                                }
3447                        
3448                                //_enqueueResponse(request, response.release());
3449                        		return response.release();
3450                            }
3451                        
3452                            // (else) // No provider is registered and the repository isn't the default
3453                            CIMResponseMessage* response = req->buildResponse();
3454                            response->cimException =
3455                                    PEGASUS_CIM_EXCEPTION(CIM_ERR_NOT_SUPPORTED, String::EMPTY);
3456                            //_enqueueResponse(request, response);
3457                            PEG_METHOD_EXIT();
3458                            return response;
3459                            } // do_sp_()
3460                        
3461                        
3462                        
3463                        
3464                        
3465                                   /*---------------------------
3466 kamal.locahana 1.1.2.1 		   *                           *
3467                        		   *                           *
3468                        		   *        misc op            *
3469                        		   *                           *
3470                        		   *                           *
3471                        		   *---------------------------*/
3472                        
3473                        
3474                        //--------------------------------------------------------------------
3475                        Message *CIMDirectAccessRep::do_invoke_( CIMRequestMessage* request) {		
3476                            PEG_METHOD_ENTER(TRC_DISPATCHER,"CIMDirectAccessRep::do_invoke_()");
3477                            CIMInvokeMethodRequestMessage *req = 
3478                        			     (CIMInvokeMethodRequestMessage*)request;
3479                        {
3480                        
3481                                CIMException cimException;
3482                                try  {
3483                                    opreqdispatch_->_fixInvokeMethodParameterTypes(req);
3484                                    }
3485                                catch (CIMException& exception) {
3486                                    cimException = exception;
3487 kamal.locahana 1.1.2.1             }
3488                                catch (const Exception& exception)  {
3489                                    cimException =
3490                                        PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED, exception.getMessage());
3491                                    }
3492                                catch (...) {
3493                                    cimException = PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED, String::EMPTY);
3494                                    }
3495                        
3496                                if (cimException.getCode() != CIM_ERR_SUCCESS)
3497                                {
3498                                    PEG_LOGGER_TRACE((
3499                                        Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE,
3500                                        "CIMDirectAccessRep::do_invoke_() - "
3501                                            "CIM exception has occurred."));
3502                        
3503                                    CIMResponseMessage* response = req->buildResponse();
3504                                    response->cimException = cimException;
3505                        
3506                                    //_enqueueResponse(request, response);
3507                        
3508 kamal.locahana 1.1.2.1             PEG_METHOD_EXIT();
3509                                    return response;
3510                                }
3511                            }
3512                        
3513                            CIMName className = req->instanceName.getClassName();
3514                        
3515                            CIMException checkClassException;
3516                            opreqdispatch_->_checkExistenceOfClass( req->nameSpace, 
3517                        					                        className, 
3518                        									        checkClassException);
3519                            if (checkClassException.getCode() != CIM_ERR_SUCCESS)
3520                            {
3521                                // map CIM_ERR_INVALID_CLASS to CIM_ERR_NOT_FOUND
3522                                if (checkClassException.getCode() == CIM_ERR_INVALID_CLASS)
3523                                {
3524                                    checkClassException = PEGASUS_CIM_EXCEPTION(
3525                                        CIM_ERR_NOT_FOUND, className.getString());
3526                                }
3527                        
3528                                PEG_LOGGER_TRACE((
3529 kamal.locahana 1.1.2.1             Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE,
3530                                        "CIMDirectAccessRep::do_invoke_() - "
3531                                            "CIM exist exception has occurred.  Namespace: $0  "
3532                                            "Class Name: $1",
3533                                        req->nameSpace.getString(),
3534                                        className.getString()));
3535                        
3536                                CIMResponseMessage* response = req->buildResponse();
3537                                response->cimException = checkClassException;
3538                        
3539                                //_enqueueResponse(request, response);
3540                                PEG_METHOD_EXIT();
3541                                return response;
3542                            }
3543                        
3544                            String serviceName;
3545                            String controlProviderName;
3546                        
3547                            // Check for class provided by an internal provider
3548                            if (opreqdispatch_->_lookupInternalProvider(
3549                                    req->nameSpace, className, serviceName, controlProviderName))
3550 kamal.locahana 1.1.2.1     {
3551                                CIMInvokeMethodRequestMessage* requestCopy =
3552                                    new CIMInvokeMethodRequestMessage(*req);
3553                        
3554                                CIMInvokeMethodRequestMessage* requestCallbackCopy =
3555                                    new CIMInvokeMethodRequestMessage(*requestCopy);  // fix
3556                        
3557                                return forwardRequestToProvider_(
3558                                    className,
3559                                    serviceName,
3560                                    controlProviderName,
3561                                    requestCopy,
3562                                    requestCallbackCopy);
3563                        
3564                                PEG_METHOD_EXIT();
3565                                //return;
3566                            }
3567                        
3568                            // check the class name for an "external provider"
3569                            ProviderIdContainer* providerIdContainer=NULL;
3570                        
3571 kamal.locahana 1.1.2.1     String providerName = opreqdispatch_->_lookupMethodProvider(
3572                                req->nameSpace,
3573                                className,
3574                                req->methodName,
3575                                &providerIdContainer);
3576                        
3577                            if (providerName.size() != 0)
3578                            {
3579                                CIMInvokeMethodRequestMessage* requestCopy =
3580                                    new CIMInvokeMethodRequestMessage(*req);
3581                        
3582                                if (providerIdContainer!=NULL)
3583                                {
3584                                    requestCopy->operationContext.insert(*providerIdContainer);
3585                                    delete providerIdContainer;
3586                                    providerIdContainer = NULL;
3587                                }
3588                        
3589                                CIMInvokeMethodRequestMessage* requestCallbackCopy =
3590                                    new CIMInvokeMethodRequestMessage(*requestCopy);
3591                        
3592 kamal.locahana 1.1.2.1         return forwardRequestToProvider_(            //Service_(
3593                        		    className,
3594                                    PEGASUS_QUEUENAME_PROVIDERMANAGER_CPP,
3595                        		    String::EMPTY,
3596                                    requestCopy,
3597                                    requestCallbackCopy);
3598                        
3599                                PEG_METHOD_EXIT();
3600                                //return;
3601                            }
3602                        
3603                            CIMResponseMessage* response = req->buildResponse();
3604                            response->cimException =
3605                                PEGASUS_CIM_EXCEPTION(CIM_ERR_METHOD_NOT_AVAILABLE,
3606                                    req->methodName.getString());
3607                        
3608                            //_enqueueResponse(request, response);
3609                        
3610                            PEG_METHOD_EXIT();
3611                            return response;
3612                            } // do_invoke_()
3613 kamal.locahana 1.1.2.1 
3614                        
3615                        
3616                        
3617                        //-----------------------------------------------------------------
3618                        Message *CIMDirectAccessRep::do_query_( CIMRequestMessage* request){
3619                            PEG_METHOD_ENTER(TRC_DISPATCHER,
3620                                "CIMDirectAccessRep::handleExecQueryRequest");
3621                            CIMExecQueryRequestMessage *req=(CIMExecQueryRequestMessage*)request;
3622                            AutoPtr<CIMExecQueryResponseMessage> response(
3623                                dynamic_cast<CIMExecQueryResponseMessage*>(
3624                                    req->buildResponse()));
3625                        
3626                            Boolean exception = false;
3627                        
3628                        #ifdef PEGASUS_DISABLE_EXECQUERY
3629                            response->cimException =
3630                                PEGASUS_CIM_EXCEPTION(CIM_ERR_NOT_SUPPORTED, String::EMPTY);
3631                            exception=true;
3632                        #else
3633                            if (QuerySupportRouter::routeHandleExecQueryRequest(this,req)==false)  // fix
3634 kamal.locahana 1.1.2.1     {
3635                                if (req->operationContext.contains(
3636                                        SubscriptionFilterConditionContainer::NAME))
3637                                {
3638                                    SubscriptionFilterConditionContainer sub_cntr =
3639                                        req->operationContext.get(
3640                                            SubscriptionFilterConditionContainer::NAME);
3641                                    response->cimException = PEGASUS_CIM_EXCEPTION(
3642                                        CIM_ERR_QUERY_LANGUAGE_NOT_SUPPORTED,
3643                                        sub_cntr.getQueryLanguage());
3644                                }
3645                                else
3646                                {
3647                                    response->cimException = PEGASUS_CIM_EXCEPTION(
3648                                        CIM_ERR_QUERY_LANGUAGE_NOT_SUPPORTED, req->queryLanguage);
3649                                }
3650                        
3651                                exception = true;
3652                            }
3653                        #endif
3654                        
3655 kamal.locahana 1.1.2.1     if (exception)
3656                            {
3657                                //_enqueueResponse(request, response.release());
3658                                PEG_METHOD_EXIT();
3659                                return response.release();
3660                            }
3661                        
3662                            PEG_METHOD_EXIT();
3663                            response->cimException =
3664                                PEGASUS_CIM_EXCEPTION(CIM_ERR_NOT_SUPPORTED, String::EMPTY);
3665                            return response.release();
3666                        } // do_query_()
3667                        
3668                        
3669                        
3670                        
3671                        
3672                        //--------------------------------------------------------------------
3673                        Message *CIMDirectAccessRep::forwardRequestForAggregation_(
3674                            const String& serviceName,
3675                            const String& controlProviderName,
3676 kamal.locahana 1.1.2.1     CIMRequestMessage  *request,      // why not a CIMOperationRequestMessage?
3677                            OperationAggregate *poA,
3678                            CIMResponseMessage *response)
3679                        {
3680                        
3681                        
3682                            PEG_METHOD_ENTER(
3683                                TRC_DISPATCHER,
3684                                "CIMDirectAccessRep::forwardRequestForAggregation_");
3685                        
3686                            //Array<Uint32> serviceIds;
3687                            //find_services(serviceName, 0, 0, &serviceIds);
3688                            //find_services(serviceName, 0, 0, &serviceIds);
3689                            //PEGASUS_ASSERT(serviceIds.size() != 0);
3690                        
3691                            AsyncOpNode* op = //this->get_op();
3692                                              MessageQueueService::get_op();
3693                            // if a response is given, this means the caller wants to run only the
3694                            // callback asynchronously
3695                            if (response)
3696                            {
3697 kamal.locahana 1.1.2.1         AsyncLegacyOperationResult* asyncResponse =
3698                                    new AsyncLegacyOperationResult(
3699                                        op, response);
3700                                // By setting this to complete, this allows ONLY the callback to run
3701                                // without going through the typical async request apparatus
3702                                op->complete();
3703                            }
3704                        
3705                        
3706                            // If ControlProviderName empty, forward to service.
3707                            if (controlProviderName == String::EMPTY)
3708                            {
3709                        
3710                                //AsyncLegacyOperationStart* asyncRequest =
3711                                //    new AsyncLegacyOperationStart(
3712                                //        op,
3713                                //        serviceIds[0],
3714                                //        request,
3715                                //        this->getQueueId());
3716                        
3717                                    
3718 kamal.locahana 1.1.2.1         if ( serviceName=="Server::ProviderManagerService" ) {
3719                                    Message *m = odiniter_(pvdrmgrsvc_)->_processMessage( request );
3720                                    response = dynamic_cast<CIMResponseMessage*>(m);
3721                                    if (!response) {
3722                                        CIMResponseMessage *r = request->buildResponse();
3723                                        r->cimException =
3724                                            PEGASUS_CIM_EXCEPTION(CIM_ERR_NOT_SUPPORTED,
3725                                            "dyn cast failed");
3726                                        throw r->cimException;
3727                                        }
3728                                    }    
3729                                else if ( serviceName=="CIMOpRequestDispacther" ) {
3730                                    // is recognized service, and there is nothing to to here!
3731                                    }
3732                                else {
3733                                    MessageQueue *q = MessageQueue::lookup(request->queueIds.top());
3734                                    }                
3735                        
3736                                PEG_TRACE_STRING(TRC_DISPATCHER, Tracer::LEVEL3,
3737                                    "Forwarding " + String(MessageTypeToString(request->getType())) +
3738                                        " to service " + serviceName +
3739 kamal.locahana 1.1.2.1                 ". Response should go to queue " +
3740                                        ((MessageQueue::lookup(request->queueIds.top())) ?
3741                                            String(((MessageQueue::lookup(
3742                                                request->queueIds.top()))->getQueueName())) :
3743                                            String("BAD queue name")));
3744                        
3745                        
3746                                //SendAsync(
3747                                //    op,
3748                                //    serviceIds[0],
3749                                //    CIMDirectAccessRep::_forwardForAggregationCallback,
3750                                //    this,
3751                                //    poA);
3752                            }
3753                            else
3754                            {
3755                        
3756                        
3757                               //AsyncModuleOperationStart* moduleControllerRequest =
3758                               //    new AsyncModuleOperationStart(
3759                               //        op,
3760 kamal.locahana 1.1.2.1        //        serviceIds[0],
3761                               //        this->getQueueId(),
3762                               //        true,
3763                               //        controlProviderName,
3764                               //        request);
3765                        
3766                               PEG_TRACE_STRING(TRC_DISPATCHER, Tracer::LEVEL3,
3767                                    "Forwarding " + String(MessageTypeToString(request->getType())) +
3768                                        " to service " + serviceName + ", control provider " +
3769                                        controlProviderName + ". Response should go to queue " +
3770                                        ((MessageQueue::lookup(request->queueIds.top())) ?
3771                                            String(((MessageQueue::lookup(
3772                                                request->queueIds.top()))->getQueueName())) :
3773                                        String("BAD queue name")));
3774                        
3775                               
3776                                if ( controlProviderName == "ControlService::NamespaceProvider") {
3777                        //verify(__FILE__,__LINE__);
3778                                    response = 
3779                                        odiniter_((NamespaceProvider*)NULL)->processMessage( request );
3780                                    }
3781 kamal.locahana 1.1.2.1         else if ( controlProviderName == "ControlService::InteropProvider") {
3782                        //verify(__FILE__,__LINE__);
3783                                    response = 
3784                                        odiniter_((InteropProvider*)NULL)->processMessage( request );
3785                                    }
3786                                else if ( controlProviderName == 
3787                                                       "ControlService::ProviderRegistrationProvider") {
3788                        //verify(__FILE__,__LINE__);
3789                                    response = 
3790                                        odiniter_((ProviderRegistrationProvider*)NULL)->
3791                                        processMessage( request );
3792                                    }
3793                                else if ( controlProviderName == 
3794                                                       "ControlService::CIMOMStatDataProvider") {
3795                        //verify(__FILE__,__LINE__);
3796                                    response = 
3797                                        odiniter_((CIMOMStatDataProvider*)NULL)->processMessage( request );
3798                                    }
3799                                else if ( controlProviderName == 
3800                                                       "ControlService::ConfigProvider") {
3801                                    response = 
3802 kamal.locahana 1.1.2.1                 odiniter_((ConfigSettingProvider*)NULL)->processMessage( request );
3803                                    }
3804                                else {
3805                                    }
3806                        
3807                        
3808                               //SendAsync(
3809                               //    op,
3810                               //    serviceIds[0],
3811                               //    CIMDirectAccessRep::_forwardForAggregationCallback,
3812                               //    this,
3813                               //    poA);
3814                            }
3815                        
3816                            bool aggdone = poA->appendResponse( response );
3817                        
3818                            PEG_METHOD_EXIT();
3819                            return response;           // fix.  probably not needed; resp. is in poA.
3820                        } // forwardRequestForAggregation()
3821                        
3822                        
3823 kamal.locahana 1.1.2.1 
3824                        
3825                        //-------------------------------------------------------------------
3826                        Message *CIMDirectAccessRep::forwardRequestToProvider_(
3827                        	const CIMName& className,       
3828                            const String& serviceName,
3829                            const String& controlProviderName,
3830                            CIMRequestMessage* request,
3831                            CIMRequestMessage* requestCopy)
3832                        {
3833                        
3834                            PEG_METHOD_ENTER(TRC_DISPATCHER,
3835                                "CIMDirectAccessRep::forwardRequestToProvider_()");
3836                        
3837                        //    //Array<Uint32> serviceIds;
3838                        //    opreqdispatch_->find_services(serviceName, 0, 0, &serviceIds);
3839                        //    PEGASUS_ASSERT(serviceIds.size() != 0);
3840                        
3841                            //AsyncOpNode* op = this->get_op();
3842                        	
3843                            //AutoPtr<CIMResponseMessage> response(
3844 kamal.locahana 1.1.2.1     //            dynamic_cast<CIMResponseMessage*>(request->buildResponse()));
3845                        	CIMResponseMessage *response = NULL;
3846                        
3847                            if (controlProviderName == String::EMPTY) {
3848                        
3849                        			
3850                                // since controlProviderName empty, forward to service.
3851                        		// 
3852                                //AsyncLegacyOperationStart* asyncRequest =
3853                                //    new AsyncLegacyOperationStart(
3854                                //        op,
3855                                //        serviceIds[0],
3856                                //        request,
3857                                //        this->getQueueId());
3858                                //asyncRequest->dest = serviceIds[0];
3859                                //PEG_TRACE_STRING(TRC_DISPATCHER, Tracer::LEVEL3,
3860                                //    "Forwarding " + String(MessageTypeToString(request->getType())) +
3861                                //        " on class " + className.getString() + " to service " +
3862                                //        serviceName + ". Response should go to queue " +
3863                                //        ((MessageQueue::lookup(request->queueIds.top())) ?
3864                                //            String(((MessageQueue::lookup(
3865 kamal.locahana 1.1.2.1         //                request->queueIds.top()))->getQueueName())) :
3866                                //            String("BAD queue name")));
3867                                //SendAsync(
3868                                //    op,
3869                                //    serviceIds[0],
3870                                //    CIMDirectAccessRep::_forwardRequestCallback,
3871                                //   this,
3872                                //   requestCopy);
3873                        
3874                                if (serviceName == "Server::ProviderManagerService") { 
3875                        		    return odiniter_(pvdrmgrsvc_)->_processMessage(request);		 
3876                        		    }
3877                                else if (serviceName == "Server::IndicationService") {
3878                        #if PEGASUS_DIRECTACCESS_BUILDTYPE == dacimINTEGRATED
3879                                    // dacim should never see it.  but just in case.
3880                                    CIMException cimException = PEGASUS_CIM_EXCEPTION(
3881                        		        CIM_ERR_NOT_SUPPORTED, "Server::IndicationService");  
3882                        			response = request->buildResponse();
3883                                    response->cimException = cimException;
3884                        #elif PEGASUS_DIRECTACCESS_BUILDTYPE >= dacimSEPREPOSI
3885                                    CIMException cimException = PEGASUS_CIM_EXCEPTION(
3886 kamal.locahana 1.1.2.1 		        CIM_ERR_NOT_SUPPORTED, "Server::IndicationService is TBD");  
3887                        			response = request->buildResponse();
3888                                    response->cimException = cimException;
3889                        #endif            
3890                        		    }
3891                                else if (serviceName == "IndicationHandlerService") { 
3892                        #if PEGASUS_DIRECTACCESS_BUILDTYPE == dacimINTEGRATED
3893                                    // dacim should never see it.  but just in case.
3894                                    CIMException cimException = PEGASUS_CIM_EXCEPTION(
3895                        		        CIM_ERR_NOT_SUPPORTED, "Server::IndicationHandlerService");  
3896                        			response = request->buildResponse();
3897                                    response->cimException = cimException;
3898                        #elif PEGASUS_DIRECTACCESS_BUILDTYPE >= dacimSEPREPOSI
3899                                    CIMException cimException = PEGASUS_CIM_EXCEPTION(
3900                        		        CIM_ERR_NOT_SUPPORTED, "Server::IndicationHandlerService is TBD");  
3901                        			response = request->buildResponse();
3902                                    response->cimException = cimException;
3903                        #endif            
3904                        		    }
3905                        		else {
3906                                    CIMException cimException = PEGASUS_CIM_EXCEPTION(
3907 kamal.locahana 1.1.2.1 							 CIM_ERR_FAILED, ">> unk serviceName");  // fix
3908                        			response = request->buildResponse();
3909                                    response->cimException = cimException;
3910                        			}
3911                                }
3912                        
3913                            
3914                            else  {
3915                        		// forward request to right control provider
3916                        		//
3917                        		
3918                        			
3919                        		if (controlProviderName == "ControlService::NamespaceProvider") {
3920                                    response = 
3921                                        odiniter_((NamespaceProvider*)NULL)->processMessage( request );
3922                        			}
3923                        		else if (controlProviderName == "ControlService::InteropProvider") {
3924                                    response = 
3925                                        odiniter_((InteropProvider*)NULL)->processMessage( request );
3926                        		    }		
3927                        		else if (controlProviderName == 
3928 kamal.locahana 1.1.2.1 						"ControlService::ProviderRegistrationProvider") {
3929                                    response = 
3930                                        odiniter_((ProviderRegistrationProvider*)NULL)->
3931                                        processMessage( request );
3932                        			} 	
3933                                else if ( controlProviderName == "ControlService::ConfigProvider") {
3934                                    response = 
3935                                        odiniter_((ConfigSettingProvider*)NULL)->processMessage(request);
3936                                    }
3937                        		else if (controlProviderName == 
3938                        						"ControlService::CIMQueryCapabilitiesProvider") {
3939                                    CIMException cimException = PEGASUS_CIM_EXCEPTION(
3940                        					 CIM_ERR_FAILED, ">> qry capab not ready yet");  // fix
3941                        			response = request->buildResponse();
3942                                    response->cimException = cimException;
3943                        		    }	
3944                        		else {
3945                                    CIMException cimException = PEGASUS_CIM_EXCEPTION(
3946                        							 CIM_ERR_FAILED, ">> unk serviceName");  // fix
3947                        			response = request->buildResponse();
3948                                    response->cimException = cimException;
3949 kamal.locahana 1.1.2.1 			}
3950                        			
3951                                //AsyncModuleOperationStart* moduleControllerRequest =
3952                                //    new AsyncModuleOperationStart(
3953                                //        op,
3954                                //        serviceIds[0],
3955                                //        this->getQueueId(),
3956                                //        true,
3957                                //        controlProviderName,
3958                                //        request);
3959                                //
3960                                //PEG_TRACE_STRING(TRC_DISPATCHER, Tracer::LEVEL3,
3961                                //    "Forwarding " + String(MessageTypeToString(request->getType())) +
3962                                //        " on class " + className.getString() + " to service " +
3963                                //        serviceName + ", control provider " + controlProviderName +
3964                                //        ". Response should go to queue " +
3965                                //            ((MessageQueue::lookup(request->queueIds.top())) ?
3966                                //                String(((MessageQueue::lookup(
3967                                //                    request->queueIds.top()))->getQueueName())) :
3968                                //                String("BAD queue name")));
3969                                //
3970 kamal.locahana 1.1.2.1         // Send to the Control provider
3971                                //SendAsync(
3972                                //   op,
3973                                //   serviceIds[0],
3974                                //   CIMDirectAccessRep::_forwardRequestCallback,
3975                                //   this,
3976                                //   requestCopy);
3977                                }
3978                        	
3979                        
3980                            PEG_METHOD_EXIT();
3981                            return response;  //.release();
3982                            } // forwardRequestToProvider_()
3983                        
3984                        
3985                        
3986                        #if 0 // needed?
3987                        //----------------------------------------------------------------
3988                        Message *CIMDirectAccessRep::forwardRequestToService_(
3989                            const String& serviceName,
3990                            CIMRequestMessage* request,
3991 kamal.locahana 1.1.2.1     CIMRequestMessage* requestCopy)
3992                        {
3993                        
3994                            PEG_METHOD_ENTER(TRC_DISPATCHER,
3995                                "CIMDirectAccessRep::forwardRequestToService_()");
3996                        
3997                            //Array<Uint32> serviceIds;
3998                            //find_services(serviceName, 0, 0, &serviceIds);
3999                            //PEGASUS_ASSERT(serviceIds.size() != 0);
4000                        
4001                            //AsyncOpNode* op = this->get_op();
4002                        
4003                            //AsyncLegacyOperationStart* asyncRequest =
4004                            //    new AsyncLegacyOperationStart(
4005                            //        op,
4006                            //        serviceIds[0],
4007                            //        request,
4008                            //        this->getQueueId());
4009                        
4010                            //asyncRequest->dest = serviceIds[0];
4011                        	
4012 kamal.locahana 1.1.2.1 
4013                        		
4014                            PEG_TRACE_STRING(TRC_DISPATCHER, Tracer::LEVEL3,
4015                                "Forwarding " + String(MessageTypeToString(request->getType())) +
4016                                    " to service " + serviceName + ". Response should go to queue " +
4017                                    ((MessageQueue::lookup(request->queueIds.top())) ?
4018                                        String(((MessageQueue::lookup(
4019                                            request->queueIds.top()))->getQueueName()) ) :
4020                                        String("BAD queue name")));
4021                        
4022                            //SendAsync(
4023                            //    op,
4024                            //    serviceIds[0],
4025                            //    CIMDirectAccessRep::_forwardRequestCallback,
4026                            //    this,
4027                            //    requestCopy);
4028                        
4029                        	
4030                            if ( serviceName == "ControlService") {
4031                                response = nspvdr_->processMessage( request );
4032                        		}
4033 kamal.locahana 1.1.2.1 	else if ( serviceName == "IndicationService") {
4034                                response = interoppvdr_->processMessage( request );
4035                        	    }		
4036                        	else if ( serviceName == "IndicationHandlerServicer") {
4037                                response = pvdrregipvdr_->processMessage( request );
4038                        	    } 	
4039                        	else if ( serviceName == "ProviderManagerService") {
4040                                CIMException cimException = PEGASUS_CIM_EXCEPTION(
4041                        					 CIM_ERR_FAILED, ">> qry capab not ready yet");  // fix
4042                        		response = request->buildResponse();
4043                                response->cimException = cimException;
4044                        	    }	
4045                        	else {
4046                                CIMException cimException = PEGASUS_CIM_EXCEPTION(
4047                        						 CIM_ERR_FAILED, ">> unk serviceName");  // fix
4048                        		response = request->buildResponse();
4049                                response->cimException = cimException;
4050                        		}
4051                        
4052                            PEG_METHOD_EXIT();
4053                        	return response;
4054 kamal.locahana 1.1.2.1 } // forwardRequestToService()
4055                        #endif
4056                        
4057                        
4058                        
4059                        #if 0
4060                        //--------------------------------------------------------------------------------
4061                        void CIMDirectAccessRep::handleEnumerateInstancesResponseAggregation( 
4062                                                                     OperationAggregate* poA)
4063                        {
4064                            PEG_METHOD_ENTER(TRC_DISPATCHER,
4065                                "CIMDirectAccessRep::handleEnumerateInstancesResponse");
4066                        
4067                            CIMEnumerateInstancesResponseMessage* toResponse =
4068                                (CIMEnumerateInstancesResponseMessage*)poA->getResponse(0);
4069                        
4070                            PEG_LOGGER_TRACE((Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE,
4071                                "CIMDirectAccessRep::EnumerateInstancesResponseAggregation"
4072                                    "- Namespace: $0 Class name: $1 Response Count: $2",
4073                                poA->_nameSpace.getString(),
4074                                poA->_className.getString(),
4075 kamal.locahana 1.1.2.1         poA->numberResponses()));
4076                        
4077                        
4078                            CIMEnumerateInstancesRequestMessage* request =
4079                                (CIMEnumerateInstancesRequestMessage*)poA->getRequest();
4080                        
4081                            // Work backward and delete each response off the end of the array
4082                            for (Uint32 i = poA->numberResponses() - 1; i > 0; i--)
4083                            {
4084                                CIMEnumerateInstancesResponseMessage* fromResponse =
4085                                    (CIMEnumerateInstancesResponseMessage*)poA->getResponse(i);
4086                        
4087                                for (Uint32 j = 0; j < fromResponse->cimNamedInstances.size(); j++)
4088                                {
4089                                    toResponse->cimNamedInstances.append(
4090                                        fromResponse->cimNamedInstances[j]);
4091                                }
4092                        
4093                                poA->deleteResponse(i);
4094                            }
4095                        
4096 kamal.locahana 1.1.2.1     PEG_LOGGER_TRACE((Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE,
4097                                "CIMDirectAccessRep::"
4098                                "EnumerateInstancesResponseAggregation - "
4099                                "Local Only: $0 Include Qualifiers: $1 Include Class Origin: $2",
4100                                (request->localOnly == true ? "true" : "false"),
4101                                (request->includeQualifiers == true ? "true" : "false"),
4102                                (request->includeClassOrigin == true ? "true" : "false")));
4103                        
4104                            PEG_METHOD_EXIT();
4105                        } // ei resp agg
4106                        
4107                        
4108                        
4109                        
4110                        
4111                        //--------------------------------------------------------------------------
4112                        /* aggregate the responses for enumerateinstancenames into a single response
4113                        */
4114                        void CIMDirectAccessRep::handleEnumerateInstanceNamesResponseAggregation(
4115                                                                        OperationAggregate* poA)
4116                        {
4117 kamal.locahana 1.1.2.1     PEG_METHOD_ENTER(TRC_DISPATCHER,
4118                                "CIMDirectAccessRep::HandleEnumerateInstanceNamesResponseAggregation");
4119                            CIMEnumerateInstanceNamesResponseMessage* toResponse =
4120                                (CIMEnumerateInstanceNamesResponseMessage*) poA->getResponse(0);
4121                        
4122                            PEG_LOGGER_TRACE((Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE,
4123                                "CIMDirectAccessRep::EnumerateInstanceNames Response - "
4124                                    "Namespace: $0  Class name: $1 Response Count: $2",
4125                                poA->_nameSpace.getString(),
4126                                poA->_className.getString(),
4127                                poA->numberResponses()));
4128                        
4129                            // Work backward and delete each response off the end of the array
4130                            for (Uint32 i = poA->numberResponses() - 1; i > 0; i--)
4131                            {
4132                                CIMEnumerateInstanceNamesResponseMessage* fromResponse =
4133                                    (CIMEnumerateInstanceNamesResponseMessage*)poA->getResponse(i);
4134                        
4135                                for (Uint32 j = 0; j < fromResponse->instanceNames.size(); j++)
4136                                {
4137                                    // Duplicate test goes here if we decide to eliminate dups in
4138 kamal.locahana 1.1.2.1             // the future.
4139                                    toResponse->instanceNames.append(fromResponse->instanceNames[j]);
4140                                }
4141                                poA->deleteResponse(i);
4142                            }
4143                            PEG_METHOD_EXIT();
4144                        } // ein resp agg
4145                        #endif
4146                        
4147                        
4148                        
4149                        
4150                        
4151                        //------------------------------------------------------
4152                        class subscri_item  {
4153                            subscri_item( const cimSubscription& );
4154                           ~subscri_item();
4155                            const cimSubscription&  sub_;
4156                            subscri_item           *nxt_;
4157                            Thread                 *th_;
4158                            void *(*thfun_)(void*);
4159 kamal.locahana 1.1.2.1     friend class CIMDirectAccessRep;
4160                            };
4161                        
4162                        
4163                        
4164                        
4165                        
4166                        
4167                        //------------------------------------------------------------
4168                        CIMDirectAccessRep::CIMDirectAccessRep() : 
4169                                  //MessageQueue("CIMDirectAccessRepQ"),
4170                                  pvdrmgrsvc_(NULL), pvdrregimgr_(NULL), reposi_(NULL), 
4171                                  opreqdispatch_(NULL), nspvdr_(NULL), interoppvdr_(NULL), 
4172                                  pvdrregipvdr_(NULL), statdatapvdr_(NULL), cfgpvdr_(NULL), 
4173                                  controlsvc_(NULL), numsubscri_(0), responsemsg_(NULL) {
4174                        
4175                        
4176                            // fix; make as much of the following on-demand rather than creating them
4177                            //      all here in ctor.
4178                        
4179                            runtime_context_is_directaccess_cim = true;
4180 kamal.locahana 1.1.2.1 
4181                        #if PEGASUS_DIRECTACCESS_BUILDTYPE == dacimINTEGRATED
4182                            char * pegHome = new char[100];
4183                            char * envHome = getenv("PEGASUS_HOME");
4184                            strcpy(pegHome,envHome);
4185                        
4186                            if (pegHome != NULL)
4187                            {
4188                        
4189                              ConfigManager::setPegasusHome(String(envHome));
4190                              delete [] pegHome;
4191                            }
4192                        
4193                            String reposirootpath = ConfigManager::getHomedPath(
4194                                                        ConfigManager::getInstance()->
4195                                                            getCurrentValue("repositoryDir"));
4196                        #else
4197                            String reposirootpath = "in-memory repository";
4198                        #endif
4199                            reposi_ = new CIMRepository( reposirootpath );
4200                            pvdrregimgr_ = new ProviderRegistrationManager( reposi_ );
4201 kamal.locahana 1.1.2.1 
4202                        
4203                            
4204                        #if 0  
4205                            pvdrmgrsvc_ = new ProviderManagerService(
4206                                    pvdrregimgr_,  reposi_,
4207                                    DefaultProviderManager::createDefaultProviderManagerCallback ); //>>>fix 
4208                            indihandlersvc_ = new IndicationHandlerService( reposi_ );  // fix; 
4209                                                                                        //crt on 1st subscri
4210                        #endif                                                                
4211                          
4212                            controlsvc_ = new ModuleController(PEGASUS_QUEUENAME_CONTROLSERVICE);
4213                            controlpvdr_.reserveCapacity(5);   // needed??
4214                        #if 0
4215                            //1
4216                            nspvdr_ = new ProviderMessageHandler( 
4217                                                       "NamespaceProvider",
4218                                                       new NamespaceProvider( reposi_ ), 
4219                                                       &indicationCallback, 
4220                                                       &chunkCallback,      false);
4221                            controlpvdr_.append(nspvdr_);
4222 kamal.locahana 1.1.2.1     ModuleController::register_module( PEGASUS_QUEUENAME_CONTROLSERVICE,
4223                                                               PEGASUS_MODULENAME_NAMESPACEPROVIDER,
4224                                                               nspvdr_,
4225                                                               controlProviderReceiveMessageCallback, 0 );
4226                            //2
4227                            interoppvdr_ = new ProviderMessageHandler(
4228                                                       "InteropProvider",
4229                                                       new InteropProvider( reposi_ ), 
4230                                                       &indicationCallback, 
4231                                                       &chunkCallback,      false);
4232                            controlpvdr_.append(interoppvdr_);
4233                            ModuleController::register_module( PEGASUS_QUEUENAME_CONTROLSERVICE,
4234                                                               PEGASUS_MODULENAME_INTEROPPROVIDER,
4235                                                               interoppvdr_,
4236                                                               controlProviderReceiveMessageCallback, 0 );
4237                            //3
4238                            pvdrregipvdr_ = new ProviderMessageHandler(
4239                                                       "ProviderRegistrationProvider",
4240                                                       new ProviderRegistrationProvider( pvdrregimgr_ ), 
4241                                                       &indicationCallback, 
4242                                                       &chunkCallback,      false);
4243 kamal.locahana 1.1.2.1     controlpvdr_.append(pvdrregipvdr_);
4244                            ModuleController::register_module( PEGASUS_QUEUENAME_CONTROLSERVICE,
4245                                                               PEGASUS_MODULENAME_PROVREGPROVIDER,
4246                                                               pvdrregipvdr_,
4247                                                               controlProviderReceiveMessageCallback, 0 );
4248                            //4
4249                            statdatapvdr_ = new ProviderMessageHandler(
4250                                                       "CIMOMStatDataProvider",
4251                                                       new CIMOMStatDataProvider(), 
4252                                                       &indicationCallback, 
4253                                                       &chunkCallback,      false);
4254                            controlpvdr_.append(statdatapvdr_);
4255                            ModuleController::register_module( PEGASUS_QUEUENAME_CONTROLSERVICE,
4256                                                               PEGASUS_MODULENAME_CIMOMSTATDATAPROVIDER,
4257                                                               statdatapvdr_,
4258                                                               controlProviderReceiveMessageCallback, 0 );
4259                            //5
4260                            cfgpvdr_ = new ProviderMessageHandler(
4261                                                       "ConfigSettingProvider",
4262                                                       new ConfigSettingProvider(), 
4263                                                       &indicationCallback, 
4264 kamal.locahana 1.1.2.1                                &chunkCallback,      false);
4265                            controlpvdr_.append(cfgpvdr_);
4266                            ModuleController::register_module( PEGASUS_QUEUENAME_CONTROLSERVICE,
4267                                                               PEGASUS_MODULENAME_CONFIGPROVIDER,
4268                                                               cfgpvdr_,
4269                                                               controlProviderReceiveMessageCallback, 0 );
4270                        #endif
4271                        
4272                        opreqdispatch__ =   
4273                            opreqdispatch_ = new CIMOperationRequestDispatcher( reposi_, pvdrregimgr_ );
4274                        PEGASUS_ASSERT(opreqdispatch_ == opreqdispatch__);
4275                            pvdrregimgr_->initializeProviders();  // fix; need this? 
4276                            runtime_context_is_directaccess_cim = false; // set again in do_request()
4277                                                                         // needed??  fix
4278                        
4279                        this__ = this;	
4280                        PEGASUS_ASSERT(this == this__);
4281                        
4282                        
4283                            //verify(__FILE__,__LINE__);
4284                        
4285 kamal.locahana 1.1.2.1     } // ctor
4286                        
4287                        
4288                        
4289                        //---------------------------------------------------------------------------
4290                        ProviderManagerService *CIMDirectAccessRep::odiniter_(ProviderManagerService*) { 
4291                            if (!pvdrmgrsvc_) { // a service (not a ctl pvdr)
4292                                pvdrmgrsvc_ = new ProviderManagerService( 
4293                                                  pvdrregimgr_,  reposi_,  
4294                                                  DefaultProviderManager::
4295                                                                  createDefaultProviderManagerCallback
4296                                                  );   
4297                            }
4298                            return pvdrmgrsvc_;
4299                        }
4300                        #if PEGASUS_DIRECTACCESS_BUILDTYPE >= dacimSEPREPOSI
4301                        //---------------------------------------------------------------------------
4302                        IndicationHandlerService *CIMDirectAccessRep::odiniter_(
4303                                                                   IndicationHandlerService*) { 
4304                            if (!indihandlersvc_) { // a service (not a ctl pvdr)
4305                                indihandlersvc_ = new IndicationHandlerService( reposi_ );  // fix; 
4306 kamal.locahana 1.1.2.1     }
4307                            return indihandlersvc_;
4308                        }    
4309                        #endif
4310                        //---------------------------------------------------------------------------
4311                        ProviderMessageHandler *CIMDirectAccessRep::odiniter_(NamespaceProvider*) { 
4312                            if (!nspvdr_) { //1
4313                                nspvdr_ = new ProviderMessageHandler( 
4314                                    "NamespaceProvider",  new NamespaceProvider( reposi_ ), 
4315                                    &indicationCallback,  &chunkCallback,      false);
4316                                controlpvdr_.append(nspvdr_);
4317                                ModuleController::register_module( PEGASUS_QUEUENAME_CONTROLSERVICE,
4318                                    PEGASUS_MODULENAME_NAMESPACEPROVIDER,  nspvdr_,
4319                                    controlProviderReceiveMessageCallback, 0 );
4320                                }
4321                            return nspvdr_;
4322                        }    
4323                        //---------------------------------------------------------------------------
4324                        ProviderMessageHandler *CIMDirectAccessRep::odiniter_(InteropProvider*) { 
4325                            if (!interoppvdr_) { //2
4326                                interoppvdr_ = new ProviderMessageHandler(
4327 kamal.locahana 1.1.2.1             "InteropProvider", new InteropProvider( reposi_ ), 
4328                                    &indicationCallback,  &chunkCallback,      false);
4329                                controlpvdr_.append(interoppvdr_);
4330                                ModuleController::register_module( PEGASUS_QUEUENAME_CONTROLSERVICE,
4331                                    PEGASUS_MODULENAME_INTEROPPROVIDER, interoppvdr_,
4332                                    controlProviderReceiveMessageCallback, 0 );
4333                            }
4334                            return interoppvdr_;
4335                        }
4336                        //---------------------------------------------------------------------------
4337                        ProviderMessageHandler *CIMDirectAccessRep::odiniter_(
4338                                                              ProviderRegistrationProvider*) { 
4339                            if (!pvdrregipvdr_) { //3
4340                                pvdrregipvdr_ = new ProviderMessageHandler(
4341                                    "ProviderRegistrationProvider",
4342                                    new ProviderRegistrationProvider( pvdrregimgr_ ), 
4343                                    &indicationCallback,  &chunkCallback,      false);
4344                                controlpvdr_.append(pvdrregipvdr_);
4345                                ModuleController::register_module( PEGASUS_QUEUENAME_CONTROLSERVICE,
4346                                    PEGASUS_MODULENAME_PROVREGPROVIDER,  pvdrregipvdr_,
4347                                    controlProviderReceiveMessageCallback, 0 );
4348 kamal.locahana 1.1.2.1     }
4349                            return pvdrregipvdr_;
4350                        }
4351                        //---------------------------------------------------------------------------
4352                        ProviderMessageHandler *CIMDirectAccessRep::odiniter_(CIMOMStatDataProvider*) { 
4353                            if (!statdatapvdr_) { //4
4354                                statdatapvdr_ = new ProviderMessageHandler(
4355                                    "CIMOMStatDataProvider",    new CIMOMStatDataProvider(), 
4356                                    &indicationCallback,   &chunkCallback,      false);
4357                                controlpvdr_.append(statdatapvdr_);
4358                                ModuleController::register_module( PEGASUS_QUEUENAME_CONTROLSERVICE,
4359                                    PEGASUS_MODULENAME_CIMOMSTATDATAPROVIDER,     statdatapvdr_,
4360                                    controlProviderReceiveMessageCallback, 0 );
4361                            }
4362                            return statdatapvdr_;
4363                        }
4364                        //---------------------------------------------------------------------------
4365                        ProviderMessageHandler *CIMDirectAccessRep::odiniter_(ConfigSettingProvider*) { 
4366                            if (!cfgpvdr_) { //5
4367                                cfgpvdr_ = new ProviderMessageHandler(
4368                                    "ConfigSettingProvider",   new ConfigSettingProvider(), 
4369 kamal.locahana 1.1.2.1             &indicationCallback,   &chunkCallback,      false);
4370                                controlpvdr_.append(cfgpvdr_);
4371                                ModuleController::register_module( PEGASUS_QUEUENAME_CONTROLSERVICE,
4372                                    PEGASUS_MODULENAME_CONFIGPROVIDER,   cfgpvdr_,
4373                                    controlProviderReceiveMessageCallback, 0 );
4374                            }
4375                            return cfgpvdr_;
4376                        }
4377                        #if PEGASUS_DIRECTACCESS_BUILDTYPE >= dacimSEPREPOSI           
4378                        //---------------------------------------------------------------------------
4379                        IndicationService *CIMDirectAccessRep::odiniter_(IndicationService*) { 
4380                            if (!indisvc_) { // a service (not a ctl pvdr)
4381                                // For this dacim buildtype, follow to cim server build parms
4382                                // when appropriate. By default, this svc is enabled.
4383                                ConfigManager *cm = ConfigManager::getInstance();   // save this?
4384                                if (ConfigManager::parseBooleanValue(
4385                                    cm->getCurrentValue("enableIndicationService")) )  {
4386                                    indisvc_ = new IndicationService( reposi_, pvdrregimgr_ );
4387                                    }
4388                                else {
4389                                    CIMException cimException = PEGASUS_CIM_EXCEPTION(
4390 kamal.locahana 1.1.2.1                 CIM_ERR_NOT_SUPPORTED, "Not configured for Indication Service");
4391                                    throw cimException;  // maybe a more graceful way is better?
4392                                }
4393                            }
4394                            return indisvc_;
4395                        }
4396                        #endif
4397                        
4398                        
4399                        
4400                        
4401                        static subscri_item  *subscri_1 = NULL;
4402                        static int numsubscri_item = 0;
4403                        
4404                        
4405                        
4406                        //-----------------------------------------------
4407                        CIMDirectAccessRep::~CIMDirectAccessRep() {
4408                            //{
4409                            //    AutoMutex a(arequestlock_);   
4410                            //    if (!_dacim_) return;
4411 kamal.locahana 1.1.2.1     //    _dacim_ = NULL;
4412                            //}
4413                        
4414                            delete opreqdispatch_;
4415                        
4416                            for (int i=0, n=controlpvdr_.size(); i<n; ++i) {
4417                                // these are deleted here; cfgpvdr_, statdatapvdr_, 
4418                                // pvdrregipvdr_, interoppvdr_, nspvdr_;
4419                                ProviderMessageHandler *p = controlpvdr_[i];
4420                                delete p->getProvider();
4421                                delete p;
4422                                }
4423                        
4424                            delete controlsvc_;
4425                        #if PEGASUS_DIRECTACCESS_BUILDTYPE >= dacimSEPREPOSI    
4426                            delete indisvc_;
4427                            delete indihandlersvc_;
4428                        #endif    
4429                            delete pvdrmgrsvc_;
4430                            delete pvdrregimgr_;
4431                            delete reposi_;
4432 kamal.locahana 1.1.2.1     while(subscri_1) delete subscri_1;
4433                            }
4434                        
4435                        
4436                        
4437                        
4438                        //--------------------------------------------------------------
4439                        void CIMDirectAccessRep::addSubscription( cimSubscription& s ) {
4440                            if (s.subscriptionName == "*") return; 
4441                            if (!isvalidsubscription_(s)) { 
4442                                String msg = "Invalid data in cimSubscription. subscriptionName = ";
4443                                msg.append(s.subscriptionName);
4444                                throw Exception(msg); 
4445                                }
4446                            if (isduplicatesubscription_(s)) { 
4447                                String msg = "Duplicate cimSubscription. subscriptionName = ";
4448                                msg.append(s.subscriptionName);
4449                                throw Exception(msg); 
4450                                }
4451                            //CIMRequestMessage *indimsg = (CIMRequestMessage*)mkMessage_( s );
4452                            //Message *respmsg = odiniter_(pvdrmgrsvc_)->_processMessage( indimsg );
4453 kamal.locahana 1.1.2.1     // >>>what err ckg needed here?
4454                            // 
4455                            // IndicationService::_handleCreateInstanceRequest() throws this if 
4456                            // no eligable pvdrs are found.
4457                            //     throw PEGASUS_CIM_EXCEPTION_L (CIM_ERR_NOT_SUPPORTED,
4458                            //              MessageLoaderParms(_MSG_NO_PROVIDERS_KEY,
4459                            //              _MSG_NO_PROVIDERS));
4460                            //                                                             
4461                            new subscri_item( s ); 
4462                            }
4463                        
4464                        
4465                        
4466                        
4467                        //-------------------------------------------------------------------
4468                        void CIMDirectAccessRep::removeSubscription( const cimSubscription& s ) {
4469                            if (s.subscriptionName == "*") { 
4470                                while(subscri_1) delete subscri_1; 
4471                                }
4472                            else delete findsubscription_(s);
4473                            }
4474 kamal.locahana 1.1.2.1 
4475                        
4476                        
4477                        //--------------------------------------------------------
4478                        bool CIMDirectAccessRep::isvalidsubscription_( const cimSubscription& s ) { 
4479                            return s.isvalid();
4480                            }
4481                        //-----------------------------------------------------------
4482                        bool CIMDirectAccessRep::isduplicatesubscription_( const cimSubscription& s ) {
4483                            return findsubscription_(s) != NULL;
4484                            }
4485                        //-----------------------------------------------------------
4486                        subscri_item *CIMDirectAccessRep::findsubscription_( const cimSubscription& s ) {
4487                            subscri_item *si = subscri_1;
4488                            while( si ) {
4489                                if (si->sub_ == s) return si;
4490                                si = si->nxt_;
4491                                }
4492                            return NULL;
4493                            }
4494                        
4495 kamal.locahana 1.1.2.1 
4496                        
4497                        
4498                        //------------------------------------------------------
4499                        void CIMDirectAccessRep::verify(const char *file, int line) {
4500                            #if 0
4501                            printf("CIMDirectAccessRep::verify() calledfrom %s, %d:"
4502                                   " this(%p), reposi_(%p),\n    interoppvdr_(%p),interoppvdr__(%p),"
4503                                   "nspvdr_(%p),nspvdr__(%p)\n",
4504                                   file, line,this,reposi_,interoppvdr_,interoppvdr__,nspvdr_,nspvdr__);
4505                            #endif
4506                           
4507                            if ((void*)this != this__) {
4508                                }
4509                            if ((void*)reposi_ != reposi__) {
4510                                }
4511                            if ((void*)interoppvdr_ != interoppvdr__) {
4512                                interoppvdr_ = (ProviderMessageHandler*)interoppvdr__;
4513                                }
4514                            if ((void*)nspvdr_ != nspvdr__) {
4515                                nspvdr_ = (ProviderMessageHandler*)nspvdr__;
4516 kamal.locahana 1.1.2.1         }
4517                            if ((void*)statdatapvdr_ != statdatapvdr__) {
4518                                statdatapvdr_ = (ProviderMessageHandler*)statdatapvdr__;
4519                                }
4520                            }
4521                        
4522                        
4523                        
4524                        //---------------------------------------------------------
4525                        subscri_item::subscri_item( const cimSubscription& s ) : sub_(s), nxt_(NULL), 
4526                                                                                 th_(NULL), thfun_(NULL) {
4527                            if (subscri_1 == NULL) subscri_1 = this;
4528                            else { 
4529                                subscri_item *si = subscri_1;
4530                                while(si->nxt_) si=si->nxt_;
4531                                si->nxt_ = this;   
4532                                }
4533                            ++numsubscri_item;
4534                            //thfun_ = &s.indicationCallback;    //>>>tbd
4535                            Thread th_( thfun_, NULL, false );
4536                            }
4537 kamal.locahana 1.1.2.1 
4538                        
4539                        
4540                        //---------------------------------------
4541                        subscri_item::~subscri_item() {
4542                            // need to delete th_?                      //>>tbd
4543                            if (subscri_1 == this) subscri_1 = nxt_;
4544                            else {
4545                                subscri_item *s1 = subscri_1,
4546                                             *s2 = subscri_1->nxt_;
4547                                while(s1 && s2) {         
4548                                    if (s2 == this) {
4549                                        s1->nxt_ = s2->nxt_;
4550                                        break;
4551                                        }
4552                                    s1 = s2;
4553                                    s2 = s2->nxt_;
4554                                    if (s2 == NULL) break;
4555                                    }
4556                                }
4557                            --numsubscri_item;
4558 kamal.locahana 1.1.2.1     }
4559                        
4560                        
4561                        
4562                        
4563                        
4564                        
4565                        //------------------------------------------------------------
4566                        static String _showPropertyList(const CIMPropertyList& pl)
4567                        {
4568                            String returnString;
4569                        
4570                            if (pl.isNull())
4571                            {
4572                                returnString = "NULL";
4573                            }
4574                            else if (pl.size() == 0)
4575                            {
4576                                returnString = "EMPTY";
4577                            }
4578                            else
4579 kamal.locahana 1.1.2.1     {
4580                                for (Uint32 i = 0; i < pl.size(); i++)
4581                                {
4582                                    if (i > 0)
4583                                    {
4584                                        returnString.append(", ");
4585                                    }
4586                                    returnString.append(pl[i].getString());
4587                                }
4588                            }
4589                        
4590                            return returnString;
4591                        }
4592                        
4593                        
4594                        
4595                        
4596                        
4597                        
4598                        PEGASUS_NAMESPACE_END

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2