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

Diff for /pegasus/src/Pegasus/ProviderManager2/Attic/OOPProviderManagerRouter.cpp between version 1.25.2.4 and 1.32

version 1.25.2.4, 2006/05/19 17:31:41 version 1.32, 2006/08/09 21:13:00
Line 38 
Line 38 
 // //
 //%///////////////////////////////////////////////////////////////////////////// //%/////////////////////////////////////////////////////////////////////////////
  
   #include <Pegasus/Common/Signal.h>
 #include <Pegasus/Common/Config.h> #include <Pegasus/Common/Config.h>
 #include <Pegasus/Common/Constants.h> #include <Pegasus/Common/Constants.h>
 #include <Pegasus/Common/AutoPtr.h> #include <Pegasus/Common/AutoPtr.h>
Line 135 
Line 136 
     ProviderAgentContainer(     ProviderAgentContainer(
         const String & moduleName,         const String & moduleName,
         const String & userName,         const String & userName,
           Uint16 userContext,
         PEGASUS_INDICATION_CALLBACK_T indicationCallback,         PEGASUS_INDICATION_CALLBACK_T indicationCallback,
         PEGASUS_RESPONSE_CHUNK_CALLBACK_T responseChunkCallback,         PEGASUS_RESPONSE_CHUNK_CALLBACK_T responseChunkCallback,
           PEGASUS_PROVIDERMODULEFAIL_CALLBACK_T providerModuleFailCallback,
         Boolean subscriptionInitComplete);         Boolean subscriptionInitComplete);
  
     ~ProviderAgentContainer();     ~ProviderAgentContainer();
Line 207 
Line 210 
         the connection is closed.         the connection is closed.
      */      */
     void _processResponses();     void _processResponses();
     static PEGASUS_THREAD_RETURN PEGASUS_THREAD_CDECL      static ThreadReturnType PEGASUS_THREAD_CDECL
         _responseProcessor(void* arg);         _responseProcessor(void* arg);
  
     //     //
Line 232 
Line 235 
     String _userName;     String _userName;
  
     /**     /**
           User Context setting of the provider module served by this Provider
           Agent.
        */
       Uint16 _userContext;
   
       /**
         Callback function to which all generated indications are sent for         Callback function to which all generated indications are sent for
         processing.         processing.
      */      */
Line 243 
Line 252 
     PEGASUS_RESPONSE_CHUNK_CALLBACK_T _responseChunkCallback;     PEGASUS_RESPONSE_CHUNK_CALLBACK_T _responseChunkCallback;
  
     /**     /**
           Callback function to be called upon detection of failure of a
           provider module.
        */
       PEGASUS_PROVIDERMODULEFAIL_CALLBACK_T _providerModuleFailCallback;
   
       /**
         Indicates whether the Provider Agent is active.         Indicates whether the Provider Agent is active.
      */      */
     Boolean _isInitialized;     Boolean _isInitialized;
Line 332 
Line 347 
 ProviderAgentContainer::ProviderAgentContainer( ProviderAgentContainer::ProviderAgentContainer(
     const String & moduleName,     const String & moduleName,
     const String & userName,     const String & userName,
       Uint16 userContext,
     PEGASUS_INDICATION_CALLBACK_T indicationCallback,     PEGASUS_INDICATION_CALLBACK_T indicationCallback,
     PEGASUS_RESPONSE_CHUNK_CALLBACK_T responseChunkCallback,     PEGASUS_RESPONSE_CHUNK_CALLBACK_T responseChunkCallback,
       PEGASUS_PROVIDERMODULEFAIL_CALLBACK_T providerModuleFailCallback,
     Boolean subscriptionInitComplete)     Boolean subscriptionInitComplete)
     : _moduleName(moduleName),     : _moduleName(moduleName),
       _userName(userName),       _userName(userName),
         _userContext(userContext),
       _indicationCallback(indicationCallback),       _indicationCallback(indicationCallback),
       _responseChunkCallback(responseChunkCallback),       _responseChunkCallback(responseChunkCallback),
         _providerModuleFailCallback(providerModuleFailCallback),
       _isInitialized(false),       _isInitialized(false),
       _subscriptionInitComplete(subscriptionInitComplete)       _subscriptionInitComplete(subscriptionInitComplete)
 { {
Line 363 
Line 382 
             // Wait for the responseProcessor thread to exit             // Wait for the responseProcessor thread to exit
             while (isInitialized())             while (isInitialized())
             {             {
                 pegasus_yield();                  Threads::yield();
             }             }
         }         }
     }     }
Line 527 
Line 546 
     }     }
 #elif defined (PEGASUS_OS_OS400) #elif defined (PEGASUS_OS_OS400)
  
     //Out of provider support for OS400 goes here when needed.      //Out of process provider support for OS400 goes here when needed.
  
 #else #else
  
