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

Diff for /pegasus/src/Pegasus/ProviderManager2/Default/DefaultProviderManager.cpp between version 1.80 and 1.96

version 1.80, 2007/08/21 20:10:22 version 1.96, 2014/08/27 23:10:11
Line 1 
Line 1 
 //%2006////////////////////////////////////////////////////////////////////////  //%LICENSE////////////////////////////////////////////////////////////////
 // //
 // Copyright (c) 2000, 2001, 2002 BMC Software; Hewlett-Packard Development  // Licensed to The Open Group (TOG) under one or more contributor license
 // Company, L.P.; IBM Corp.; The Open Group; Tivoli Systems.  // agreements.  Refer to the OpenPegasusNOTICE.txt file distributed with
 // Copyright (c) 2003 BMC Software; Hewlett-Packard Development Company, L.P.;  // this work for additional information regarding copyright ownership.
 // IBM Corp.; EMC Corporation, The Open Group.  // Each contributor licenses this file to you under the OpenPegasus Open
 // Copyright (c) 2004 BMC Software; Hewlett-Packard Development Company, L.P.;  // Source License; you may not use this file except in compliance with the
 // IBM Corp.; EMC Corporation; VERITAS Software Corporation; The Open Group.  // License.
 // Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.;  //
 // EMC Corporation; VERITAS Software Corporation; The Open Group.  // Permission is hereby granted, free of charge, to any person obtaining a
 // Copyright (c) 2006 Hewlett-Packard Development Company, L.P.; IBM Corp.;  // copy of this software and associated documentation files (the "Software"),
 // EMC Corporation; Symantec Corporation; The Open Group.  // to deal in the Software without restriction, including without limitation
 //  // the rights to use, copy, modify, merge, publish, distribute, sublicense,
 // Permission is hereby granted, free of charge, to any person obtaining a copy  // and/or sell copies of the Software, and to permit persons to whom the
 // of this software and associated documentation files (the "Software"), to  // Software is furnished to do so, subject to the following conditions:
 // deal in the Software without restriction, including without limitation the  //
 // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or  // The above copyright notice and this permission notice shall be included
 // sell copies of the Software, and to permit persons to whom the Software is  // in all copies or substantial portions of the Software.
 // furnished to do so, subject to the following conditions:  //
 //  // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
 // THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN  // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
 // ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED  // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
 // "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT  // IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
 // LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR  // CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
 // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT  // TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
 // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN  // SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 // ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION  
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.  
 // //
 //==============================================================================  //////////////////////////////////////////////////////////////////////////
 // //
 //%///////////////////////////////////////////////////////////////////////////// //%/////////////////////////////////////////////////////////////////////////////
  
Line 51 
Line 49 
  
 PEGASUS_NAMESPACE_BEGIN PEGASUS_NAMESPACE_BEGIN
  
   
   // A request class to hold the provider info passed to the
   // AsyncRequestExecutor for processing on different threads.
   class UnloadProviderRequest : public AsyncRequestExecutor::AsyncRequestMsg
   {
   public:
       UnloadProviderRequest(ProviderMessageHandler* provider)
           :_provider(provider) {}
   
   public:
       ProviderMessageHandler* _provider;
   };
   
 // //
 // Default Provider Manager // Default Provider Manager
 // //
