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

Diff for /pegasus/src/Pegasus/ProviderManager2/Attic/ProviderManagerService.cpp between version 1.13 and 1.56

version 1.13, 2003/10/17 04:02:11 version 1.56, 2004/07/28 11:31:23
Line 1 
Line 1 
 //%/////////////////////////////////////////////////////////////////////////////  //%2003////////////////////////////////////////////////////////////////////////
 // //
 // Copyright (c) 2000 - 2003 BMC Software, Hewlett-Packard Company, IBM,  // Copyright (c) 2000, 2001, 2002  BMC Software, Hewlett-Packard Development
 // The Open Group, Tivoli Systems  // Company, L. P., IBM Corp., The Open Group, Tivoli Systems.
   // Copyright (c) 2003 BMC Software; Hewlett-Packard Development Company, L. P.;
   // IBM Corp.; EMC Corporation, The Open Group.
 // //
 // Permission is hereby granted, free of charge, to any person obtaining a copy // Permission is hereby granted, free of charge, to any person obtaining a copy
 // of this software and associated documentation files (the "Software"), to // of this software and associated documentation files (the "Software"), to
Line 28 
Line 30 
 //              Mike Day, IBM (mdday@us.ibm.com) //              Mike Day, IBM (mdday@us.ibm.com)
 //              Karl Schopmeyer(k.schopmeyer@opengroup.org) - Fix associators. //              Karl Schopmeyer(k.schopmeyer@opengroup.org) - Fix associators.
 //              Yi Zhou, Hewlett-Packard Company (yi_zhou@hp.com) //              Yi Zhou, Hewlett-Packard Company (yi_zhou@hp.com)
   //              Adrian Schuur, IBM (schuur@de.ibm.com)
   //              Amit K Arora (amita@in.ibm.com) for PEP-101
   //              Roger Kumpf, Hewlett-Packard Company (roger_kumpf@hp.com)
   //              Seema Gupta (gseema@in.ibm.com for PEP135)
 // //
 //%///////////////////////////////////////////////////////////////////////////// //%/////////////////////////////////////////////////////////////////////////////
  