Line 783 
Line 802 
         {         {
             if (rtn == PEGASUS_THREAD_INSUFFICIENT_RESOURCES)             if (rtn == PEGASUS_THREAD_INSUFFICIENT_RESOURCES)
             {             {
                 pegasus_yield();                  Threads::yield();
             }             }
             else             else
             {             {
Line 910 
Line 929 
         // connection         // connection
         //         //
         {         {
             //  
             //  If not a clean shutdown, log a warning message in case module  
             //  included indication providers  
             //  
             if (!cleanShutdown)  
             {  
                 Logger::put_l(  
                     Logger::STANDARD_LOG, System::CIMSERVER, Logger::WARNING,  
                     "ProviderManager.OOPProviderManagerRouter."  
                         "OOP_PROVIDER_MODULE_FAILURE_DETECTED",  
                     "A failure was detected in provider module $0.  The"  
                         " generation of indications by providers in this module"  
                         " may be affected.  To ensure these providers are"  
                         " serving active subscriptions, disable and then"  
                         " re-enable this module using the cimprovider command.",  
                     _moduleName);  
             }  
   
             AutoMutex tableLock(_outstandingRequestTableMutex);             AutoMutex tableLock(_outstandingRequestTableMutex);
  
             CIMResponseMessage* response =             CIMResponseMessage* response =
Line 945 
Line 946 
             }             }
  
             _outstandingRequestTable.clear();             _outstandingRequestTable.clear();
   
               //
               //  If not a clean shutdown, call the provider module failure
               //  callback
               //
               if (!cleanShutdown)
               {
                   //
                   //  Call the provider module failure callback to
                   //  communicate the failure to the Provider Manager Service
                   //  Provider Manager Service will inform Indication Service
                   //
                   _providerModuleFailCallback (_moduleName, _userName,
                       _userContext);
               }
         }         }
     }     }
     catch (...)     catch (...)
Line 1070 
Line 1086 
             // Get the provider module from the ProviderIdContainer to see if             // Get the provider module from the ProviderIdContainer to see if
             // we can optimize out the transmission of this instance to the             // we can optimize out the transmission of this instance to the
             // Provider Agent.  (See the _providerModuleCache description.)             // Provider Agent.  (See the _providerModuleCache description.)
             try              if(request->operationContext.contains(ProviderIdContainer::NAME))
             {             {
                 ProviderIdContainer pidc = request->operationContext.get(                 ProviderIdContainer pidc = request->operationContext.get(
                     ProviderIdContainer::NAME);                     ProviderIdContainer::NAME);
Line 1095 
Line 1111 
                     doProviderModuleOptimization = true;                     doProviderModuleOptimization = true;
                 }                 }
             }             }
             catch (...)  
             {  
                 // No ProviderIdContainer to optimize  
             }  
  
             //             //
             // Write the message to the pipe             // Write the message to the pipe
Line 1379 
Line 1391 
  
 } }
  
 PEGASUS_THREAD_RETURN PEGASUS_THREAD_CDECL  ThreadReturnType PEGASUS_THREAD_CDECL
 ProviderAgentContainer::_responseProcessor(void* arg) ProviderAgentContainer::_responseProcessor(void* arg)
 { {
     ProviderAgentContainer* pa =     ProviderAgentContainer* pa =
Line 1387 
Line 1399 
  
     pa->_processResponses();     pa->_processResponses();
  
     return(PEGASUS_THREAD_RETURN(0));      return(ThreadReturnType(0));
 } }
  
 ///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