Line 150 
Line 161 
             response = _handleSubscriptionInitCompleteRequest(request);             response = _handleSubscriptionInitCompleteRequest(request);
             break;             break;
  
 // Note: The PG_Provider AutoStart property is not yet supported          case CIM_INDICATION_SERVICE_DISABLED_REQUEST_MESSAGE:
 #if 0              response = _handleIndicationServiceDisabledRequest(request);
         case CIM_INITIALIZE_PROVIDER_REQUEST_MESSAGE:  
         {  
             ProviderIdContainer providerId =  
                 request->operationContext.get(ProviderIdContainer::NAME);  
   
             // resolve provider name  
             ProviderName name = _resolveProviderName(providerId);  
   
             // get cached or load new provider module  
             ProviderOperationCounter poc(  
                 _getProvider(  
                     name.getPhysicalName(),  
                     name.getModuleName(),  
                     name.getLogicalName()));  
   
             break;             break;
         }  
 #endif  
  
         default:         default:
             PEGASUS_ASSERT(0);              PEGASUS_UNREACHABLE(PEGASUS_ASSERT(0);)
             break;             break;
         }         }
     }     }
     catch (CIMException& e)     catch (CIMException& e)
     {     {
         PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL2,          PEG_TRACE((TRC_PROVIDERMANAGER, Tracer::LEVEL1,"CIMException: %s",
             "CIMException: " + e.getMessage());              (const char*)e.getMessage().getCString()));
         response = request->buildResponse();         response = request->buildResponse();
         response->cimException = PEGASUS_CIM_EXCEPTION_LANG(         response->cimException = PEGASUS_CIM_EXCEPTION_LANG(
             e.getContentLanguages(), e.getCode(), e.getMessage());             e.getContentLanguages(), e.getCode(), e.getMessage());
     }     }
     catch (Exception& e)     catch (Exception& e)
     {     {
         PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL2,          PEG_TRACE((TRC_PROVIDERMANAGER, Tracer::LEVEL1,"Exception: %s",
             "Exception: " + e.getMessage());              (const char*)e.getMessage().getCString()));
         response = request->buildResponse();         response = request->buildResponse();
         response->cimException = PEGASUS_CIM_EXCEPTION_LANG(         response->cimException = PEGASUS_CIM_EXCEPTION_LANG(
             e.getContentLanguages(), CIM_ERR_FAILED, e.getMessage());             e.getContentLanguages(), CIM_ERR_FAILED, e.getMessage());
     }     }
     catch (...)     catch (...)
     {     {
         PEG_TRACE_CSTRING(TRC_PROVIDERMANAGER, Tracer::LEVEL2,          PEG_TRACE_CSTRING(TRC_PROVIDERMANAGER, Tracer::LEVEL1,
             "Exception: Unknown");             "Exception: Unknown");
         response = request->buildResponse();         response = request->buildResponse();
         response->cimException = PEGASUS_CIM_EXCEPTION(         response->cimException = PEGASUS_CIM_EXCEPTION(
Line 223 
Line 217 
         // get provider module name         // get provider module name
         String moduleName;         String moduleName;
         CIMInstance mInstance = request->providerModule;         CIMInstance mInstance = request->providerModule;
         Uint32 pos = mInstance.findProperty(CIMName("Name"));          Uint32 pos = mInstance.findProperty(PEGASUS_PROPERTYNAME_NAME);
         PEGASUS_ASSERT(pos != PEG_NOT_FOUND);         PEGASUS_ASSERT(pos != PEG_NOT_FOUND);
         mInstance.getProperty(pos).getValue().get(moduleName);         mInstance.getProperty(pos).getValue().get(moduleName);
  
Line 236 
Line 230 
         {         {
             String pName;             String pName;
             providerInstances[i].getProperty(             providerInstances[i].getProperty(
                 providerInstances[i].findProperty("Name")).                  providerInstances[i].findProperty(PEGASUS_PROPERTYNAME_NAME)).
                     getValue().get(pName);                     getValue().get(pName);
  
             Sint16 ret_value = _disableProvider(moduleName, pName);             Sint16 ret_value = _disableProvider(moduleName, pName);
Line 262 
Line 256 
     }     }
     catch (CIMException& e)     catch (CIMException& e)
     {     {
         PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,          PEG_TRACE((TRC_PROVIDERMANAGER, Tracer::LEVEL1,"CIMException: %s",
                          "Exception: " + e.getMessage());              (const char*)e.getMessage().getCString()));
         cimException = e;         cimException = e;
     }     }
     catch (Exception& e)     catch (Exception& e)
     {     {
         PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,          PEG_TRACE((TRC_PROVIDERMANAGER, Tracer::LEVEL1,"Exception: %s",
             "Exception: " + e.getMessage());              (const char*)e.getMessage().getCString()));
         cimException = CIMException(CIM_ERR_FAILED, e.getMessage());         cimException = CIMException(CIM_ERR_FAILED, e.getMessage());
     }     }
     catch (...)     catch (...)
     {     {
         PEG_TRACE_CSTRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,          PEG_TRACE_CSTRING(TRC_PROVIDERMANAGER, Tracer::LEVEL1,
             "Exception: Unknown");             "Exception: Unknown");
         cimException = PEGASUS_CIM_EXCEPTION_L(         cimException = PEGASUS_CIM_EXCEPTION_L(
             CIM_ERR_FAILED,             CIM_ERR_FAILED,
Line 333 
Line 327 
     return response;     return response;
 } }
  
   
   CIMResponseMessage*
   DefaultProviderManager::_handleIndicationServiceDisabledRequest(
       CIMRequestMessage* message)
   {
       PEG_METHOD_ENTER(TRC_PROVIDERMANAGER,
           "DefaultProviderManager::_handleIndicationServiceDisabledRequest");
   
       CIMIndicationServiceDisabledRequestMessage* request =
           dynamic_cast<CIMIndicationServiceDisabledRequestMessage*>(message);
       PEGASUS_ASSERT(request != 0);
   
       CIMIndicationServiceDisabledResponseMessage* response =
           dynamic_cast<CIMIndicationServiceDisabledResponseMessage*>(
               request->buildResponse());
       PEGASUS_ASSERT(response != 0);
   
       _subscriptionInitComplete = false;
   
       // Make a copy of the table so it is not locked during the provider calls
       Array<ProviderMessageHandler*> providerList;
       {
           AutoMutex lock(_providerTableMutex);
   
           for (ProviderTable::Iterator i = _providers.start(); i != 0; i++)
           {
               providerList.append(i.value());
           }
       }
   
       //
       // Notify all providers that indication service is disabled
       //
       for (Uint32 j = 0; j < providerList.size(); j++)
       {
           AutoMutex lock(providerList[j]->status.getStatusMutex());
   
           if (providerList[j]->status.isInitialized())
           {
               providerList[j]->indicationServiceDisabled();
           }
       }
   
       PEG_METHOD_EXIT();
       return response;
   }
   
 CIMResponseMessage* CIMResponseMessage*
 DefaultProviderManager::_handleSubscriptionInitCompleteRequest( DefaultProviderManager::_handleSubscriptionInitCompleteRequest(
     CIMRequestMessage* message)     CIMRequestMessage* message)
Line 388 
Line 429 
     CIMValue genericValue;     CIMValue genericValue;
  
     genericValue = providerId.getModule().getProperty(     genericValue = providerId.getModule().getProperty(
         providerId.getModule().findProperty("Name")).getValue();          providerId.getModule().findProperty(
               PEGASUS_PROPERTYNAME_NAME)).getValue();
     genericValue.get(moduleName);     genericValue.get(moduleName);
  
     genericValue = providerId.getProvider().getProperty(     genericValue = providerId.getProvider().getProperty(
         providerId.getProvider().findProperty("Name")).getValue();          providerId.getProvider().findProperty(
               PEGASUS_PROPERTYNAME_NAME)).getValue();
     genericValue.get(providerName);     genericValue.get(providerName);
  
     genericValue = providerId.getModule().getProperty(     genericValue = providerId.getModule().getProperty(
Line 404 
Line 447 
     if (resolvedFileName == String::EMPTY)     if (resolvedFileName == String::EMPTY)
     {     {
         // Provider library not found         // Provider library not found
         String moduleName;  
         genericValue = providerId.getModule().getProperty(  
             providerId.getModule().findProperty("Name")).getValue();  
         genericValue.get(moduleName);  
   
         throw Exception(MessageLoaderParms(         throw Exception(MessageLoaderParms(
             "ProviderManager.ProviderManagerService.PROVIDER_FILE_NOT_FOUND",             "ProviderManager.ProviderManagerService.PROVIDER_FILE_NOT_FOUND",
             "File \"$0\" was not found for provider module \"$1\".",             "File \"$0\" was not found for provider module \"$1\".",
Line 444 
Line 482 
  
     ProviderOperationCounter poc(pr);     ProviderOperationCounter poc(pr);
  
     PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,      PEG_TRACE((TRC_PROVIDERMANAGER, Tracer::LEVEL4,"Returning Provider %s",
         "Returning Provider " + providerName);          (const char*)providerName.getCString()));
  
     PEG_METHOD_EXIT();     PEG_METHOD_EXIT();
     return poc;     return poc;
Line 473 
Line 511 
     ProviderMessageHandler* pr = 0;     ProviderMessageHandler* pr = 0;
     if (_providers.lookup(key, pr))     if (_providers.lookup(key, pr))
     {     {
         PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,          PEG_TRACE((TRC_PROVIDERMANAGER, Tracer::LEVEL4,
             "Found Provider " + providerName + " in Provider Manager Cache");              "Found Provider %s in Provider Manager Cache",
               (const char*)providerName.getCString()));
     }     }
     else     else
     {     {
         // create provider         // create provider
         pr = new ProviderMessageHandler(         pr = new ProviderMessageHandler(
             providerName, 0, _indicationCallback, _responseChunkCallback,              moduleName, providerName,
               0, _indicationCallback, _responseChunkCallback,
             _subscriptionInitComplete);             _subscriptionInitComplete);
  
         // insert provider in provider table         // insert provider in provider table
         _providers.insert(key, pr);         _providers.insert(key, pr);
  
         PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,          PEG_TRACE((TRC_PROVIDERMANAGER, Tracer::LEVEL4,"Created provider %s",
             "Created provider " + pr->getName());              (const char*)pr->getName().getCString()));
     }     }
  
     PEG_METHOD_EXIT();     PEG_METHOD_EXIT();
Line 516 
Line 556 
         return provider;         return provider;
     }     }
  
     PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,      PEG_TRACE((TRC_PROVIDERMANAGER, Tracer::LEVEL4,
         "Loading/Linking Provider Module " + moduleFileName);          "Loading/Linking Provider Module %s",
           (const char*)moduleFileName.getCString()));
  
     // load the provider     // load the provider
     try     try
Line 526 
Line 567 
     }     }
     catch (...)     catch (...)
     {     {
         PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,          PEG_TRACE((TRC_PROVIDERMANAGER, Tracer::LEVEL1,
             "Exception caught Loading/Linking Provider Module " +              "Exception caught Loading/Linking Provider Module %s",
             moduleFileName);              (const char*)moduleFileName.getCString()));
         PEG_METHOD_EXIT();         PEG_METHOD_EXIT();
         throw;         throw;
     }     }
  
     // initialize the provider     // initialize the provider
     PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL2,      PEG_TRACE((TRC_PROVIDERMANAGER, Tracer::LEVEL2, "Initializing Provider %s",
         "Initializing Provider " + provider->getName());          (const char*)provider->getName().getCString()));
  
     CIMOMHandle* cimomHandle = new CIMOMHandle();     CIMOMHandle* cimomHandle = new CIMOMHandle();
     provider->status.setCIMOMHandle(cimomHandle);     provider->status.setCIMOMHandle(cimomHandle);
Line 550 
Line 591 
     }     }
     catch (...)     catch (...)
     {     {
           PEG_TRACE((TRC_PROVIDERMANAGER, Tracer::LEVEL3,
               "Initialization Error.  Provider %s",
               (const char*)provider->getName().getCString()));
         initializeError = true;         initializeError = true;
     }     }
  