Line 36 
Line 42 
 #include <Pegasus/Common/Config.h> #include <Pegasus/Common/Config.h>
 #include <Pegasus/Common/Constants.h> #include <Pegasus/Common/Constants.h>
 #include <Pegasus/Common/CIMMessage.h> #include <Pegasus/Common/CIMMessage.h>
   #include <Pegasus/Common/Thread.h>
 #include <Pegasus/Common/Tracer.h> #include <Pegasus/Common/Tracer.h>
 #include <Pegasus/Common/Logger.h> #include <Pegasus/Common/Logger.h>
 #include <Pegasus/Common/Destroyer.h>  #include <Pegasus/Common/AutoPtr.h>
   #include <Pegasus/Common/Constants.h>
  
 #include <Pegasus/Config/ConfigManager.h> #include <Pegasus/Config/ConfigManager.h>
  
 PEGASUS_NAMESPACE_BEGIN  #include <Pegasus/ProviderManager2/BasicProviderManagerRouter.h>
   #include <Pegasus/ProviderManager2/OOPProviderManagerRouter.h>
 // BEGIN TEMP SECTION  
 class ProviderManagerContainer  
 {  
 public:  
     ProviderManagerContainer(const String & physicalName, const String & logicalName, const String & interfaceName)  
     {  
         #if defined(PEGASUS_OS_TYPE_WINDOWS)  
         _physicalName = physicalName + String(".dll");  
         #elif defined(PEGASUS_OS_HPUX) && defined(PEGASUS_PLATFORM_HPUX_PARISC_ACC)  
         _physicalName = ConfigManager::getHomedPath(ConfigManager::getInstance()->getCurrentValue("providerDir"));  
         _physicalName.append(String("/lib") + physical + String(".sl"));  
         #elif defined(PEGASUS_OS_HPUX) && !defined(PEGASUS_PLATFORM_HPUX_PARISC_ACC)  
         _physicalName = ConfigManager::getHomedPath(ConfigManager::getInstance()->getCurrentValue("providerDir"));  
         _physicalName.append(String("/lib") + physical + String(".so"));  
         #elif defined(PEGASUS_OS_OS400)  
         _physicalName = physicalName;  
         #else  
         _physicalName = ConfigManager::getHomedPath(ConfigManager::getInstance()->getCurrentValue("providerDir"));  
         _physicalName.append(String("/lib") + physical + String(".so"));  
         #endif  
   
         _logicalName = logicalName;  
   
         _interfaceName = interfaceName;  
   
         _module = ProviderManagerModule(_physicalName);  
   
         _module.load();  
   
         _manager = _module.getProviderManager(_logicalName);  
     }  
   
     ~ProviderManagerContainer(void)  
     {  
         _module.unload();  
     }  
   
     ProviderManager & getProviderManager(void)  
     {  
         return(*_manager);  
     }  
   
     String & getPhysicalName(void)  
     {  
         return(_physicalName);  
     }  
   
     String & getLogicalName(void)  
     {  
         return(_logicalName);  
     }  
   
     String & getInterfaceName(void)  
     {  
         return(_interfaceName);  
     }  
   
 private:  
     String _physicalName;  
     String _logicalName;  
     String _interfaceName;  
   
     ProviderManagerModule _module;  
     ProviderManager * _manager;  
   
 };  
  
 static Array<ProviderManagerContainer> _providerManagers;  PEGASUS_NAMESPACE_BEGIN
 // END TEMP SECTION  
  
 inline Boolean _isSupportedRequestType(const Message * message) inline Boolean _isSupportedRequestType(const Message * message)
 { {
Line 132 
Line 73 
     return(false);     return(false);
 } }
  
   ProviderManagerService* ProviderManagerService::providerManagerService=NULL;
   Uint32 ProviderManagerService::_indicationServiceQueueId = PEG_NOT_FOUND;
   
 ProviderManagerService::ProviderManagerService(void) ProviderManagerService::ProviderManagerService(void)
     : MessageQueueService(PEGASUS_QUEUENAME_PROVIDERMANAGER_CPP)     : MessageQueueService(PEGASUS_QUEUENAME_PROVIDERMANAGER_CPP)
 { {
       providerManagerService=this;
 } }
  
 ProviderManagerService::ProviderManagerService(ProviderRegistrationManager * providerRegistrationManager)  ProviderManagerService::ProviderManagerService(
           ProviderRegistrationManager * providerRegistrationManager,
           CIMRepository * repository)
     : MessageQueueService(PEGASUS_QUEUENAME_PROVIDERMANAGER_CPP)     : MessageQueueService(PEGASUS_QUEUENAME_PROVIDERMANAGER_CPP)
 { {
     SetProviderRegistrationManager(providerRegistrationManager);      providerManagerService=this;
       _repository=repository;
  
     // ATTN: this section is a temporary solution to populate the list of enabled      _providerRegistrationManager = providerRegistrationManager;
     // provider managers for a given distribution. it includes another temporary  
     // solution for converting a generic file name into a file name useable by      _unloadIdleProvidersBusy = 0;
     // each platform.  
       // Determine whether Out-of-Process Provider support is enabled
     // BEGIN TEMP SECTION      ConfigManager* configManager = ConfigManager::getInstance();
     //#if defined(PEGASUS_OS_OS400)      if (String::equal(
     //_providerManagers.append(ProviderManagerContainer("QSYS/??????????", "INTERNAL", "INTERNAL"));          configManager->getCurrentValue("enableProviderProcesses"), "true"))
     //#else      {
     //_providerManager.append(ProviderManagerContainer("InternalProviderManager", "DEFAULT", "INTERNAL"));          _providerManagerRouter =
     //#endif              new OOPProviderManagerRouter(indicationCallback);
       }
     /*      else
     #if defined(ENABLE_DEFAULT_PROVIDER_MANAGER)      {
     #if defined(PEGASUS_OS_OS400)          _providerManagerRouter =
     _providerManagers.append(ProviderManagerContainer("QSYS/QYCMDFTPVM", "DEFAULT", "C++Default"));              new BasicProviderManagerRouter(indicationCallback);
     #else      }
     _providerManagers.append(ProviderManagerContainer("DefaultProviderManager", "DEFAULT", "C++Default"));  
     #endif  
     #endif  
   
     #if defined(ENABLE_CMPI_PROVIDER_MANAGER)  
     #if defined(PEGASUS_OS_OS400)  
     _providerManagers.append(ProviderManagerContainer("QSYS/QYCMCMPIPM", "CMPI", "CMPI"));  
     #else  
     _providerManagers.append(ProviderManagerContainer("CMPIProviderManager", "CMPI", "CMPI"));  
     #endif  
     #endif  
     */  
     // END TEMP SECTION  
 } }
  
 ProviderManagerService::~ProviderManagerService(void) ProviderManagerService::~ProviderManagerService(void)
 { {
       delete _providerManagerRouter;
       providerManagerService=NULL;
 } }
  
 Boolean ProviderManagerService::messageOK(const Message * message) Boolean ProviderManagerService::messageOK(const Message * message)