Line 1396 
Line 1408 
  
 OOPProviderManagerRouter::OOPProviderManagerRouter( OOPProviderManagerRouter::OOPProviderManagerRouter(
     PEGASUS_INDICATION_CALLBACK_T indicationCallback,     PEGASUS_INDICATION_CALLBACK_T indicationCallback,
     PEGASUS_RESPONSE_CHUNK_CALLBACK_T responseChunkCallback)      PEGASUS_RESPONSE_CHUNK_CALLBACK_T responseChunkCallback,
       PEGASUS_PROVIDERMODULEFAIL_CALLBACK_T providerModuleFailCallback)
 { {
     PEG_METHOD_ENTER(TRC_PROVIDERMANAGER,     PEG_METHOD_ENTER(TRC_PROVIDERMANAGER,
         "OOPProviderManagerRouter::OOPProviderManagerRouter");         "OOPProviderManagerRouter::OOPProviderManagerRouter");
  
     _indicationCallback = indicationCallback;     _indicationCallback = indicationCallback;
     _responseChunkCallback = responseChunkCallback;     _responseChunkCallback = responseChunkCallback;
       _providerModuleFailCallback = providerModuleFailCallback;
     _subscriptionInitComplete = false;     _subscriptionInitComplete = false;
  
     PEG_METHOD_EXIT();     PEG_METHOD_EXIT();
Line 1660 
Line 1674 
     }     }
     else     else
     {     {
           //
           // Look up the Provider Agent for this module instance and requesting
           // user
           //
           ProviderAgentContainer* pa = _lookupProviderAgent(providerModule,
               request);
           PEGASUS_ASSERT(pa != 0);
   
           //
           // Forward the request to the provider agent
           //
           response.reset(pa->processMessage(request));
       }
   
       response->syncAttributes(request);
   
       PEG_METHOD_EXIT();
       return response.release();
   }
   
   ProviderAgentContainer* OOPProviderManagerRouter::_lookupProviderAgent(
       const CIMInstance& providerModule,
       CIMRequestMessage* request)
   {
         // Retrieve the provider module name         // Retrieve the provider module name
         String moduleName;         String moduleName;
         CIMValue nameValue = providerModule.getProperty(         CIMValue nameValue = providerModule.getProperty(
Line 1682 
Line 1720 
  
         if (userContext == 0)         if (userContext == 0)
         {         {
             userContext = PG_PROVMODULE_USERCTXT_PRIVILEGED;          userContext = PEGASUS_DEFAULT_PROV_USERCTXT;
         }         }
  
         String userName;         String userName;
  
         if (userContext == PG_PROVMODULE_USERCTXT_REQUESTOR)         if (userContext == PG_PROVMODULE_USERCTXT_REQUESTOR)
         {         {
             try          if(request->operationContext.contains(IdentityContainer::NAME))
             {             {
                 // User Name is in the OperationContext                 // User Name is in the OperationContext
                 IdentityContainer ic = (IdentityContainer)                 IdentityContainer ic = (IdentityContainer)
                     request->operationContext.get(IdentityContainer::NAME);                     request->operationContext.get(IdentityContainer::NAME);
                 userName = ic.getUserName();                 userName = ic.getUserName();
             }             }
             catch (Exception&)          //else
             {          //{
                 // If no IdentityContainer is present, default to the CIM                 // If no IdentityContainer is present, default to the CIM
                 // Server's user context                 // Server's user context
             }          //}
  
             // If authentication is disabled, use the CIM Server's user context             // If authentication is disabled, use the CIM Server's user context
             if (!userName.size())             if (!userName.size())
Line 1710 
Line 1748 
         }         }
         else if (userContext == PG_PROVMODULE_USERCTXT_DESIGNATED)         else if (userContext == PG_PROVMODULE_USERCTXT_DESIGNATED)
         {         {
             // Retrieve the provider module name          // Retrieve the provider module designated user property value
             providerModule.getProperty(providerModule.findProperty(             providerModule.getProperty(providerModule.findProperty(
                 PEGASUS_PROPERTYNAME_MODULE_DESIGNATEDUSER)).getValue().                 PEGASUS_PROPERTYNAME_MODULE_DESIGNATEDUSER)).getValue().
                 get(userName);                 get(userName);
Line 1732 
Line 1770 
         PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,         PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
             "User name = " + userName);             "User name = " + userName);
  
         // Look up the Provider Agent for this module and user  
         ProviderAgentContainer* pa = _lookupProviderAgent(moduleName, userName);  
         PEGASUS_ASSERT(pa != 0);  
   
         //  
         // Forward the request to the provider agent  
         //  
         response.reset(pa->processMessage(request));  
     }  
   
     response->syncAttributes(request);  
   
     PEG_METHOD_EXIT();  
     return response.release();  
 }  
   
 ProviderAgentContainer* OOPProviderManagerRouter::_lookupProviderAgent(  
     const String& moduleName,  
     const String& userName)  
 {  
     ProviderAgentContainer* pa = 0;     ProviderAgentContainer* pa = 0;
     String key = moduleName + ":" + userName;     String key = moduleName + ":" + userName;
  
Line 1759 
Line 1777 
     if (!_providerAgentTable.lookup(key, pa))     if (!_providerAgentTable.lookup(key, pa))
     {     {
         pa = new ProviderAgentContainer(         pa = new ProviderAgentContainer(
             moduleName, userName, _indicationCallback, _responseChunkCallback,              moduleName, userName, userContext,
               _indicationCallback, _responseChunkCallback,
               _providerModuleFailCallback,
             _subscriptionInitComplete);             _subscriptionInitComplete);
         _providerAgentTable.insert(key, pa);         _providerAgentTable.insert(key, pa);
     }     }


Legend:
Removed from v.1.25.2.4  
changed lines
  Added in v.1.32

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2