Line 599 
Line 643 
     if (_modules.lookup(moduleFileName, module))     if (_modules.lookup(moduleFileName, module))
     {     {
         // found provider module in cache         // found provider module in cache
         PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,          PEG_TRACE((TRC_PROVIDERMANAGER, Tracer::LEVEL4,
             "Found Provider Module " + moduleFileName +              "Found Provider Module %s in Provider Manager Cache",
             " in Provider Manager Cache");              (const char*)moduleFileName.getCString()));
     }     }
     else     else
     {     {
         // provider module not found in cache, create provider module         // provider module not found in cache, create provider module
         PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,          PEG_TRACE((TRC_PROVIDERMANAGER, Tracer::LEVEL4,
             "Creating Provider Module " + moduleFileName);              "Creating Provider Module %s",
               (const char*)moduleFileName.getCString()));
  
         module = new ProviderModule(moduleFileName);         module = new ProviderModule(moduleFileName);
  
Line 643 
Line 688 
     catch (...)     catch (...)
     {     {
         // Unexpected exception; do not assume that no providers are loaded         // Unexpected exception; do not assume that no providers are loaded
         PEG_TRACE_CSTRING(TRC_PROVIDERMANAGER, Tracer::LEVEL2,          PEG_TRACE_CSTRING(TRC_PROVIDERMANAGER, Tracer::LEVEL1,
             "Unexpected Exception in hasActiveProviders.");             "Unexpected Exception in hasActiveProviders.");
         PEG_METHOD_EXIT();         PEG_METHOD_EXIT();
         return true;         return true;
Line 689 
Line 734 
             struct timeval providerTime = {0, 0};             struct timeval providerTime = {0, 0};
             provider->status.getLastOperationEndTime(&providerTime);             provider->status.getLastOperationEndTime(&providerTime);
  
             PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,              PEG_TRACE((TRC_PROVIDERMANAGER, Tracer::LEVEL4,
                 "provider->status.isIdle() returns: " +                  "provider->status.isIdle() returns: %s",
                 CIMValue(provider->status.isIdle()).toString());                  (const char*)CIMValue(provider->status.isIdle())
                          .toString().getCString()));
  
             if (provider->status.isIdle() &&             if (provider->status.isIdle() &&
                 ((now.tv_sec - providerTime.tv_sec) > ((Sint32)IDLE_LIMIT)))                  ((now.tv_sec - providerTime.tv_sec) >
                    ((Sint32)PEGASUS_PROVIDER_IDLE_TIMEOUT_SECONDS)))
             {             {
                 PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL2,                  PEG_TRACE((TRC_PROVIDERMANAGER, Tracer::LEVEL3,
                     "Unloading idle provider: " + provider->getName());                      "Unloading idle provider: %s",
                       (const char*)provider->getName().getCString()));
                 _unloadProvider(provider);                 _unloadProvider(provider);
             }             }
         }         }
     }     }
     catch (...)     catch (...)
     {     {
         PEG_TRACE_CSTRING(TRC_PROVIDERMANAGER, Tracer::LEVEL2,          PEG_TRACE_CSTRING(TRC_PROVIDERMANAGER, Tracer::LEVEL1,
             "Caught unexpected exception in unloadIdleProviders.");             "Caught unexpected exception in unloadIdleProviders.");
     }     }
  