Line 233 
Line 170 
  
         _incomingQueue.enqueue(request->op);         _incomingQueue.enqueue(request->op);
  
         _thread_pool->allocate_and_awaken((void *)this, ProviderManagerService::handleCimOperation);           while (!_thread_pool->allocate_and_awaken(
                        (void *)this, ProviderManagerService::handleCimOperation))
            {
                pegasus_yield();
            }
     }     }
     else     else
     {     {
Line 246 
Line 187 
     return;     return;
 } }
  
 /*  /* The following method shouldn't throw an exception as this runs on its own thread and the exceptions thrown by it
 PEGASUS_THREAD_RETURN PEGASUS_THREAD_CDECL ProviderManagerService::handleServiceOperation(void * arg) throw()  don't go anywhere and get lost.
 {  
     // get the service from argument  
     ProviderManagerService * service = reinterpret_cast<ProviderManagerService *>(arg);  
   
     PEGASUS_ASSERT(service != 0);  
   
     // get message from service queue  
     Message * message = service->_incomingQueue.dequeue();  
   
     PEGASUS_ASSERT(message != 0);  
   
     if(service->_incomingQueue.size() == 0)  
     {  
         PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,  
             "ProviderManagerService::handleCimOperation() called with no op node in queue" );  
   
         PEG_METHOD_EXIT();  
   
         // thread started with no message in queue.  
         return(PEGASUS_THREAD_RETURN(1));  
     }  
   
     AsyncOpNode * op = service->_incomingQueue.dequeue();  
   
     PEGASUS_ASSERT(op != 0 );  
   
     if(op->_request.count() == 0)  
     {  
         MessageQueue * queue = MessageQueue::lookup(op->_source_queue);  
   
         PEGASUS_ASSERT(queue != 0);  
   
         PEG_METHOD_EXIT();  
   
         // no request in op node  
         return(PEGASUS_THREAD_RETURN(1));  
     }  
   
     return(0);  
 }  
 */ */
   PEGASUS_THREAD_RETURN PEGASUS_THREAD_CDECL
 PEGASUS_THREAD_RETURN PEGASUS_THREAD_CDECL ProviderManagerService::handleCimOperation(void * arg) throw()  ProviderManagerService::handleCimOperation(void * arg)
 { {
     PEG_METHOD_ENTER(TRC_PROVIDERMANAGER, "ProviderManagerService::handleCimOperation");      PEG_METHOD_ENTER(TRC_PROVIDERMANAGER,
           "ProviderManagerService::handleCimOperation");
  
     if(arg == 0)     if(arg == 0)
     {     {
Line 301 
Line 203 
     }     }
  
     // get the service from argument     // get the service from argument
     ProviderManagerService * service = reinterpret_cast<ProviderManagerService *>(arg);      ProviderManagerService * service =
           reinterpret_cast<ProviderManagerService *>(arg);
  
     if(service->_incomingQueue.size() == 0)     if(service->_incomingQueue.size() == 0)
     {     {
         PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,         PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
             "ProviderManagerService::handleCimOperation() called with no op node in queue" );              "ProviderManagerService::handleCimOperation() called with no "
                   "op node in queue");
  
         PEG_METHOD_EXIT();         PEG_METHOD_EXIT();
  
Line 318 
Line 222 
  
     if((op == 0) || (op->_request.count() == 0))     if((op == 0) || (op->_request.count() == 0))
     {     {
           // ATTN: This may dereference a null pointer!
         MessageQueue * queue = MessageQueue::lookup(op->_source_queue);         MessageQueue * queue = MessageQueue::lookup(op->_source_queue);
  
         PEGASUS_ASSERT(queue != 0);         PEGASUS_ASSERT(queue != 0);
Line 330 
Line 235 
  
     AsyncRequest * request = static_cast<AsyncRequest *>(op->_request.next(0));     AsyncRequest * request = static_cast<AsyncRequest *>(op->_request.next(0));
  
     if((request == 0) || (request->getType() != async_messages::ASYNC_LEGACY_OP_START))      if ((request == 0) ||
           (request->getType() != async_messages::ASYNC_LEGACY_OP_START))
     {     {
         // reply with NAK         // reply with NAK
   
         PEG_METHOD_EXIT();         PEG_METHOD_EXIT();
   
         return(PEGASUS_THREAD_RETURN(0));         return(PEGASUS_THREAD_RETURN(0));
     }     }
  
     try     try
     {     {
         Message * legacy = static_cast<AsyncLegacyOperationStart *>(request)->get_action();          Message* legacy =
               static_cast<AsyncLegacyOperationStart *>(request)->get_action();
  
         if(_isSupportedRequestType(legacy))         if(_isSupportedRequestType(legacy))
         {         {
             Destroyer<Message> xmessage(legacy);              AutoPtr<Message> xmessage(legacy);
  
             // Set the client's requested language into this service thread.             // Set the client's requested language into this service thread.
             // This will allow functions in this service to return messages             // This will allow functions in this service to return messages
Line 354 
Line 259 
  
             if(msg != 0)             if(msg != 0)
             {             {
                 AcceptLanguages * langs = new AcceptLanguages(msg->acceptLanguages);                          AcceptLanguages* langs =
                       new AcceptLanguages(((AcceptLanguageListContainer)msg->operationContext.get
                                                                                           (AcceptLanguageListContainer::NAME)).getLanguages());
                 Thread::setLanguages(langs);                 Thread::setLanguages(langs);
             }             }
             else             else
Line 376 
Line 282 
     return(PEGASUS_THREAD_RETURN(0));     return(PEGASUS_THREAD_RETURN(0));
 } }
  
 void ProviderManagerService::handleCimRequest(AsyncOpNode * op, const Message * message)  void ProviderManagerService::handleCimRequest(
       AsyncOpNode * op,
       Message * message)
 { {
     PEG_METHOD_ENTER(TRC_PROVIDERMANAGER, "ProviderManagerService::handleCimRequest");      PEG_METHOD_ENTER(TRC_PROVIDERMANAGER,
           "ProviderManagerService::handleCimRequest");
  
     // ATTN: ensure message is a request???      CIMRequestMessage * request = dynamic_cast<CIMRequestMessage *>(message);
     CIMMessage * request = dynamic_cast<CIMMessage *>(const_cast<Message *>(message));      PEGASUS_ASSERT(request != 0);
  
     // get request from op node     // get request from op node
     AsyncRequest * async = static_cast<AsyncRequest *>(op->_request.next(0));     AsyncRequest * async = static_cast<AsyncRequest *>(op->_request.next(0));
       PEGASUS_ASSERT(async != 0);
     PEGASUS_ASSERT((request != 0) && (async != 0));  
  
     Message * response = 0;     Message * response = 0;
  
     // get namespace and class name from message      if ((dynamic_cast<CIMOperationRequestMessage*>(request) != 0) ||
     String nameSpace;          (dynamic_cast<CIMIndicationRequestMessage*>(request) != 0) ||
     String className;          (request->getType() == CIM_EXPORT_INDICATION_REQUEST_MESSAGE) ||
           (request->getType() == CIM_INITIALIZE_PROVIDER_REQUEST_MESSAGE))
       {
           // Handle CIMOperationRequestMessage, CIMExportIndicationRequestMessage,
           // CIMIndicationRequestMessage, and CIMInitializeProviderRequestMessage.
           // (These should be blocked when the provider module is disabled.)
  
     switch(message->getType())          //
     {          // Get the provider module instance to check for a disabled module
     case CIM_GET_CLASS_REQUEST_MESSAGE:          //
         {          CIMInstance providerModule;
             const CIMGetClassRequestMessage * p = dynamic_cast<const CIMGetClassRequestMessage *>(message);  
   
             PEGASUS_ASSERT(p != 0);  
   
             nameSpace = p->nameSpace.getString();  
             className = p->className.getString();  
         }  
  
         break;          if (request->getType() == CIM_EXPORT_INDICATION_REQUEST_MESSAGE)
     case CIM_ENUMERATE_CLASSES_REQUEST_MESSAGE:  
         {         {
             const CIMEnumerateClassesRequestMessage * p = dynamic_cast<const CIMEnumerateClassesRequestMessage *>(message);              // Get a ProviderIdContainer for ExportIndicationRequestMessage.
               // Note: This can be removed when the CIMExportRequestDispatcher
             PEGASUS_ASSERT(p != 0);              // is updated to add the ProviderIdContainer to the message.
               CIMInstance provider;
             nameSpace = p->nameSpace.getString();              const CIMExportIndicationRequestMessage* expRequest =
             className = p->className.getString();                  dynamic_cast<const CIMExportIndicationRequestMessage*>(request);
               _providerRegistrationManager->lookupIndicationConsumer(
                   expRequest->destinationPath, provider, providerModule);
               request->operationContext.insert(
                   ProviderIdContainer(providerModule, provider));
         }         }
           else
         break;  
     case CIM_ENUMERATE_CLASS_NAMES_REQUEST_MESSAGE:  
         {         {
             const CIMEnumerateClassNamesRequestMessage * p = dynamic_cast<const CIMEnumerateClassNamesRequestMessage *>(message);              // The provider ID container is added to the OperationContext
               // by the CIMOperationRequestDispatcher for all CIM operation
               // requests to providers, so it does not need to be added again.
               // CIMInitializeProviderRequestMessage also has a provider ID
               // container.
               ProviderIdContainer pidc =
                   request->operationContext.get(ProviderIdContainer::NAME);
               providerModule = pidc.getModule();
           }
  
             PEGASUS_ASSERT(p != 0);          //
           // Check if the target provider is disabled
           //
           Boolean moduleDisabled = false;
           Uint32 pos = providerModule.findProperty(CIMName("OperationalStatus"));
           PEGASUS_ASSERT(pos != PEG_NOT_FOUND);
           Array<Uint16> operationalStatus;
           providerModule.getProperty(pos).getValue().get(operationalStatus);
  
             nameSpace = p->nameSpace.getString();          for(Uint32 i = 0; i < operationalStatus.size(); i++)
             className = p->className.getString();          {
               if ((operationalStatus[i] == CIM_MSE_OPSTATUS_VALUE_STOPPED) ||
                   (operationalStatus[i] == CIM_MSE_OPSTATUS_VALUE_STOPPING))
               {
                   moduleDisabled = true;
                   break;
               }
         }         }
  
         break;          if (moduleDisabled)
     case CIM_CREATE_CLASS_REQUEST_MESSAGE:  
         {         {
             const CIMCreateClassRequestMessage * p = dynamic_cast<const CIMCreateClassRequestMessage *>(message);              //
               // Send a "provider blocked" response
             PEGASUS_ASSERT(p != 0);              //
               CIMResponseMessage* cimResponse = request->buildResponse();
             nameSpace = p->nameSpace.getString();              cimResponse->cimException = PEGASUS_CIM_EXCEPTION_L(
             //className = p->className.getString();                  CIM_ERR_ACCESS_DENIED,
                   MessageLoaderParms(
                       "ProviderManager.ProviderManagerService.PROVIDER_BLOCKED",
                       "provider blocked."));
               response = cimResponse;
         }         }
           else
         break;  
     case CIM_MODIFY_CLASS_REQUEST_MESSAGE:  
         {         {
             const CIMModifyClassRequestMessage * p = dynamic_cast<const CIMModifyClassRequestMessage *>(message);              //
               // Forward the request to the appropriate ProviderManagerRouter
             PEGASUS_ASSERT(p != 0);              //
               response = _providerManagerRouter->processMessage(request);
             nameSpace = p->nameSpace.getString();  
             //className = p->className.getString();  
         }         }
       }
         break;      else if (request->getType() == CIM_ENABLE_MODULE_REQUEST_MESSAGE)
     case CIM_DELETE_CLASS_REQUEST_MESSAGE:  
         {         {
             const CIMDeleteClassRequestMessage * p = dynamic_cast<const CIMDeleteClassRequestMessage *>(message);          // Handle CIMEnableModuleRequestMessage
           CIMEnableModuleRequestMessage * emReq =
             PEGASUS_ASSERT(p != 0);              dynamic_cast<CIMEnableModuleRequestMessage*>(request);
  
             nameSpace = p->nameSpace.getString();          CIMInstance providerModule = emReq->providerModule;
             className = p->className.getString();  
         }  
  
         break;          try
     case CIM_GET_INSTANCE_REQUEST_MESSAGE:  
         {         {
             const CIMGetInstanceRequestMessage * p = dynamic_cast<const CIMGetInstanceRequestMessage *>(message);              // Forward the request to the ProviderManager
               response = _providerManagerRouter->processMessage(request);
  
             PEGASUS_ASSERT(p != 0);              // If successful, update provider module status to OK
               // ATTN: Use CIMEnableModuleResponseMessage operationalStatus?
             nameSpace = p->nameSpace.getString();              CIMEnableModuleResponseMessage * emResp =
             //className = p->className.getString();                  dynamic_cast<CIMEnableModuleResponseMessage*>(response);
               if (emResp->cimException.getCode() == CIM_ERR_SUCCESS)
               {
                   _updateProviderModuleStatus(
                       providerModule, CIM_MSE_OPSTATUS_VALUE_STOPPED,
                       CIM_MSE_OPSTATUS_VALUE_OK);
         }         }
           }
         break;          catch (Exception& e)
     case CIM_ENUMERATE_INSTANCES_REQUEST_MESSAGE:  
         {         {
             const CIMEnumerateInstancesRequestMessage * p = dynamic_cast<const CIMEnumerateInstancesRequestMessage *>(message);              // Get the OperationalStatus property from the provider module
               Array<Uint16> operationalStatus;
             PEGASUS_ASSERT(p != 0);              CIMValue itValue = emReq->providerModule.getProperty(
                   emReq->providerModule.findProperty("OperationalStatus"))
                       .getValue();
               itValue.get(operationalStatus);
  
             nameSpace = p->nameSpace.getString();              if (response != 0)
             className = p->className.getString();              {
                   delete response;
         }         }
  
         break;              response = new CIMEnableModuleResponseMessage(
     case CIM_ENUMERATE_INSTANCE_NAMES_REQUEST_MESSAGE:                  request->messageId,
                   CIMException(CIM_ERR_FAILED, e.getMessage()),
                   request->queueIds.copyAndPop(),
                   operationalStatus);
           }
       }
       else if (request->getType() == CIM_DISABLE_MODULE_REQUEST_MESSAGE)
         {         {
             const CIMEnumerateInstanceNamesRequestMessage * p = dynamic_cast<const CIMEnumerateInstanceNamesRequestMessage *>(message);          // Handle CIMDisableModuleRequestMessage
           CIMDisableModuleRequestMessage * dmReq =
               dynamic_cast<CIMDisableModuleRequestMessage*>(request);
  
             PEGASUS_ASSERT(p != 0);          CIMInstance providerModule = dmReq->providerModule;
           Boolean updateModuleStatus = !dmReq->disableProviderOnly;
  
             nameSpace = p->nameSpace.getString();          try
             className = p->className.getString();          {
         }              // Change module status from OK to STOPPING
               if (updateModuleStatus)
         break;  
     case CIM_CREATE_INSTANCE_REQUEST_MESSAGE:  
         {         {
             const CIMCreateInstanceRequestMessage * p = dynamic_cast<const CIMCreateInstanceRequestMessage *>(message);                  _updateProviderModuleStatus(
                       providerModule, CIM_MSE_OPSTATUS_VALUE_OK,
                       CIM_MSE_OPSTATUS_VALUE_STOPPING);
               }
  
             PEGASUS_ASSERT(p != 0);              // Forward the request to the ProviderManager
               response = _providerManagerRouter->processMessage(request);
  
             nameSpace = p->nameSpace.getString();              // Update provider module status based on success or failure
             //className = p->className.getString();              if (updateModuleStatus)
               {
                   CIMDisableModuleResponseMessage * dmResp =
                       dynamic_cast<CIMDisableModuleResponseMessage*>(response);
                   if (dmResp->cimException.getCode() != CIM_ERR_SUCCESS)
                   {
                       // Disable operation failed.  Module not stopped.
                       _updateProviderModuleStatus(
                           providerModule, CIM_MSE_OPSTATUS_VALUE_STOPPING,
                           CIM_MSE_OPSTATUS_VALUE_OK);
         }         }
                   else
         break;  
     case CIM_MODIFY_INSTANCE_REQUEST_MESSAGE:  
         {         {
             const CIMModifyInstanceRequestMessage * p = dynamic_cast<const CIMModifyInstanceRequestMessage *>(message);                      // Disable may or may not have been successful,
                       // depending on whether there are outstanding requests.
             PEGASUS_ASSERT(p != 0);                      // Use last operationalStatus entry.
                       _updateProviderModuleStatus(
             nameSpace = p->nameSpace.getString();                          providerModule, CIM_MSE_OPSTATUS_VALUE_STOPPING,
             //className = p->className.getString();                          dmResp->operationalStatus[
                               dmResp->operationalStatus.size()-1]);
         }         }
               }
         break;          }
     case CIM_DELETE_INSTANCE_REQUEST_MESSAGE:          catch (Exception& e)
         {         {
             const CIMDeleteInstanceRequestMessage * p = dynamic_cast<const CIMDeleteInstanceRequestMessage *>(message);              // Get the OperationalStatus property from the provider module
               Array<Uint16> operationalStatus;
             PEGASUS_ASSERT(p != 0);              CIMValue itValue = dmReq->providerModule.getProperty(
                   dmReq->providerModule.findProperty("OperationalStatus"))
                       .getValue();
               itValue.get(operationalStatus);
  
             nameSpace = p->nameSpace.getString();              if (response != 0)
             //className = p->className.getString();              {
                   delete response;
         }         }
  
         break;              response = new CIMDisableModuleResponseMessage(
     case CIM_EXEC_QUERY_REQUEST_MESSAGE:                  request->messageId,
         break;                  CIMException(CIM_ERR_FAILED, e.getMessage()),
     case CIM_ASSOCIATORS_REQUEST_MESSAGE:                  request->queueIds.copyAndPop(),
                   operationalStatus);
           }
       }
       else
         {         {
             const CIMAssociatorsRequestMessage * p = dynamic_cast<const CIMAssociatorsRequestMessage *>(message);          response = _providerManagerRouter->processMessage(request);
   
             PEGASUS_ASSERT(p != 0);  
   
             nameSpace = p->nameSpace.getString();  
             //className = p->className.getString();  
         }         }
  
         break;      AsyncLegacyOperationResult * async_result =
     case CIM_ASSOCIATOR_NAMES_REQUEST_MESSAGE:          new AsyncLegacyOperationResult(
         {          async->getKey(),
             const CIMAssociatorNamesRequestMessage * p = dynamic_cast<const CIMAssociatorNamesRequestMessage *>(message);          async->getRouting(),
           op,
           response);
  
             PEGASUS_ASSERT(p != 0);      _complete_op_node(op, ASYNC_OPSTATE_COMPLETE, 0, 0);
  
             nameSpace = p->nameSpace.getString();      PEG_METHOD_EXIT();
             //className = p->className.getString();  
         }         }
  
         break;  void ProviderManagerService::unloadIdleProviders()
     case CIM_REFERENCES_REQUEST_MESSAGE:  
         {         {
             const CIMReferencesRequestMessage * p = dynamic_cast<const CIMReferencesRequestMessage *>(message);      PEG_METHOD_ENTER(TRC_PROVIDERMANAGER,
           "ProviderManagerService::unloadIdleProviders");
             PEGASUS_ASSERT(p != 0);  
  
             nameSpace = p->nameSpace.getString();      // Ensure that only one _unloadIdleProvidersHandler thread runs at a time
             //className = p->className.getString();      _unloadIdleProvidersBusy++;
       if ((_unloadIdleProvidersBusy.value() == 1) &&
           (_thread_pool->allocate_and_awaken(
                (void*)this, ProviderManagerService::_unloadIdleProvidersHandler)))
       {
           // _unloadIdleProvidersBusy is decremented in
           // _unloadIdleProvidersHandler
         }         }
       else
         break;  
     case CIM_REFERENCE_NAMES_REQUEST_MESSAGE:  
         {         {
             const CIMReferenceNamesRequestMessage * p = dynamic_cast<const CIMReferenceNamesRequestMessage *>(message);          // If we fail to allocate a thread, don't retry now.
           _unloadIdleProvidersBusy--;
             PEGASUS_ASSERT(p != 0);      }
  
             nameSpace = p->nameSpace.getString();      PEG_METHOD_EXIT();
             //className = p->className.getString();  
         }         }
  
         break;  PEGASUS_THREAD_RETURN PEGASUS_THREAD_CDECL
     case CIM_GET_PROPERTY_REQUEST_MESSAGE:  ProviderManagerService::_unloadIdleProvidersHandler(void* arg) throw()
         {         {
             const CIMGetPropertyRequestMessage * p = dynamic_cast<const CIMGetPropertyRequestMessage *>(message);      try
       {
           PEG_METHOD_ENTER(TRC_PROVIDERMANAGER,
               "ProviderManagerService::unloadIdleProvidersHandler");
  
             PEGASUS_ASSERT(p != 0);          ProviderManagerService* myself =
               reinterpret_cast<ProviderManagerService*>(arg);
  
             nameSpace = p->nameSpace.getString();          try
             //className = p->className.getString();          {
               myself->_providerManagerRouter->unloadIdleProviders();
         }         }
           catch (...)
         break;  
     case CIM_SET_PROPERTY_REQUEST_MESSAGE:  
         {         {
             const CIMSetPropertyRequestMessage * p = dynamic_cast<const CIMSetPropertyRequestMessage *>(message);              // Ignore errors
               PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL2,
             PEGASUS_ASSERT(p != 0);                  "Unexpected exception in _unloadIdleProvidersHandler");
   
             nameSpace = p->nameSpace.getString();  
             //className = p->className.getString();  
         }         }
  
         break;          myself->_unloadIdleProvidersBusy--;
     case CIM_INVOKE_METHOD_REQUEST_MESSAGE:          PEG_METHOD_EXIT();
       }
       catch (...)
         {         {
             const CIMInvokeMethodRequestMessage * p = dynamic_cast<const CIMInvokeMethodRequestMessage *>(message);          // Ignore errors
           PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL2,
             PEGASUS_ASSERT(p != 0);              "Unexpected exception in _unloadIdleProvidersHandler");
       }
  
             nameSpace = p->nameSpace.getString();      return(PEGASUS_THREAD_RETURN(0));
             //className = p->className.getString();  
         }         }
  
         break;  // Updates the providerModule instance and the ProviderRegistrationManager
     /*  void ProviderManagerService::_updateProviderModuleStatus(
     case CIM_ENABLE_INDICATION_SUBSCRIPTION_REQUEST_MESSAGE:      CIMInstance& providerModule,
       Uint16 fromStatus,
       Uint16 toStatus)
         {         {
             const CIMEnableIndicationsSubscriptionRequestMessage * p = dynamic_cast<const CIMEnableIndicationsRequestMessage *>(message);      PEG_METHOD_ENTER(TRC_PROVIDERMANAGER,
           "ProviderManagerService::_updateProviderModuleStatus");
             PEGASUS_ASSERT(p != 0);  
  
             nameSpace = p->nameSpace.getString();      Array<Uint16> operationalStatus;
             className = p->className.getString();      String providerModuleName;
         }  
  
         break;      Uint32 pos = providerModule.findProperty(CIMName("Name"));
     case CIM_MODIFY_INDICATION_SUBSCRIPTION_REQUEST_MESSAGE:      PEGASUS_ASSERT(pos != PEG_NOT_FOUND);
         {      providerModule.getProperty(pos).getValue().get(providerModuleName);
             const CIMModifyIndicationsRequestMessage * p = dynamic_cast<const CIMModifyIndicationsRequestMessage *>(message);  
  
             PEGASUS_ASSERT(p != 0);      //
       // get operational status
       //
       pos = providerModule.findProperty(CIMName("OperationalStatus"));
       PEGASUS_ASSERT(pos != PEG_NOT_FOUND);
       CIMProperty operationalStatusProperty = providerModule.getProperty(pos);
       CIMValue operationalStatusValue = operationalStatusProperty.getValue();
  
             nameSpace = p->nameSpace.getString();      if (!operationalStatusValue.isNull())
             className = p->className.getString();      {
           operationalStatusValue.get(operationalStatus);
         }         }
  
         break;      //
     case CIM_DISABLE_INDICATION_SUBSCRIPTION_REQUEST_MESSAGE:      // update module status
       //
       for (Uint32 i = operationalStatus.size(); i > 0; i--)
         {         {
             const CIMGetClassRequestMessage * p = dynamic_cast<const CIMGetClassRequestMessage *>(message);          if (operationalStatus[i-1] == fromStatus)
           {
             PEGASUS_ASSERT(p != 0);              operationalStatus.remove(i-1);
   
             nameSpace = p->nameSpace.getString();  
             className = p->className.getString();  
         }         }
   
         break;  
     */  
     default:  
         break;  
     }     }
  
     ProviderName name(      operationalStatus.append(toStatus);
         CIMObjectPath(String::EMPTY, nameSpace, className).toString(),  
         String::EMPTY,  
         String::EMPTY,  
         String::EMPTY,  
         0);  
  
     // find provider manager      if (_providerRegistrationManager->setProviderModuleStatus(
     name = ProviderRegistrar().findProvider(name);              providerModuleName, operationalStatus) == false)
       {
           throw PEGASUS_CIM_EXCEPTION_L(
               CIM_ERR_FAILED,
               MessageLoaderParms(
                   "ProviderManager.ProviderManagerService."
                       "SET_MODULE_STATUS_FAILED",
                   "set module status failed."));
       }
  
     // find provider manager for provider interface      operationalStatusProperty.setValue(CIMValue(operationalStatus));
  
       PEG_METHOD_EXIT();
   }
  
   void ProviderManagerService::indicationCallback(
       CIMProcessIndicationRequestMessage* request)
   {
     try     try
     {     {
         PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,                  AcceptLanguageListContainer cntr = request->operationContext.get(AcceptLanguageListContainer::NAME);
             "ProviderManagerService::handleCimRequest() passing control to provider manager.");          }catch(const Exception &)
   
         // forward request  
         response = _providerManagers[0].getProviderManager().processMessage(request);  
     }  
     catch(...)  
     {     {
         // ATTN: create response with error message                  request->operationContext.insert(AcceptLanguageListContainer(AcceptLanguages::EMPTY));
     }     }
  
     // preserve message key          if (_indicationServiceQueueId == PEG_NOT_FOUND)
     response->setKey(request->getKey());      {
           Array<Uint32> serviceIds;
  
     // set HTTP method in response from request          providerManagerService->find_services(
     response->setHttpMethod(request->getHttpMethod());              PEGASUS_QUEUENAME_INDICATIONSERVICE, 0, 0, &serviceIds);
           PEGASUS_ASSERT(serviceIds.size() != 0);
  
     AsyncLegacyOperationResult * async_result =          _indicationServiceQueueId = serviceIds[0];
         new AsyncLegacyOperationResult(      }
         async->getKey(),  
         async->getRouting(),  
         op,  
         response);  
  
     _complete_op_node(op, ASYNC_OPSTATE_COMPLETE, 0, 0);      request->queueIds = QueueIdStack(
           _indicationServiceQueueId, providerManagerService->getQueueId());
  
     PEG_METHOD_EXIT();      AsyncLegacyOperationStart * asyncRequest =
 }          new AsyncLegacyOperationStart(
           providerManagerService->get_next_xid(),
           0,
           _indicationServiceQueueId,
           request,
           _indicationServiceQueueId);
  
 void ProviderManagerService::unload_idle_providers(void)      providerManagerService->SendForget(asyncRequest);
 {  
 } }
  
 PEGASUS_NAMESPACE_END PEGASUS_NAMESPACE_END
   


Legend:
Removed from v.1.13  
changed lines
  Added in v.1.56

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2