Line 716 
Line 764 
     PEG_METHOD_ENTER(TRC_PROVIDERMANAGER,     PEG_METHOD_ENTER(TRC_PROVIDERMANAGER,
         "DefaultProviderManager::_shutdownAllProviders");         "DefaultProviderManager::_shutdownAllProviders");
  
     try  
     {  
         AutoMutex lock(_providerTableMutex);         AutoMutex lock(_providerTableMutex);
   
         PEG_TRACE((TRC_PROVIDERMANAGER, Tracer::LEVEL4,         PEG_TRACE((TRC_PROVIDERMANAGER, Tracer::LEVEL4,
             "providers in cache = %d", _providers.size()));             "providers in cache = %d", _providers.size()));
  
       //create an array of UnloadProviderRequest requests one per
       //provider to process shutdown of providers simultaneously.
       Array<AsyncRequestExecutor::AsyncRequestMsg*> ProviderRequests;
         for (ProviderTable::Iterator i = _providers.start(); i != 0; i++)         for (ProviderTable::Iterator i = _providers.start(); i != 0; i++)
         {         {
             ProviderMessageHandler* provider = i.value();          AutoMutex lock(i.value()->status.getStatusMutex());
             PEGASUS_ASSERT(provider != 0);          if(i.value()->status.isInitialized())
   
             AutoMutex lock(provider->status.getStatusMutex());  
   
             if (provider->status.isInitialized())  
             {             {
                 _unloadProvider(provider);              ProviderRequests.append(
                   new UnloadProviderRequest(i.value()));
             }             }
         }         }
     }  
     catch (...)      //run the stop request on all providers on multiple threads using
       //the request executor. This will invoke _asyncRequestCallback() on a
       //seperate thread for each provider which in turn will unload that
       //provider.
   
       CIMException exception =
           AsyncRequestExecutor(&_asyncRequestCallback,this).executeRequests(
               ProviderRequests);
   
       if(exception.getCode() != CIM_ERR_SUCCESS)
     {     {
         PEG_TRACE_CSTRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,          PEG_TRACE_CSTRING(TRC_PROVIDERMANAGER, Tracer::LEVEL2,
             "Unexpected Exception in _shutdownAllProviders().");             "Unexpected Exception in _shutdownAllProviders().");
     }     }
  
Line 755 
Line 809 
     ProviderMessageHandler* pr = _lookupProvider(moduleName, providerName);     ProviderMessageHandler* pr = _lookupProvider(moduleName, providerName);
     if (!pr->status.isInitialized())     if (!pr->status.isInitialized())
     {     {
         PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL2,          PEG_TRACE((TRC_PROVIDERMANAGER, Tracer::LEVEL2,
             "Provider " + providerName + " is not loaded");              "Provider %s is not loaded",
               (const char*)providerName.getCString()));
         PEG_METHOD_EXIT();         PEG_METHOD_EXIT();
         return 1;         return 1;
     }     }
  
     PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,      PEG_TRACE((TRC_PROVIDERMANAGER, Tracer::LEVEL4,"Disable Provider %s",
         "Disable Provider " + pr->getName());          (const char*)pr->getName().getCString()));
     //     //
     // Check to see if there are pending requests. If there are pending     // Check to see if there are pending requests. If there are pending
     // requests and the disable timeout has not expired, loop and wait one     // requests and the disable timeout has not expired, loop and wait one
Line 791 
Line 846 
  
         if (pr->status.isInitialized())         if (pr->status.isInitialized())
         {         {
             PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,              PEG_TRACE((TRC_PROVIDERMANAGER, Tracer::LEVEL4,
                 "Unloading Provider " + pr->getName());                  "Unloading Provider %s",
                   (const char*)pr->getName().getCString()));
             _unloadProvider(pr);             _unloadProvider(pr);
         }         }
     }     }
     catch (...)     catch (...)
     {     {
         PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,          PEG_TRACE((TRC_PROVIDERMANAGER, Tracer::LEVEL2,
             "Unload provider failed " + pr->getName());              "Unload provider failed %s",
               (const char*)pr->getName().getCString()));
         PEG_METHOD_EXIT();         PEG_METHOD_EXIT();
         return -1;         return -1;
     }     }
Line 821 
Line 878 
  
     if (provider->status.numCurrentOperations() > 0)     if (provider->status.numCurrentOperations() > 0)
     {     {
         PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,          PEG_TRACE((TRC_PROVIDERMANAGER, Tracer::LEVEL4,
             "Provider cannot be unloaded due to pending operations: " +              "Provider cannot be unloaded due to pending operations: %s",
             provider->getName());              (const char*)provider->getName().getCString()));
     }     }
     else     else
     {     {
         PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,          PEG_TRACE((TRC_PROVIDERMANAGER, Tracer::LEVEL4,
             "Terminating Provider " + provider->getName());              "Terminating Provider %s",
               (const char*)provider->getName().getCString()));
  
         provider->terminate();         provider->terminate();
  
         // unload provider module         // unload provider module
         PEGASUS_ASSERT(provider->status.getModule() != 0);         PEGASUS_ASSERT(provider->status.getModule() != 0);
         PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL2,          PEG_TRACE((TRC_PROVIDERMANAGER, Tracer::LEVEL3,
             "Unloading provider module: " + provider->getName());              "Unloading provider module: %s",
               (const char*)provider->getName().getCString()));
         provider->status.getModule()->unloadModule();         provider->status.getModule()->unloadModule();
  
         Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE,          PEG_TRACE((TRC_PROVIDERMANAGER,Tracer::LEVEL3,
             "DefaultProviderManager:  Unloaded provider $0",              "DefaultProviderManager: Unloaded provider %s",
             provider->getName());              (const char*)provider->getName().getCString()));
  
         // NOTE: The "delete provider->status.getCIMOMHandle()" operation         // NOTE: The "delete provider->status.getCIMOMHandle()" operation
         //   was moved to be called after the unloadModule() call above         //   was moved to be called after the unloadModule() call above
Line 854 
Line 913 
         //   above the unloadModule() call. See bugzilla 3669 for details.         //   above the unloadModule() call. See bugzilla 3669 for details.
  
         // delete the cimom handle         // delete the cimom handle
         PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,          PEG_TRACE((TRC_PROVIDERMANAGER, Tracer::LEVEL4,
             "Destroying provider's CIMOMHandle: " + provider->getName());              "Destroying provider's CIMOMHandle: %s",
               (const char*)provider->getName().getCString()));
         delete provider->status.getCIMOMHandle();         delete provider->status.getCIMOMHandle();
  
         // set provider status to uninitialized         // set provider status to uninitialized
Line 870 
Line 930 
     return new DefaultProviderManager();     return new DefaultProviderManager();
 } }
  
   //async request handler method invoked on a seperate thread per provider
   //through the async request executor.
   CIMException DefaultProviderManager::_asyncRequestCallback(
       void *callbackPtr,
       AsyncRequestExecutor::AsyncRequestMsg* request)
   {
       PEG_METHOD_ENTER(TRC_PROVIDERMANAGER,
           "DefaultProviderManager::_asyncRequestCallback");
   
       CIMException responseException;
   
       //extract the parameters
       UnloadProviderRequest* my_request =
           dynamic_cast<UnloadProviderRequest*>(request);
       if(my_request != NULL)
       {
           PEGASUS_ASSERT(0 != callbackPtr);
   
           DefaultProviderManager *dpmPtr =
               static_cast<DefaultProviderManager*>(callbackPtr);
   
           ProviderMessageHandler* provider =
               dynamic_cast<ProviderMessageHandler*>(my_request->_provider);
           try
           {
               AutoMutex lock(provider->status.getStatusMutex());
               //unload the provider
               if (provider->status.isInitialized())
               {
                   dpmPtr->_unloadProvider(provider);
               }
               else
               {
                   PEGASUS_ASSERT(0);
               }
          }
           catch (CIMException& e)
           {
               PEG_TRACE((TRC_PROVIDERMANAGER, Tracer::LEVEL1,"CIMException: %s",
                   (const char*)e.getMessage().getCString()));
               responseException = e;
           }
           catch (Exception& e)
           {
               PEG_TRACE((TRC_PROVIDERMANAGER, Tracer::LEVEL1,"Exception: %s",
                   (const char*)e.getMessage().getCString()));
               responseException = CIMException(CIM_ERR_FAILED, e.getMessage());
           }
           catch (PEGASUS_STD(exception)& e)
           {
               responseException = CIMException(CIM_ERR_FAILED, e.what());
           }
           catch (...)
           {
               PEG_TRACE_CSTRING(TRC_PROVIDERMANAGER, Tracer::LEVEL1,
                   "Exception: Unknown");
               responseException = PEGASUS_CIM_EXCEPTION(
                   CIM_ERR_FAILED, "Unknown error.");
           }
       }
   
       // delete the UnloadProviderRequest.
       delete request;
   
       PEG_METHOD_EXIT();
       return responseException;
   }
   
 PEGASUS_NAMESPACE_END PEGASUS_NAMESPACE_END
  
 PEGASUS_USING_PEGASUS; PEGASUS_USING_PEGASUS;


Legend:
Removed from v.1.80  
changed lines
  Added in v.1.96

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2