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

Diff for /pegasus/src/Pegasus/IndicationService/IndicationService.cpp between version 1.87 and 1.88

version 1.87, 2003/09/27 00:44:18 version 1.88, 2003/09/29 21:51:07
Line 466 
Line 466 
         }         }
 // l10n end // l10n end
  
         if (!_sendCreateRequests (indicationProviders, sourceNameSpace,          _sendCreateRequests (indicationProviders, sourceNameSpace,
             propertyList, condition, queryLanguage,             propertyList, condition, queryLanguage,
             activeSubscriptions [i],             activeSubscriptions [i],
             AcceptLanguages(acceptLangs), // l10n             AcceptLanguages(acceptLangs), // l10n
             ContentLanguages(contentLangs),  // 110n             ContentLanguages(contentLangs),  // 110n
             creator))              0,  // initialize -- no request
         {              indicationSubclasses,
             //              creator);
             //  No providers accepted this subscription  
             //  Implement the subscription's On Fatal Error Policy  
             //  If subscription is not disabled or removed,  
             //  Append this subscription to no provider list  
             //  
             if (!_handleError (activeSubscriptions [i]))  
             {  
                 noProviderSubscriptions.append (activeSubscriptions [i]);  
             }  
             continue;  
         }  
   
         //  
         //  Merge provider list into list of unique providers to enable  
         //  
         for (Uint32 j = 0; j < indicationProviders.size (); j++)  
         {  
             duplicate = false;  
             for (Uint32 k = 0; k < enableProviders.size () && !duplicate; k++)  
             {  
                 if ((indicationProviders [j].provider.identical  
                     (enableProviders [k].provider)))  
                 {  
                     duplicate = true;  
                 }  
             }  
   
             if (!duplicate)  
             {  
                 enableProviders.append (indicationProviders [j]);  
             }  
         }  
  
         //  
         //  NOTE: Once bugzilla #63 is fixed, the list of providers passed to  
         //  this function must be not those attempted to enable, but those who  
         //  were successfully enabled (response received)  
         //  
         _insertToHashTables (activeSubscriptions [i], enableProviders,  
             indicationSubclasses, sourceNameSpace);  
     }  // for each active subscription     }  // for each active subscription
  
     //     //
Line 546 
Line 507 
         }         }
     }     }
  
     //  
     //  Send Enable message to each provider  
     //  
     for (Uint32 m = 0; m < enableProviders.size (); m++)  
     {  
         //  
         //  Send Enable message  
         //  
         _sendEnable (enableProviders [m]);  
     }  
   
 #ifdef PEGASUS_INDICATION_PERFINST #ifdef PEGASUS_INDICATION_PERFINST
     double elapsed = stopWatch.getElapsed ();     double elapsed = stopWatch.getElapsed ();
  
Line 578 
Line 528 
     //  A message is already logged that CIM Server is shutting down --     //  A message is already logged that CIM Server is shutting down --
     //  no need to log a message     //  no need to log a message
     //     //
   
 #if 0 #if 0
     //     //
     //  Get existing active subscriptions from hash table     //  Get existing active subscriptions from hash table
Line 616 
Line 565 
         (CIMCreateInstanceRequestMessage*) message;         (CIMCreateInstanceRequestMessage*) message;
  
     CIMException cimException;     CIMException cimException;
       Boolean responseSent = false;
  
     CIMObjectPath instanceRef;     CIMObjectPath instanceRef;
  
Line 625 
Line 575 
     {     {
         if (_canCreate (instance, request->nameSpace))         if (_canCreate (instance, request->nameSpace))
         {         {
             //  
             //  Add creator property to Instance  
             //  NOTE: userName is only set in the request if authentication  
             //  is turned on  
             //  
             String currentUser = request->userName;  
             if (instance.findProperty (PEGASUS_PROPERTYNAME_INDSUB_CREATOR) ==  
                 PEG_NOT_FOUND)  
             {  
                 instance.addProperty (CIMProperty  
                     (PEGASUS_PROPERTYNAME_INDSUB_CREATOR, currentUser));  
             }  
             else  
             {  
                 CIMProperty creator = instance.getProperty  
                     (instance.findProperty  
                     (PEGASUS_PROPERTYNAME_INDSUB_CREATOR));  
                 creator.setValue (CIMValue (currentUser));  
             }  
   
             // l10n  
             // Add the language properties to the Instance  
             // Note:  These came from the Accept-Language and Content-Language  
             // headers in the HTTP messages, and may be empty.  
             AcceptLanguages acceptLangs = request->acceptLanguages;  
             if (instance.findProperty (PEGASUS_PROPERTYNAME_INDSUB_ACCEPTLANGS) ==  
                 PEG_NOT_FOUND)  
             {  
                 instance.addProperty (CIMProperty  
                     (PEGASUS_PROPERTYNAME_INDSUB_ACCEPTLANGS,  
                     acceptLangs.toString()));  
             }  
             else  
             {  
                 CIMProperty langs = instance.getProperty  
                     (instance.findProperty  
                     (PEGASUS_PROPERTYNAME_INDSUB_ACCEPTLANGS));  
                 langs.setValue (CIMValue (acceptLangs.toString()));  
             }  
   
             ContentLanguages contentLangs = request->contentLanguages;  
             if (instance.findProperty (PEGASUS_PROPERTYNAME_INDSUB_CONTENTLANGS) ==  
                 PEG_NOT_FOUND)  
             {  
                 instance.addProperty (CIMProperty  
                     (PEGASUS_PROPERTYNAME_INDSUB_CONTENTLANGS,  
                     contentLangs.toString()));  
             }  
             else  
             {  
                 CIMProperty langs = instance.getProperty  
                     (instance.findProperty  
                     (PEGASUS_PROPERTYNAME_INDSUB_CONTENTLANGS));  
                 langs.setValue (CIMValue (contentLangs.toString()));  
             }  
             // l10n -end  
  
             //             //
             //  If the instance is of the PEGASUS_CLASSNAME_INDSUBSCRIPTION             //  If the instance is of the PEGASUS_CLASSNAME_INDSUBSCRIPTION
Line 734 
Line 628 
  
                         throw PEGASUS_CIM_EXCEPTION_L (CIM_ERR_NOT_SUPPORTED,                         throw PEGASUS_CIM_EXCEPTION_L (CIM_ERR_NOT_SUPPORTED,
                                  MessageLoaderParms(_MSG_NO_PROVIDERS_KEY, _MSG_NO_PROVIDERS));                                  MessageLoaderParms(_MSG_NO_PROVIDERS_KEY, _MSG_NO_PROVIDERS));
   
                     }  
                 }  
   
                 //  
                 //  Set Time of Last State Change to current date time  
                 //  
                 CIMDateTime currentDateTime =  
                     CIMDateTime::getCurrentDateTime ();  
                 if (instance.findProperty (_PROPERTY_LASTCHANGE) ==  
                     PEG_NOT_FOUND)  
                 {  
                     instance.addProperty  
                         (CIMProperty (_PROPERTY_LASTCHANGE, currentDateTime));  
                 }  
                 else  
                 {  
                     CIMProperty lastChange = instance.getProperty  
                         (instance.findProperty (_PROPERTY_LASTCHANGE));  
                     lastChange.setValue (CIMValue (currentDateTime));  
                 }  
   
                 CIMDateTime startDateTime;  
                 if ((subscriptionState == _STATE_ENABLED) ||  
                     (subscriptionState == _STATE_ENABLEDDEGRADED))  
                 {  
                     startDateTime = currentDateTime;  
                 }  
                 else  
                 {  
                     //  
                     //  If subscription is not enabled, set Subscription  
                     //  Start Time to null CIMDateTime value  
                     //  
                     startDateTime = CIMDateTime ();  
                 }  
   
                 //  
                 //  Set Subscription Start Time  
                 //  
                 if (instance.findProperty (_PROPERTY_STARTTIME) ==  
                     PEG_NOT_FOUND)  
                 {  
                     instance.addProperty  
                         (CIMProperty (_PROPERTY_STARTTIME, startDateTime));  
                 }  
                 else  
                 {  
                     CIMProperty startTime = instance.getProperty  
                         (instance.findProperty (_PROPERTY_STARTTIME));  
                     startTime.setValue (CIMValue (startDateTime));  
                 }  
             }  
   
             //  
             //  Create instance in repository  
             //  
             _repository->write_lock ();  
   
             try  
             {  
                 instanceRef = _repository->createInstance (request->nameSpace,  
                     instance);  
   
                 Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE,  
                             "IndicationService::_handleCreateInstanceRequest - Name Space: $0  Instance name: $1",  
                             request->nameSpace.getString(),  
                             instance.getClassName().getString());  
             }  
             catch (CIMException & exception)  
             {  
                 cimException = exception;  
             }  
             catch (Exception & exception)  
             {  
                 cimException = PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED,  
                                                      exception.getMessage());  
             }  
   
             _repository->write_unlock ();  
   
             if (cimException.getCode() != CIM_ERR_SUCCESS)  
             {  
                 CIMCreateInstanceResponseMessage* response =  
                     new CIMCreateInstanceResponseMessage(  
                         request->messageId,  
                         cimException,  
                         request->queueIds.copyAndPop(),  
                         instanceRef);  
   
                 //  
                 //  Preserve message key  
                 //  
                 response->setKey (request->getKey ());  
   
                 //  
                 //  Set response destination  
                 //  
                 response->dest = request->queueIds.top ();  
   
                 //  
                 //  Set HTTP method in response from request  
                 //  
                 response->setHttpMethod (request->getHttpMethod ());  
   
                 Base::_enqueueResponse (request, response);  
   
                 PEG_METHOD_EXIT ();  
                 return;  
             }             }
  
             //             //
             //  If the instance is of the PEGASUS_CLASSNAME_INDSUBSCRIPTION  
             //  class and subscription state is enabled, send Create request to  
             //  indication providers  
             //  
             if (instance.getClassName ().equal  
                 (PEGASUS_CLASSNAME_INDSUBSCRIPTION))  
             {  
                 if ((subscriptionState == _STATE_ENABLED) ||  
                     (subscriptionState == _STATE_ENABLEDDEGRADED))  
                 {  
                     //  
                     //  Send Create request message to each provider                     //  Send Create request message to each provider
                     //                     //
                       instanceRef = instance.getPath ();
                     instanceRef.setNameSpace (request->nameSpace);                     instanceRef.setNameSpace (request->nameSpace);
                     instance.setPath (instanceRef);                     instance.setPath (instanceRef);
 // l10n // l10n
                     if (!_sendCreateRequests (indicationProviders,                      _sendCreateRequests (indicationProviders,
                         sourceNameSpace, requiredProperties, condition,                         sourceNameSpace, requiredProperties, condition,
                         queryLanguage, instance,                         queryLanguage, instance,
                         request->acceptLanguages,                         request->acceptLanguages,
                         request->contentLanguages,                         request->contentLanguages,
                         request->userName, request->authType))                          request,
                     {                          indicationSubclasses,
                         PEG_METHOD_EXIT ();                          request->userName, request->authType);
   
                         // l10n  
   
                         // throw PEGASUS_CIM_EXCEPTION (CIM_ERR_NOT_SUPPORTED,  
                         // _MSG_NOT_ACCEPTED);  
   
                         throw PEGASUS_CIM_EXCEPTION_L (CIM_ERR_NOT_SUPPORTED,  
                                  MessageLoaderParms(_MSG_NOT_ACCEPTED_KEY, _MSG_NOT_ACCEPTED));  
   
                     }  
  
                     //                     //
                     //  Send Enable message to each provider                      //  Response is sent from _aggregationCallBack
                     //                     //
                     for (Uint32 i = 0; i < indicationProviders.size (); i++)                      responseSent = true;
                   }
                   else
                     {                     {
                         //                         //
                         //  Send Enable message                      //  Create instance for disabled subscription
                         //                         //
                         _sendEnable (indicationProviders [i]);                      instanceRef = _createInstance (request, instance, false);
                     }                     }
               }
               else
               {
                     //                     //
                     //  NOTE: Once bugzilla #63 is fixed, the list of providers                  //  Create instance for filter or handler
                     //  passed to this function must be not those attempted to  
                     //  enable, but those who were successfully enabled  
                     //  (response received)  
                     //                     //
                     _insertToHashTables (instance, indicationProviders,                  instanceRef = _createInstance (request, instance, false);
                         indicationSubclasses, sourceNameSpace);  
                 }  
             }             }
         }         }
     }     }
Line 915 
Line 679 
     }     }
  
     //     //
     //  FUTURE: Response should be sent only after Create response      //  Send response, if it has not already been sent by callback
     //  has been received  
     //     //
       if (!responseSent)
       {
 // l10n - no Content-Language in response // l10n - no Content-Language in response
     CIMCreateInstanceResponseMessage* response =     CIMCreateInstanceResponseMessage* response =
         new CIMCreateInstanceResponseMessage(         new CIMCreateInstanceResponseMessage(
Line 942 
Line 707 
     response->setHttpMethod (request->getHttpMethod ());     response->setHttpMethod (request->getHttpMethod ());
  
     Base::_enqueueResponse (request, response);     Base::_enqueueResponse (request, response);
       }
  
     PEG_METHOD_EXIT ();     PEG_METHOD_EXIT ();
 } }
Line 1275 
Line 1041 
         (CIMModifyInstanceRequestMessage*) message;         (CIMModifyInstanceRequestMessage*) message;
  
     CIMException cimException;     CIMException cimException;
       Boolean responseSent = false;
  
     try     try
     {     {
Line 1585 
Line 1352 
                     instanceReference.setNameSpace (request->nameSpace);                     instanceReference.setNameSpace (request->nameSpace);
                     instance.setPath (instanceReference);                     instance.setPath (instanceReference);
 // l10n // l10n
                     if (!_sendCreateRequests (indicationProviders,                      _sendCreateRequests (indicationProviders,
                         sourceNameSpace, requiredProperties, condition,                         sourceNameSpace, requiredProperties, condition,
                         queryLanguage,                         queryLanguage,
                         instance,                         instance,
                         request->acceptLanguages,                         request->acceptLanguages,
                         request->contentLanguages,                         request->contentLanguages,
                         request->userName, request->authType))                          request,
                     {                          indicationSubclasses,
                         PEG_METHOD_EXIT ();                          request->userName, request->authType);
   
                         // l10n  
   
                         // throw PEGASUS_CIM_EXCEPTION (CIM_ERR_NOT_SUPPORTED,  
                         // _MSG_NOT_ACCEPTED);  
   
                         throw PEGASUS_CIM_EXCEPTION_L (CIM_ERR_NOT_SUPPORTED,  
                                  MessageLoaderParms(_MSG_NOT_ACCEPTED_KEY, _MSG_NOT_ACCEPTED));  
   
                     }  
   
                     //  
                     //  Send Enable message to each provider  
                     //  
                     for (Uint32 i = 0; i < indicationProviders.size (); i++)  
                     {  
                         //  
                         //  Send Enable message  
                         //  
                         _sendEnable (indicationProviders [i]);  
                     }  
  
                     //                     //
                     //  Insert entries into the subscription hash tables                      //  Response is sent from _aggregationCallBack
                     //  
                     //                     //
                     //  NOTE: Once bugzilla #63 is fixed, the list of providers                      responseSent = true;
                     //  passed to this function must be not those attempted to  
                     //  enable, but those who were successfully enabled  
                     //  (response received)  
                     //  
                     _insertToHashTables (instance, indicationProviders,  
                         indicationSubclasses, sourceNameSpace);  
                 }                 }
                 else if ((newState == _STATE_DISABLED) &&                 else if ((newState == _STATE_DISABLED) &&
                          ((currentState == _STATE_ENABLED) ||                          ((currentState == _STATE_ENABLED) ||
Line 1637 
Line 1376 
                     //  disabled                     //  disabled
                     //                     //
                     Array <ProviderClassList> indicationProviders;                     Array <ProviderClassList> indicationProviders;
                     indicationProviders = _getDeleteParams (request->nameSpace,                      instanceReference.setNameSpace (request->nameSpace);
                       instance.setPath (instanceReference);
                       indicationProviders = _getDeleteParams (request->nameSpace,
                         instance, indicationSubclasses, sourceNameSpace);                         instance, indicationSubclasses, sourceNameSpace);
  
                     //                     //
                     //  Send Delete requests                     //  Send Delete requests
                     //                     //
 //l10n //l10n
                     instanceReference.setNameSpace (request->nameSpace);  
                     instance.setPath (instanceReference);  
                     if (indicationProviders.size () > 0)                     if (indicationProviders.size () > 0)
                     {                     {
                         _sendDeleteRequests (indicationProviders,                         _sendDeleteRequests (indicationProviders,
Line 1653 
Line 1392 
                             instance,                             instance,
                             request->acceptLanguages,                             request->acceptLanguages,
                             request->contentLanguages,                             request->contentLanguages,
                               request,
                               indicationSubclasses,
                             request->userName, request->authType);                             request->userName, request->authType);
                     }  
  
                     //                     //
                     //  Remove entries from the subscription hash tables                          //  Response is sent from _aggregationCallBack
                     //                     //
                     _removeFromHashTables (instance, indicationSubclasses,                          responseSent = true;
                         sourceNameSpace);                      }
                 }                 }
             }             }
         }         }
Line 1676 
Line 1416 
     }     }
  
     //     //
     //  FUTURE: Response should be sent only after Create or Delete      //  Send response, if it has not already been sent from callback
     //  response has been received  
     //     //
       if (!responseSent)
       {
 // l10n // l10n
     // Note: don't need to set content-language in the response.     // Note: don't need to set content-language in the response.
     CIMModifyInstanceResponseMessage* response =     CIMModifyInstanceResponseMessage* response =
Line 1703 
Line 1444 
     response->setHttpMethod (request->getHttpMethod ());     response->setHttpMethod (request->getHttpMethod ());
  
     Base::_enqueueResponse (request, response);     Base::_enqueueResponse (request, response);
       }
  
     PEG_METHOD_EXIT ();     PEG_METHOD_EXIT ();
 } }
Line 1716 
Line 1458 
         (CIMDeleteInstanceRequestMessage*) message;         (CIMDeleteInstanceRequestMessage*) message;
  
     CIMException cimException;     CIMException cimException;
       Boolean responseSent = false;
  
     try     try
     {     {
Line 1726 
Line 1469 
         if (_canDelete (request->instanceName, request->nameSpace,         if (_canDelete (request->instanceName, request->nameSpace,
             request->userName))             request->userName))
         {         {
               //
               //  If a subscription, get the instance from the repository
               //
               CIMInstance subscriptionInstance;
             if (request->instanceName.getClassName ().equal             if (request->instanceName.getClassName ().equal
                 (PEGASUS_CLASSNAME_INDSUBSCRIPTION))                 (PEGASUS_CLASSNAME_INDSUBSCRIPTION))
             {             {
                 CIMInstance subscriptionInstance;  
                 Array <ProviderClassList> indicationProviders;  
   
                 _repository->read_lock ();                 _repository->read_lock ();
  
                 try                 try
Line 1747 
Line 1491 
                 }                 }
  
                 _repository->read_unlock ();                 _repository->read_unlock ();
   
                 Array <CIMName> indicationSubclasses;  
                 CIMNamespaceName sourceNamespaceName;  
                 indicationProviders = _getDeleteParams  
                     (request->nameSpace, subscriptionInstance,  
                     indicationSubclasses, sourceNamespaceName);  
   
                 //  
                 //  Send Delete requests  
                 //  
 // l10n  
                 CIMObjectPath instanceReference = request->instanceName;  
                 instanceReference.setNameSpace (request->nameSpace);  
                 subscriptionInstance.setPath (instanceReference);  
                 _sendDeleteRequests (indicationProviders,  
                     request->nameSpace, subscriptionInstance,  
                     request->acceptLanguages,  
                     request->contentLanguages,  
                     request->userName, request->authType);  
   
                 //  
                 //  Remove entries from subscription hash tables  
                 //  
                 _removeFromHashTables (subscriptionInstance,  
                     indicationSubclasses, sourceNamespaceName);  
             }             }
  
             //             //
Line 1829 
Line 1548 
                 PEG_METHOD_EXIT ();                 PEG_METHOD_EXIT ();
                 return;                 return;
             }             }
   
               if (request->instanceName.getClassName ().equal
                   (PEGASUS_CLASSNAME_INDSUBSCRIPTION))
               {
                   //
                   //  If subscription is active, send delete requests to providers
                   //  and update hash tables
                   //
                   Uint16 subscriptionState;
                   CIMValue subscriptionStateValue;
                   subscriptionStateValue = subscriptionInstance.getProperty
                       (subscriptionInstance.findProperty
                       (_PROPERTY_STATE)).getValue ();
                   subscriptionStateValue.get (subscriptionState);
   
                   if ((subscriptionState == _STATE_ENABLED) ||
                       (subscriptionState == _STATE_ENABLEDDEGRADED))
                   {
                       Array <ProviderClassList> indicationProviders;
                       Array <CIMName> indicationSubclasses;
                       CIMNamespaceName sourceNamespaceName;
                       CIMObjectPath instanceReference = request->instanceName;
                       instanceReference.setNameSpace (request->nameSpace);
                       subscriptionInstance.setPath (instanceReference);
   
                       indicationProviders = _getDeleteParams
                           (request->nameSpace, subscriptionInstance,
                           indicationSubclasses, sourceNamespaceName);
   
                       //
                       //  Send Delete requests
                       //
   // l10n
                       _sendDeleteRequests (indicationProviders,
                           request->nameSpace, subscriptionInstance,
                           request->acceptLanguages,
                           request->contentLanguages,
                           request,
                           indicationSubclasses,
                           request->userName, request->authType);
   
                       //
                       //  Response is sent from _aggregationCallBack
                       //
                       responseSent = true;
                   }
               }
         }         }
     }     }
     catch (CIMException& exception)     catch (CIMException& exception)
Line 1842 
Line 1608 
     }     }
  
     //     //
     //  FUTURE: Response should be sent only after Delete response has      //  Send response, if it has not already been sent from callback
     //  been received  
     //     //
       if (!responseSent)
       {
     CIMDeleteInstanceResponseMessage* response =     CIMDeleteInstanceResponseMessage* response =
         new CIMDeleteInstanceResponseMessage(         new CIMDeleteInstanceResponseMessage(
             request->messageId,             request->messageId,
Line 1867 
Line 1634 
     response->setHttpMethod (request->getHttpMethod ());     response->setHttpMethod (request->getHttpMethod ());
  
     Base::_enqueueResponse (request, response);     Base::_enqueueResponse (request, response);
       }
  
     PEG_METHOD_EXIT ();     PEG_METHOD_EXIT ();
 } }
Line 2274 
Line 2042 
             if (_lockedLookupActiveSubscriptionsEntry (activeSubscriptionsKey,             if (_lockedLookupActiveSubscriptionsEntry (activeSubscriptionsKey,
                 tableValue))                 tableValue))
             {             {
                 Boolean update = false;  
                 ProviderClassList providerClasses;  
   
                 //                 //
                 //  If the provider is already in the subscription's list,                 //  If the provider is already in the subscription's list,
                 //  send a Modify request, otherwise send a Create request                 //  send a Modify request, otherwise send a Create request
Line 2294 
Line 2059 
                         newSubscriptions [i],                         newSubscriptions [i],
                         AcceptLanguages(acceptLangs),                         AcceptLanguages(acceptLangs),
                         ContentLanguages(contentLangs),                         ContentLanguages(contentLangs),
                           request,
                         creator);                         creator);
   
                     Uint32 classIndex = _classInList (className,  
                         tableValue.providers [providerIndex]);  
                     if (classIndex == PEG_NOT_FOUND)  
                     {  
                         //  
                         //  Provider is already serving this subscription, but  
                         //  not for this class  
                         //  
                         update = true;  
                         tableValue.providers [providerIndex].classList.append  
                             (className);  
                     }  
                 }                 }
                 else                 else
                 {                 {
                     //                     //
                     //  Provider was not previously serving this subscription  
                     //  
                     update = true;  
                     tableValue.providers.append (indicationProvider);  
   
                     //  
                     //  Send Create requests                     //  Send Create requests
                     //                     //
 // l10n // l10n
                     if (!_sendCreateRequests (indicationProviders,                      _sendCreateRequests (indicationProviders,
                         sourceNameSpace, requiredProperties, condition,                         sourceNameSpace, requiredProperties, condition,
                         queryLanguage, newSubscriptions [i],                         queryLanguage, newSubscriptions [i],
                         AcceptLanguages(acceptLangs),                         AcceptLanguages(acceptLangs),
                         ContentLanguages(contentLangs),                         ContentLanguages(contentLangs),
                         creator))                          request,
                     {                          indicationSubclasses,
                         PEG_METHOD_EXIT ();                          creator);
   
                         // l10n  
   
                         // throw PEGASUS_CIM_EXCEPTION (CIM_ERR_NOT_SUPPORTED,  
                         // _MSG_NOT_ACCEPTED);  
   
                         throw PEGASUS_CIM_EXCEPTION_L (CIM_ERR_NOT_SUPPORTED,  
                                  MessageLoaderParms(_MSG_NOT_ACCEPTED_KEY, _MSG_NOT_ACCEPTED));  
   
                     }  
   
                     //  
                     //  Send Enable message to each provider  
                     //  
                     for (Uint32 j = 0; j < indicationProviders.size (); j++)  
                     {  
                         //  
                         //  Send Enable message  
                         //  
                         _sendEnable (indicationProviders [j]);  
                     }  
                 }  
   
                 //  
                 //  NOTE: Once bugzilla #63 is fixed, the update must only  
                 //  be done if the provider responds successfully to the  
                 //  enable request  
                 //  
                 if (update)  
                 {  
                     WriteLock lock(_activeSubscriptionsTableLock);  
   
                     _removeActiveSubscriptionsEntry (activeSubscriptionsKey);  
                     _insertActiveSubscriptionsEntry (tableValue.subscription,  
                         tableValue.providers);  
                 }                 }
   
             }  // subscription found in table             }  // subscription found in table
             else             else
             {             {
                 //                 //
                 //  Subscription not found in Active Subscriptions table                 //  Subscription not found in Active Subscriptions table
                 //                 //
                   PEG_TRACE_STRING (TRC_INDICATION_SERVICE, Tracer::LEVEL2,
                 //                      "Subscription (" + activeSubscriptionsKey +
                 //  ATTN-CAKG-P3-20030403: Log a message                      ") not found in ActiveSubscriptionsTable");
                 //  
             }             }
         }         }
  
Line 2459 
Line 2169 
                 Uint32 providerIndex = _providerInList (provider, tableValue);                 Uint32 providerIndex = _providerInList (provider, tableValue);
                 if (providerIndex != PEG_NOT_FOUND)                 if (providerIndex != PEG_NOT_FOUND)
                 {                 {
                       CIMNamespaceName sourceNameSpace;
                       Array <CIMName> indicationSubclasses;
                       _getCreateParams
                           (formerSubscriptions [i].getPath ().getNameSpace (),
                           formerSubscriptions [i], indicationSubclasses,
                           requiredProperties, sourceNameSpace, condition,
                           queryLanguage);
   
                     //                     //
                     //  If class list contains only the class name from the                     //  If class list contains only the class name from the
                     //  current delete, send a Delete request                     //  current delete, send a Delete request
Line 2474 
Line 2192 
                             formerSubscriptions [i],                             formerSubscriptions [i],
                             AcceptLanguages(acceptLangs),                             AcceptLanguages(acceptLangs),
                             ContentLanguages(contentLangs),                             ContentLanguages(contentLangs),
                               request,
                               indicationSubclasses,
                             creator);                             creator);
   
                         tableValue.providers.remove (providerIndex);  
                     }                     }
  
                     //                     //
Line 2488 
Line 2206 
                             tableValue.providers [providerIndex]);                             tableValue.providers [providerIndex]);
                         if (classIndex != PEG_NOT_FOUND)                         if (classIndex != PEG_NOT_FOUND)
                         {                         {
                         CIMNamespaceName sourceNameSpace;  
                         Array <CIMName> indicationSubclasses;  
                         _getCreateParams  
                             (formerSubscriptions [i].getPath ().getNameSpace (),  
                             formerSubscriptions [i], indicationSubclasses,  
                             requiredProperties, sourceNameSpace, condition,  
                             queryLanguage);  
   
                         //                         //
                         //  Send Modify requests                         //  Send Modify requests
                         //                         //
Line 2506 
Line 2216 
                             formerSubscriptions [i],                             formerSubscriptions [i],
                             AcceptLanguages(acceptLangs),                             AcceptLanguages(acceptLangs),
                             ContentLanguages(contentLangs),                             ContentLanguages(contentLangs),
                               request,
                             creator);                             creator);
   
                         tableValue.providers [providerIndex].classList.remove  
                             (classIndex);  
                         }                         }
                         else                         else
                         {                         {
                             //                              PEG_TRACE_STRING (TRC_INDICATION_SERVICE,
                             //  ATTN-CAKG-P3-20030403: Log a message                                  Tracer::LEVEL2,
                             //                                  "Class " + className.getString() +
                         }                                  " not found in tableValue.providers");
                     }                     }
   
                     {  
                         WriteLock lock(_activeSubscriptionsTableLock);  
                         _removeActiveSubscriptionsEntry (  
                             activeSubscriptionsKey);  
                         _insertActiveSubscriptionsEntry (  
                             tableValue.subscription,  
                             tableValue.providers);  
                     }                     }
                 }                 }
                 else                 else
Line 2538 
Line 2238 
             else             else
             {             {
                 //                 //
                 //  ATTN-CAKG-P3-20030403: Log a message                  //  Subscription not found in Active Subscriptions table
                 //                 //
                   PEG_TRACE_STRING (TRC_INDICATION_SERVICE, Tracer::LEVEL2,
                       "Subscription (" + activeSubscriptionsKey +
                       ") not found in ActiveSubscriptionsTable");
             }             }
         }         }
  
Line 2559 
Line 2262 
             formerSubscriptions.size ());             formerSubscriptions.size ());
         _sendAlerts (formerSubscriptions, indicationInstance);         _sendAlerts (formerSubscriptions, indicationInstance);
 #endif #endif
   
         //         //
         //  NOTE: When a provider that was previously serving a subscription         //  NOTE: When a provider that was previously serving a subscription
         //  no longer serves the subscription due to a provider registration         //  no longer serves the subscription due to a provider registration
Line 3319 
Line 3021 
     PEG_METHOD_EXIT ();     PEG_METHOD_EXIT ();
 } }
  
 Boolean IndicationService::_canModify (  CIMObjectPath IndicationService::_createInstance (
     const CIMModifyInstanceRequestMessage * request,      CIMCreateInstanceRequestMessage * request,
     const CIMObjectPath & instanceReference,      CIMInstance instance,
     const CIMInstance & instance,      Boolean enabled)
     CIMInstance & modifiedInstance)  
 { {
     PEG_METHOD_ENTER (TRC_INDICATION_SERVICE, "IndicationService::_canModify");      CIMObjectPath instanceRef;
       CIMException cimException;
  
     //     //
     //  Currently, only modification allowed is of Subscription State      //  Add creator property to Instance
     //  property in Subscription class      //  NOTE: userName is only set in the request if authentication
       //  is turned on
     //     //
     if (!instanceReference.getClassName ().equal      String currentUser = request->userName;
         (PEGASUS_CLASSNAME_INDSUBSCRIPTION))      if (instance.findProperty (PEGASUS_PROPERTYNAME_INDSUB_CREATOR) ==
           PEG_NOT_FOUND)
     {     {
         PEG_METHOD_EXIT ();          instance.addProperty (CIMProperty
         throw PEGASUS_CIM_EXCEPTION(CIM_ERR_NOT_SUPPORTED, String::EMPTY);              (PEGASUS_PROPERTYNAME_INDSUB_CREATOR, currentUser));
     }     }
       else
     if (request->includeQualifiers)  
     {     {
         PEG_METHOD_EXIT ();          CIMProperty creator = instance.getProperty
         throw PEGASUS_CIM_EXCEPTION(CIM_ERR_NOT_SUPPORTED, String::EMPTY);              (instance.findProperty
               (PEGASUS_PROPERTYNAME_INDSUB_CREATOR));
           creator.setValue (CIMValue (currentUser));
     }     }
  
     //      // l10n
     //  Request is invalid if property list is null, meaning all properties      // Add the language properties to the Instance
     //  are to be updated      // Note:  These came from the Accept-Language and Content-Language
     //      // headers in the HTTP messages, and may be empty.
     if (request->propertyList.isNull ())      AcceptLanguages acceptLangs = request->acceptLanguages;
       if (instance.findProperty (PEGASUS_PROPERTYNAME_INDSUB_ACCEPTLANGS) ==
           PEG_NOT_FOUND)
     {     {
         PEG_METHOD_EXIT ();          instance.addProperty (CIMProperty
         throw PEGASUS_CIM_EXCEPTION(CIM_ERR_NOT_SUPPORTED, String::EMPTY);              (PEGASUS_PROPERTYNAME_INDSUB_ACCEPTLANGS,
               acceptLangs.toString()));
     }     }
       else
     //  
     //  Request is invalid if more than one property is specified  
     //  
     else if (request->propertyList.size () > 1)  
     {     {
         PEG_METHOD_EXIT ();          CIMProperty langs = instance.getProperty
         throw PEGASUS_CIM_EXCEPTION(CIM_ERR_NOT_SUPPORTED, String::EMPTY);              (instance.findProperty
               (PEGASUS_PROPERTYNAME_INDSUB_ACCEPTLANGS));
           langs.setValue (CIMValue (acceptLangs.toString()));
     }     }
  
     //      ContentLanguages contentLangs = request->contentLanguages;
     //  For request to be valid, zero or one property must be specified      if (instance.findProperty (PEGASUS_PROPERTYNAME_INDSUB_CONTENTLANGS) ==
     //  If one property specified, it must be Subscription State property          PEG_NOT_FOUND)
     //  
     else if ((request->propertyList.size () == 1) &&  
              (!request->propertyList[0].equal (_PROPERTY_STATE)))  
     {     {
         PEG_METHOD_EXIT ();          instance.addProperty (CIMProperty
         throw PEGASUS_CIM_EXCEPTION(CIM_ERR_NOT_SUPPORTED, String::EMPTY);              (PEGASUS_PROPERTYNAME_INDSUB_CONTENTLANGS,
               contentLangs.toString()));
       }
       else
       {
           CIMProperty langs = instance.getProperty
               (instance.findProperty
               (PEGASUS_PROPERTYNAME_INDSUB_CONTENTLANGS));
           langs.setValue (CIMValue (contentLangs.toString()));
     }     }
       // l10n -end
  
       if (instance.getClassName ().equal
           (PEGASUS_CLASSNAME_INDSUBSCRIPTION))
       {
     //     //
     //  Check the SubscriptionState property in the modified instance          //  Set Time of Last State Change to current date time
     //          //
     _checkPropertyWithOther (modifiedInstance, _PROPERTY_STATE,          CIMDateTime currentDateTime =
         _PROPERTY_OTHERSTATE, (Uint16) _STATE_ENABLED, (Uint16) _STATE_OTHER,              CIMDateTime::getCurrentDateTime ();
         _validStates);          if (instance.findProperty (_PROPERTY_LASTCHANGE) ==
               PEG_NOT_FOUND)
           {
               instance.addProperty
                   (CIMProperty (_PROPERTY_LASTCHANGE, currentDateTime));
           }
           else
           {
               CIMProperty lastChange = instance.getProperty
                   (instance.findProperty (_PROPERTY_LASTCHANGE));
               lastChange.setValue (CIMValue (currentDateTime));
           }
   
           CIMDateTime startDateTime;
           if (enabled)
           {
               startDateTime = currentDateTime;
           }
           else
           {
               //
               //  If subscription is not enabled, set Subscription
               //  Start Time to null CIMDateTime value
               //
               startDateTime = CIMDateTime ();
           }
   
           //
           //  Set Subscription Start Time
           //
           if (instance.findProperty (_PROPERTY_STARTTIME) ==
               PEG_NOT_FOUND)
           {
               instance.addProperty
                   (CIMProperty (_PROPERTY_STARTTIME, startDateTime));
           }
           else
           {
               CIMProperty startTime = instance.getProperty
                   (instance.findProperty (_PROPERTY_STARTTIME));
               startTime.setValue (CIMValue (startDateTime));
           }
       }
   
       //
       //  Create instance in repository
       //
       _repository->write_lock ();
   
       try
       {
           instanceRef = _repository->createInstance (
               request->nameSpace,
               instance);
   
           Logger::put (
               Logger::STANDARD_LOG,
               System::CIMSERVER,
               Logger::TRACE,
               "IndicationService::_handleCreateInstanceRequest - Name Space: $0  Instance name: $1",
               request->nameSpace.getString (),
               instance.getClassName ().getString ());
       }
       catch (CIMException & exception)
       {
           _repository->write_unlock ();
           cimException = exception;
           throw cimException;
       }
       catch (Exception & exception)
       {
           _repository->write_unlock ();
           cimException = PEGASUS_CIM_EXCEPTION
               (CIM_ERR_FAILED, exception.getMessage ());
           throw cimException;
       }
   
       _repository->write_unlock ();
       return instanceRef;
   }
   
   Boolean IndicationService::_canModify (
       const CIMModifyInstanceRequestMessage * request,
       const CIMObjectPath & instanceReference,
       const CIMInstance & instance,
       CIMInstance & modifiedInstance)
   {
       PEG_METHOD_ENTER (TRC_INDICATION_SERVICE, "IndicationService::_canModify");
   
       //
       //  Currently, only modification allowed is of Subscription State
       //  property in Subscription class
       //
       if (!instanceReference.getClassName ().equal
           (PEGASUS_CLASSNAME_INDSUBSCRIPTION))
       {
           PEG_METHOD_EXIT ();
           throw PEGASUS_CIM_EXCEPTION(CIM_ERR_NOT_SUPPORTED, String::EMPTY);
       }
   
       if (request->includeQualifiers)
       {
           PEG_METHOD_EXIT ();
           throw PEGASUS_CIM_EXCEPTION(CIM_ERR_NOT_SUPPORTED, String::EMPTY);
       }
   
       //
       //  Request is invalid if property list is null, meaning all properties
       //  are to be updated
       //
       if (request->propertyList.isNull ())
       {
           PEG_METHOD_EXIT ();
           throw PEGASUS_CIM_EXCEPTION(CIM_ERR_NOT_SUPPORTED, String::EMPTY);
       }
   
       //
       //  Request is invalid if more than one property is specified
       //
       else if (request->propertyList.size () > 1)
       {
           PEG_METHOD_EXIT ();
           throw PEGASUS_CIM_EXCEPTION(CIM_ERR_NOT_SUPPORTED, String::EMPTY);
       }
   
       //
       //  For request to be valid, zero or one property must be specified
       //  If one property specified, it must be Subscription State property
       //
       else if ((request->propertyList.size () == 1) &&
                (!request->propertyList[0].equal (_PROPERTY_STATE)))
       {
           PEG_METHOD_EXIT ();
           throw PEGASUS_CIM_EXCEPTION(CIM_ERR_NOT_SUPPORTED, String::EMPTY);
       }
   
       //
       //  Check the SubscriptionState property in the modified instance
       //
       _checkPropertyWithOther (modifiedInstance, _PROPERTY_STATE,
           _PROPERTY_OTHERSTATE, (Uint16) _STATE_ENABLED, (Uint16) _STATE_OTHER,
           _validStates);
   
     //     //
     //  Get creator from instance     //  Get creator from instance
     //     //
Line 4809 
Line 4665 
         //         //
         if (handler == ref)         if (handler == ref)
         {         {
               //
               //  Delete referencing subscription instance from repository
               //
               _repository->write_lock ();
   
               try
               {
                   //
                   //  Namespace and host must not be set in path passed to
                   //  repository
                   //
                   CIMObjectPath path ("", CIMNamespaceName (),
                       subscriptions [i].getPath ().getClassName(),
                       subscriptions [i].getPath ().getKeyBindings());
                   _repository->deleteInstance (nameSpace, path);
               }
               catch (Exception & exception)
               {
                   //
                   //  Deletion of referencing subscription failed
                   //
                   PEG_TRACE_STRING (TRC_INDICATION_SERVICE, Tracer::LEVEL2,
                       "Exception caught in deleting referencing subscription (" +
                       subscriptions[i].getPath().toString() + "): " +
                       exception.getMessage ());
               }
               _repository->write_unlock ();
   
             Array <ProviderClassList> indicationProviders;             Array <ProviderClassList> indicationProviders;
             Array <CIMName> indicationSubclasses;             Array <CIMName> indicationSubclasses;
             CIMNamespaceName sourceNamespaceName;             CIMNamespaceName sourceNamespaceName;
   
               CIMObjectPath path = subscriptions [i].getPath ();
               path.setNameSpace (nameSpace);
               subscriptions [i].setPath (path);
   
             indicationProviders = _getDeleteParams (nameSpace,             indicationProviders = _getDeleteParams (nameSpace,
                 subscriptions [i], indicationSubclasses, sourceNamespaceName);                 subscriptions [i], indicationSubclasses, sourceNamespaceName);
  
             //             //
             //  Send Delete requests             //  Send Delete requests
             //             //
               //  NOTE: These Delete requests are not associated with a user
               //  request, so there is no associated authType or userName
               //  The Creator from the subscription instance is used for userName,
               //  and authType is not set
               //
             CIMInstance instance = subscriptions [i];             CIMInstance instance = subscriptions [i];
             String creator = String::EMPTY;             String creator = String::EMPTY;
             if (!_getCreator (instance, creator))              _getCreator (instance, creator);
             {  
                 //  
                 //  This instance from the repository is corrupted  
                 //  Allow the delete  
                 //  
             }  
  
 // l10n start // l10n start
             String acceptLangs = String::EMPTY;             String acceptLangs = String::EMPTY;
Line 4852 
Line 4740 
                 subscriptions [i],                 subscriptions [i],
                 AcceptLanguages(acceptLangs),                 AcceptLanguages(acceptLangs),
                 ContentLanguages(contentLangs),                 ContentLanguages(contentLangs),
                   0,  // no request
                   indicationSubclasses,
                 creator);                 creator);
   
             //  
             //  Delete referencing subscription instance from repository  
             //  
             _repository->write_lock ();  
   
             try  
             {  
                 //  
                 //  Namespace and host must not be set in path passed to  
                 //  repository  
                 //  
                 CIMObjectPath path ("", CIMNamespaceName (),  
                     subscriptions [i].getPath ().getClassName(),  
                     subscriptions [i].getPath ().getKeyBindings());  
                 _repository->deleteInstance (nameSpace, path);  
             }  
             catch (Exception & exception)  
             {  
                 //  
                 //  ATTN-CAKG-P3-20020425: Log a message  
                 //  
             }  
   
             _repository->write_unlock ();  
         }         }
     }     }
  
Line 4920 
Line 4785 
     PEG_METHOD_ENTER (TRC_INDICATION_SERVICE,     PEG_METHOD_ENTER (TRC_INDICATION_SERVICE,
                       "IndicationService::_deleteExpiredSubscription");                       "IndicationService::_deleteExpiredSubscription");
  
       CIMInstance subscriptionInstance;
       Array <ProviderClassList> indicationProviders;
     CIMNamespaceName nameSpace = subscription.getNameSpace ();     CIMNamespaceName nameSpace = subscription.getNameSpace ();
     subscription.setNameSpace (CIMNamespaceName ());     subscription.setNameSpace (CIMNamespaceName ());
  
     //     //
       //  Get instance from repository
       //
       _repository->read_lock ();
   
       try
       {
           subscriptionInstance = _repository->getInstance
               (nameSpace, subscription);
       }
       catch (Exception e)
       {
           _repository->read_unlock ();
           PEG_METHOD_EXIT ();
           throw e;
       }
   
       _repository->read_unlock ();
   
       //
     //  Delete the subscription instance     //  Delete the subscription instance
     //     //
     _repository->write_lock ();     _repository->write_lock ();
Line 4934 
Line 4820 
     }     }
     catch (Exception & exception)     catch (Exception & exception)
     {     {
         //          PEG_TRACE_STRING (TRC_INDICATION_SERVICE, Tracer::LEVEL2,
         //  ATTN-CAKG-P3-20020425: Log a message              "Exception caught in deleting expired subscription (" +
         //              subscriptionInstance.getPath().toString() + "): " +
               exception.getMessage ());
     }     }
  
     _repository->write_unlock ();     _repository->write_unlock ();
  
     PEG_METHOD_EXIT ();      //
 }      //  If subscription was active, send delete requests to providers
       //  and update hash tables
       //
       Uint16 subscriptionState;
       CIMValue subscriptionStateValue;
       subscriptionStateValue = subscriptionInstance.getProperty
           (subscriptionInstance.findProperty
           (_PROPERTY_STATE)).getValue ();
       subscriptionStateValue.get (subscriptionState);
  
 Boolean IndicationService::_getTimeRemaining (      if ((subscriptionState == _STATE_ENABLED) ||
     const CIMInstance & instance,          (subscriptionState == _STATE_ENABLEDDEGRADED))
     Uint64 & timeRemaining) const  
 { {
     PEG_METHOD_ENTER (TRC_INDICATION_SERVICE,          Array <CIMName> indicationSubclasses;
                       "IndicationService::_getTimeRemaining");          CIMNamespaceName sourceNamespaceName;
  
     Boolean hasDuration = true;          subscription.setNameSpace (nameSpace);
     timeRemaining = 0;          subscriptionInstance.setPath (subscription);
  
     //          indicationProviders = _getDeleteParams
     //  Calculate time remaining from subscription              (nameSpace, subscriptionInstance,
     //  start time, subscription duration, and current date time              indicationSubclasses, sourceNamespaceName);
     //  
  
     //     //
     //  NOTE: It is assumed that the instance passed to this method is a          //  Send Delete requests
     //  subscription instance, and that the Start Time property exists          //
     //  and has a value          //  NOTE: These Delete requests are not associated with a user request,
           //  so there is no associated authType or userName
           //  The Creator from the subscription instance is used for userName,
           //  and authType is not set
     //     //
           String creator;
           _getCreator (subscriptionInstance, creator);
  
     //     //
     //  Get Subscription Start Time          // Get the language tags that were saved with the subscription instance
     //     //
     CIMValue startTimeValue;          String acceptLangs = String::EMPTY;
     CIMDateTime startTime;          Uint32 propIndex = subscriptionInstance.findProperty
     startTimeValue = instance.getProperty              (PEGASUS_PROPERTYNAME_INDSUB_ACCEPTLANGS);
         (instance.findProperty (_PROPERTY_STARTTIME)).getValue ();          if (propIndex != PEG_NOT_FOUND)
           {
                subscriptionInstance.getProperty (propIndex).getValue ().get
                    (acceptLangs);
           }
           String contentLangs = String::EMPTY;
           propIndex = subscriptionInstance.findProperty
               (PEGASUS_PROPERTYNAME_INDSUB_CONTENTLANGS);
           if (propIndex != PEG_NOT_FOUND)
           {
                subscriptionInstance.getProperty (propIndex).getValue ().get
                    (contentLangs);
           }
   
   // l10n
           subscriptionInstance.setPath (subscription);
           _sendDeleteRequests (indicationProviders,
               nameSpace, subscriptionInstance,
               AcceptLanguages(acceptLangs),
               ContentLanguages(contentLangs),
               0, // no request
               indicationSubclasses,
               creator);
       }
   
       PEG_METHOD_EXIT ();
   }
   
   Boolean IndicationService::_getTimeRemaining (
       const CIMInstance & instance,
       Uint64 & timeRemaining) const
   {
       PEG_METHOD_ENTER (TRC_INDICATION_SERVICE,
                         "IndicationService::_getTimeRemaining");
   
       Boolean hasDuration = true;
       timeRemaining = 0;
   
       //
       //  Calculate time remaining from subscription
       //  start time, subscription duration, and current date time
       //
   
       //
       //  NOTE: It is assumed that the instance passed to this method is a
       //  subscription instance, and that the Start Time property exists
       //  and has a value
       //
   
       //
       //  Get Subscription Start Time
       //
       CIMValue startTimeValue;
       CIMDateTime startTime;
       startTimeValue = instance.getProperty
           (instance.findProperty (_PROPERTY_STARTTIME)).getValue ();
     startTimeValue.get (startTime);     startTimeValue.get (startTime);
  
     //     //
Line 5232 
Line 5185 
     else     else
     {     {
         //         //
         //  ATTN-CAKG-P3-20030403: Log a message          //  Subscription not found in Active Subscriptions table
         //         //
           PEG_TRACE_STRING (TRC_INDICATION_SERVICE, Tracer::LEVEL2,
               "Subscription (" + activeSubscriptionsKey +
               ") not found in ActiveSubscriptionsTable");
     }     }
  
     PEG_METHOD_EXIT ();     PEG_METHOD_EXIT ();
     return indicationProviders;     return indicationProviders;
 } }
  
   // l10n
 void IndicationService::_sendCreateRequestsCallBack(AsyncOpNode *op,  void IndicationService::_sendCreateRequests
                                                     MessageQueue *q,      (const Array <ProviderClassList> & indicationProviders,
                                                     void *parm)       const CIMNamespaceName & nameSpace,
        const CIMPropertyList & propertyList,
        const String & condition,
        const String & queryLanguage,
        const CIMInstance & subscription,
        const AcceptLanguages & acceptLangs,
        const ContentLanguages & contentLangs,
        const CIMRequestMessage * origRequest,
        const Array <CIMName> & indicationSubclasses,
        const String & userName,
        const String & authType)
 { {
       CIMValue propValue;
       Uint16 repeatNotificationPolicy;
   
     PEG_METHOD_ENTER (TRC_INDICATION_SERVICE,     PEG_METHOD_ENTER (TRC_INDICATION_SERVICE,
                       "IndicationService::_sendCreateRequestsCallBack");                        "IndicationService::_sendCreateRequests");
  
     IndicationService *service =      //
       static_cast<IndicationService *>(q);      //  Get repeat notification policy value from subscription instance
     struct enableProviderList *epl =      //
        reinterpret_cast<struct enableProviderList *>(parm);      propValue = subscription.getProperty
           (subscription.findProperty
           (_PROPERTY_REPEATNOTIFICATIONPOLICY)).getValue ();
       propValue.get (repeatNotificationPolicy);
  
    AsyncRequest *asyncRequest = static_cast<AsyncRequest *>(op->get_request());      CIMRequestMessage * aggRequest;
    AsyncReply *asyncReply = static_cast<AsyncReply *>(op->get_response());  
    CIMRequestMessage *request = reinterpret_cast<CIMRequestMessage *>  
       ((static_cast<AsyncLegacyOperationStart *>(asyncRequest))->get_action());  
    CIMCreateSubscriptionResponseMessage * response =  
       reinterpret_cast  
       <CIMCreateSubscriptionResponseMessage *>  
       ((static_cast <AsyncLegacyOperationResult *>  
         (asyncReply))->get_result());  
  
    PEGASUS_ASSERT(response != 0);      if (origRequest == 0)
    if (response->cimException.getCode() == CIM_ERR_SUCCESS)  
    {    {
           //
           //  Initialize -- no request associated with this create
           //
           aggRequest = 0;
    }    }
    else    else
    {    {
       //       //
       //  ATTN-CAKG-P3-20020326: Log a message          //  Create Instance, Modify Instance, or Provider Registration Change
       //       //
           switch (origRequest->getType ())
           {
               case CIM_CREATE_INSTANCE_REQUEST_MESSAGE:
               {
                   CIMCreateInstanceRequestMessage * request =
                       (CIMCreateInstanceRequestMessage *) origRequest;
                   CIMCreateInstanceRequestMessage * requestCopy =
                       new CIMCreateInstanceRequestMessage (* request);
                   aggRequest = requestCopy;
                   break;
    }    }
  
    delete epl;              case CIM_MODIFY_INSTANCE_REQUEST_MESSAGE:
    delete request;              {
    delete response;                  CIMModifyInstanceRequestMessage * request =
    delete asyncRequest;                      (CIMModifyInstanceRequestMessage *) origRequest;
    delete asyncReply;                  CIMModifyInstanceRequestMessage * requestCopy =
    op->release();                      new CIMModifyInstanceRequestMessage (* request);
    service->return_op(op);                  aggRequest = requestCopy;
                   break;
               }
   
               case CIM_NOTIFY_PROVIDER_REGISTRATION_REQUEST_MESSAGE:
               {
                   CIMNotifyProviderRegistrationRequestMessage * request =
                       (CIMNotifyProviderRegistrationRequestMessage *) origRequest;
                   CIMNotifyProviderRegistrationRequestMessage * requestCopy =
                       new CIMNotifyProviderRegistrationRequestMessage (* request);
                   aggRequest = requestCopy;
                   break;
               }
   
               default:
               {
                   PEG_TRACE_STRING (TRC_INDICATION_SERVICE, Tracer::LEVEL2,
                       "Unexpected origRequest type " +
                       String (MessageTypeToString (origRequest->getType ())) +
                       " in _sendCreateRequests");
                   break;
               }
           }
       }
   
       //
       //  Create an aggregate object for the create subscription requests
       //
       IndicationOperationAggregate * operationAggregate =
           new IndicationOperationAggregate (aggRequest, indicationSubclasses);
       operationAggregate->setNumberIssued (indicationProviders.size ());
   
       //
       //  Send Create request to each provider
       //
       for (Uint32 i = 0; i < indicationProviders.size (); i++)
       {
           struct enableProviderList * epl =
               new enableProviderList (indicationProviders [i], subscription);
   
           //
           //  Create the create subscription request
           //
   // l10n
           CIMCreateSubscriptionRequestMessage * request =
               new CIMCreateSubscriptionRequestMessage
                   (XmlWriter::getNextMessageId (),
                   nameSpace,
                   subscription,
                   epl->pcl->classList,
                   epl->pcl->provider,
                   epl->pcl->providerModule,
                   propertyList,
                   repeatNotificationPolicy,
                   condition,
                   queryLanguage,
                   QueueIdStack (_providerManager, getQueueId ()),
                   authType,
                   userName,
                   contentLangs,
                   acceptLangs);
   
           //
           //  Store a copy of the request in the operation aggregate instance
           //
           CIMCreateSubscriptionRequestMessage * requestCopy =
               new CIMCreateSubscriptionRequestMessage (* request);
           operationAggregate->appendRequest (requestCopy);
   
           AsyncOpNode * op = this->get_op ();
   
           AsyncLegacyOperationStart * async_req =
               new AsyncLegacyOperationStart
                   (get_next_xid (),
                   op,
                   _providerManager,
                   request,
                   _queueId);
   
           SendAsync
               (op,
               _providerManager,
               IndicationService::_aggregationCallBack,
               this,
               operationAggregate);
       }
  
     PEG_METHOD_EXIT ();     PEG_METHOD_EXIT ();
 } }
  
 // l10n // l10n
 Boolean IndicationService::_sendCreateRequests  void IndicationService::_sendModifyRequests
     (const Array <ProviderClassList> & indicationProviders,     (const Array <ProviderClassList> & indicationProviders,
      const CIMNamespaceName & nameSpace,      const CIMNamespaceName & nameSpace,
      const CIMPropertyList & propertyList,      const CIMPropertyList & propertyList,
Line 5296 
Line 5357 
      const CIMInstance & subscription,      const CIMInstance & subscription,
      const AcceptLanguages & acceptLangs,      const AcceptLanguages & acceptLangs,
      const ContentLanguages & contentLangs,      const ContentLanguages & contentLangs,
        const CIMRequestMessage * origRequest,
      const String & userName,      const String & userName,
      const String & authType)      const String & authType)
 { {
Line 5303 
Line 5365 
     Uint16 repeatNotificationPolicy;     Uint16 repeatNotificationPolicy;
  
     PEG_METHOD_ENTER (TRC_INDICATION_SERVICE,     PEG_METHOD_ENTER (TRC_INDICATION_SERVICE,
                       "IndicationService::_sendCreateRequests");                        "IndicationService::_sendModifyRequests");
  
     //     //
     //  Get repeat notification policy value from subscription instance     //  Get repeat notification policy value from subscription instance
Line 5313 
Line 5375 
         (_PROPERTY_REPEATNOTIFICATIONPOLICY)).getValue ();         (_PROPERTY_REPEATNOTIFICATIONPOLICY)).getValue ();
     propValue.get (repeatNotificationPolicy);     propValue.get (repeatNotificationPolicy);
  
       CIMRequestMessage * aggRequest;
   
     //     //
     //  Send Create request to each provider      //  Create an aggregate object for the modify subscription requests
       //
       if (origRequest)
       {
           //
           //  Provider Registration Change
     //     //
           if (origRequest->getType () ==
               CIM_NOTIFY_PROVIDER_REGISTRATION_REQUEST_MESSAGE)
           {
               CIMNotifyProviderRegistrationRequestMessage * request =
                   (CIMNotifyProviderRegistrationRequestMessage *) origRequest;
               CIMNotifyProviderRegistrationRequestMessage * requestCopy =
                   new CIMNotifyProviderRegistrationRequestMessage (* request);
               aggRequest = requestCopy;
           }
           else
           {
               PEG_TRACE_STRING (TRC_INDICATION_SERVICE, Tracer::LEVEL2,
                   "Unexpected origRequest type " +
                   String (MessageTypeToString (origRequest->getType ())) +
                   " in _sendModifyRequests");
           }
       }
       else
       {
           PEG_TRACE_STRING (TRC_INDICATION_SERVICE, Tracer::LEVEL2,
               "No origRequest in _sendModifyRequests");
       }
  
       Array <CIMName> indicationSubclasses;  //  empty array -- not needed
       IndicationOperationAggregate * operationAggregate =
           new IndicationOperationAggregate (aggRequest, indicationSubclasses);
       operationAggregate->setNumberIssued (indicationProviders.size ());
   
       //
       //  Send Modify request to each provider
       //
     for (Uint32 i = 0; i < indicationProviders.size (); i++)     for (Uint32 i = 0; i < indicationProviders.size (); i++)
     {     {
   
        struct enableProviderList *epl =        struct enableProviderList *epl =
            new enableProviderList(indicationProviders[i],          new enableProviderList (indicationProviders[i], subscription);
                                  subscription);  
  
 // l10n // l10n
         CIMCreateSubscriptionRequestMessage * request =          CIMModifySubscriptionRequestMessage * request =
             new CIMCreateSubscriptionRequestMessage              new CIMModifySubscriptionRequestMessage
                 (XmlWriter::getNextMessageId (),                 (XmlWriter::getNextMessageId (),
                 nameSpace,                 nameSpace,
                 subscription,                 subscription,
Line 5343 
Line 5440 
                  contentLangs,                  contentLangs,
                  acceptLangs);                  acceptLangs);
  
           //
           //  Store a copy of the request in the operation aggregate instance
           //
           CIMModifySubscriptionRequestMessage * requestCopy =
               new CIMModifySubscriptionRequestMessage (* request);
           operationAggregate->appendRequest (requestCopy);
   
         AsyncOpNode* op = this->get_op();         AsyncOpNode* op = this->get_op();
  
         AsyncLegacyOperationStart * async_req =         AsyncLegacyOperationStart * async_req =
Line 5353 
Line 5457 
                 request,                 request,
                 _queueId);                 _queueId);
  
         SendAsync(op,          SendAsync
               (op,
                   _providerManager,                   _providerManager,
                   IndicationService::_sendCreateRequestsCallBack,              IndicationService::_aggregationCallBack,
                   this,                   this,
                   (void *)epl);              operationAggregate);
       }
  
         // AsyncReply * async_reply = SendWait (async_req);      PEG_METHOD_EXIT ();
     }     }
  
   // l10n
   void IndicationService::_sendDeleteRequests
       (const Array <ProviderClassList> & indicationProviders,
        const CIMNamespaceName & nameSpace,
        const CIMInstance & subscription,
        const AcceptLanguages & acceptLangs,
        const ContentLanguages & contentLangs,
        const CIMRequestMessage * origRequest,
        const Array <CIMName> & indicationSubclasses,
        const String & userName,
        const String & authType)
   {
       PEG_METHOD_ENTER (TRC_INDICATION_SERVICE,
                         "IndicationService::_sendDeleteRequests");
   
       CIMRequestMessage * aggRequest;
   
       if (origRequest == 0)
       {
     //     //
     //  FUTURE: Should only return true if at least one provider accepted          //  Delete a referencing or expired subscription -- no request
     //  the subscription          //  associated with this delete
     //     //
     //Boolean result = (accepted > 0);          aggRequest = 0;
     Boolean result = true;      }
     return result;      else
       {
           //
           //  Delete Instance, Modify Instance, or Provider Registration Change
           //
           switch (origRequest->getType ())
           {
               case CIM_DELETE_INSTANCE_REQUEST_MESSAGE:
               {
                   CIMDeleteInstanceRequestMessage * request =
                       (CIMDeleteInstanceRequestMessage *) origRequest;
                   CIMDeleteInstanceRequestMessage * requestCopy =
                       new CIMDeleteInstanceRequestMessage (* request);
                   aggRequest = requestCopy;
                   break;
               }
  
     PEG_METHOD_EXIT ();              case CIM_MODIFY_INSTANCE_REQUEST_MESSAGE:
               {
                   CIMModifyInstanceRequestMessage * request =
                       (CIMModifyInstanceRequestMessage *) origRequest;
                   CIMModifyInstanceRequestMessage * requestCopy =
                       new CIMModifyInstanceRequestMessage (* request);
                   aggRequest = requestCopy;
                   break;
 } }
  
 void IndicationService::_sendModifyRequestsCallBack (              case CIM_NOTIFY_PROVIDER_REGISTRATION_REQUEST_MESSAGE:
     AsyncOpNode * op,  
     MessageQueue * q,  
     void * parm)  
 { {
     PEG_METHOD_ENTER (TRC_INDICATION_SERVICE,                  CIMNotifyProviderRegistrationRequestMessage * request =
                       "IndicationService::_sendModifyRequestsCallBack");                      (CIMNotifyProviderRegistrationRequestMessage *) origRequest;
                   CIMNotifyProviderRegistrationRequestMessage * requestCopy =
                       new CIMNotifyProviderRegistrationRequestMessage (* request);
                   aggRequest = requestCopy;
                   break;
               }
  
     IndicationService *service = static_cast <IndicationService *> (q);              default:
     struct enableProviderList * epl = reinterpret_cast              {
         <struct enableProviderList *> (parm);                  PEG_TRACE_STRING (TRC_INDICATION_SERVICE, Tracer::LEVEL2,
                       "Unexpected origRequest type " +
                       String (MessageTypeToString (origRequest->getType ())) +
                       " in _sendDeleteRequests");
                   break;
               }
           }
       }
  
     AsyncRequest * asyncRequest = static_cast <AsyncRequest *>      //
         (op->get_request ());      //  Create an aggregate object for the delete subscription requests
     AsyncReply * asyncReply = static_cast <AsyncReply *> (op->get_response ());      //
     CIMRequestMessage * request = reinterpret_cast <CIMRequestMessage *>      IndicationOperationAggregate * operationAggregate =
         ((static_cast <AsyncLegacyOperationStart *>          new IndicationOperationAggregate (aggRequest, indicationSubclasses);
         (asyncRequest))->get_action ());      operationAggregate->setNumberIssued (indicationProviders.size ());
  
     //     //
     //  ATTN: Check for return value indicating invalid queue ID      //  Send Delete request to each provider
     //  If received, need to find Provider Manager Service queue ID  
     //  again  
     //     //
       for (Uint32 i = 0; i < indicationProviders.size (); i++)
       {
  
     CIMModifySubscriptionResponseMessage * response = reinterpret_cast          struct enableProviderList * epl =
         <CIMModifySubscriptionResponseMessage *>              new enableProviderList (indicationProviders [i], subscription);
         ((static_cast <AsyncLegacyOperationResult *>  
         (asyncReply))->get_result ());  
  
     PEGASUS_ASSERT(response != 0);  // l10n
     if (response->cimException.getCode () == CIM_ERR_SUCCESS)          CIMDeleteSubscriptionRequestMessage * request =
               new CIMDeleteSubscriptionRequestMessage
                   (XmlWriter::getNextMessageId (),
                   nameSpace,
                   subscription,
                   epl->pcl->classList,
                   epl->pcl->provider,
                   epl->pcl->providerModule,
                   QueueIdStack (_providerManager, getQueueId ()),
                   authType,
                   userName,
                   contentLangs,
                   acceptLangs);
   
           //
           //  Store a copy of the request in the operation aggregate instance
           //
           CIMDeleteSubscriptionRequestMessage * requestCopy =
               new CIMDeleteSubscriptionRequestMessage (* request);
           operationAggregate->appendRequest (requestCopy);
   
           AsyncOpNode * op = this->get_op ();
   
           AsyncLegacyOperationStart * async_req =
               new AsyncLegacyOperationStart
                   (get_next_xid (),
                   op,
                   _providerManager,
                   request,
                   _queueId);
   
           SendAsync
               (op,
               _providerManager,
               IndicationService::_aggregationCallBack,
               this,
               operationAggregate);
       }
   
       PEG_METHOD_EXIT ();
   }
   
   void IndicationService::_aggregationCallBack (
       AsyncOpNode * op,
       MessageQueue * q,
       void * userParameter)
   {
       PEG_METHOD_ENTER (TRC_INDICATION_SERVICE,
           "IndicationService::_aggregationCallBack");
   
       IndicationService * service = static_cast <IndicationService *> (q);
   
       AsyncRequest * asyncRequest =
           static_cast <AsyncRequest *> (op->get_request ());
       AsyncReply * asyncReply = static_cast <AsyncReply *> (op->get_response ());
   
       IndicationOperationAggregate * operationAggregate =
           reinterpret_cast <IndicationOperationAggregate *> (userParameter);
       PEGASUS_ASSERT (operationAggregate != 0);
       PEGASUS_ASSERT (operationAggregate->valid ());
   
       CIMResponseMessage * response;
       Uint32 msgType = asyncReply->getType ();
       PEGASUS_ASSERT ((msgType == async_messages::ASYNC_LEGACY_OP_RESULT) ||
                       (msgType == async_messages::ASYNC_MODULE_OP_RESULT));
   
       if (msgType == async_messages::ASYNC_LEGACY_OP_RESULT)
       {
           response = reinterpret_cast <CIMResponseMessage *>
               ((static_cast <AsyncLegacyOperationResult *>
               (asyncReply))->get_result ());
       }
       else if (msgType == async_messages::ASYNC_MODULE_OP_RESULT)
       {
           response = reinterpret_cast <CIMResponseMessage *>
               ((static_cast <AsyncModuleOperationResult *>
               (asyncReply))->get_result ());
       }
   
       PEGASUS_ASSERT (response != 0);
   
       delete asyncRequest;
       delete asyncReply;
       op->release ();
       service->return_op (op);
   
       Boolean isDoneAggregation = operationAggregate->appendResponse (response);
       if (isDoneAggregation)
       {
           service->_handleOperationResponseAggregation (operationAggregate);
       }
   
       PEG_METHOD_EXIT ();
   }
   
   void IndicationService::_handleOperationResponseAggregation (
       IndicationOperationAggregate * operationAggregate)
   {
       PEG_METHOD_ENTER (TRC_INDICATION_SERVICE,
           "IndicationService::_handleOperationResponseAggregation");
   
       switch (operationAggregate->getRequest (0)->getType ())
       {
           case CIM_CREATE_SUBSCRIPTION_REQUEST_MESSAGE:
           {
               _handleCreateResponseAggregation (operationAggregate);
               break;
           }
   
           case CIM_ENABLE_INDICATIONS_REQUEST_MESSAGE:
           {
               _handleEnableResponseAggregation (operationAggregate);
               break;
           }
   
           case CIM_MODIFY_SUBSCRIPTION_REQUEST_MESSAGE:
           {
               _handleModifyResponseAggregation (operationAggregate);
               break;
           }
   
           case CIM_DELETE_SUBSCRIPTION_REQUEST_MESSAGE:
           {
               _handleDeleteResponseAggregation (operationAggregate);
               break;
           }
   
           default:
           {
               PEG_TRACE_STRING (TRC_INDICATION_SERVICE, Tracer::LEVEL2,
                   "Unexpected request type " +
                   String (MessageTypeToString
                       (operationAggregate->getRequest (0)->getType ())) +
                   " in _handleOperationResponseAggregation");
               break;
           }
       }
   
       //
       //  Requests and responses are deleted in destructor
       //
       delete operationAggregate;
   
       PEG_METHOD_EXIT ();
   }
   
   void IndicationService::_handleCreateResponseAggregation (
       IndicationOperationAggregate * operationAggregate)
   {
       PEG_METHOD_ENTER (TRC_INDICATION_SERVICE,
           "IndicationService::_handleCreateResponseAggregation");
   
       Array <ProviderClassList> enableProviders;
       CIMObjectPath instanceRef;
       CIMException cimException;
   
       //
       //  Examine provider responses
       //
       Uint32 accepted = 0;
       for (Uint32 i = 0; i < operationAggregate->getNumberResponses (); i++)
       {
           //
           //  If response is SUCCESS, provider accepted the subscription
           //  Add provider to list of providers to enable
           //
           CIMResponseMessage * response = operationAggregate->getResponse (i);
           ProviderClassList provider = operationAggregate->findProvider
               (response->messageId);
           if (response->cimException.getCode () == CIM_ERR_SUCCESS)
           {
               //
               //  Find provider from which response was sent
               //
               accepted++;
               enableProviders.append (provider);
           }
           else
           {
               PEG_TRACE_STRING (TRC_INDICATION_SERVICE, Tracer::LEVEL3,
                   "Provider (" + provider.provider.getPath().toString() +
                   ") rejected create subscription: " +
                   response->cimException.getMessage ());
           }
       }
   
       CIMCreateSubscriptionRequestMessage * request =
           (CIMCreateSubscriptionRequestMessage *)
               operationAggregate->getRequest (0);
       if (accepted == 0)
       {
           //
           //  No providers accepted this subscription
           //
           if (operationAggregate->getOrigType () == 0)
           {
               //
               //  For Initialize
               //  Implement the subscription's On Fatal Error Policy
               //  If subscription is not disabled or removed, send alert
               //
               if (!_handleError (request->subscriptionInstance))
               {
   #if 0
                   //
                   //  Send alert
                   //
                   //
                   //  Send NoProviderAlertIndication to handler instances
                   //  ATTN: NoProviderAlertIndication must be defined
                   //
                   Array <CIMInstance> subscriptions;
                   subscriptions.append (request->subscriptionInstance);
                   CIMInstance indicationInstance = _createAlertInstance
                       (_CLASS_NO_PROVIDER_ALERT, subscriptions);
   
                   Tracer::trace (TRC_INDICATION_SERVICE, Tracer::LEVEL4,
                       "Sending NoProvider Alert for %d subscriptions",
                       subscriptions.size ());
                   _sendAlerts (subscriptions, indicationInstance);
   #endif
                   //
                   //  Log a message for the subscription
                   //
                   Logger::put_l (Logger::STANDARD_LOG, System::CIMSERVER,
                       Logger::WARNING, _MSG_NO_PROVIDER_KEY, _MSG_NO_PROVIDER,
                       request->subscriptionInstance.getPath ().toString ());
               }
           }
   
           else if (operationAggregate->requiresResponse ())
           {
               //
               //  For Create Instance or Modify Instance
               //  set CIM exception for response
               //
               // l10n
               cimException = PEGASUS_CIM_EXCEPTION_L (CIM_ERR_NOT_SUPPORTED,
                   MessageLoaderParms (_MSG_NOT_ACCEPTED_KEY, _MSG_NOT_ACCEPTED));
           }
       }
   
       else
       {
           //
           //  At least one provider accepted the subscription
           //
           if (operationAggregate->getOrigType () ==
               CIM_NOTIFY_PROVIDER_REGISTRATION_REQUEST_MESSAGE)
           {
               //
               //  Provider Registration Change
               //
               CIMNotifyProviderRegistrationRequestMessage * origRequest =
                   (CIMNotifyProviderRegistrationRequestMessage *)
                       operationAggregate->getOrigRequest ();
               ProviderClassList provider;
               provider.provider = origRequest->provider;
               provider.providerModule = origRequest->providerModule;
               provider.classList.append (origRequest->className);
   
               //
               //  Update the entry in the active subscriptions hash table
               //
               String activeSubscriptionsKey = _generateActiveSubscriptionsKey
                   (request->subscriptionInstance.getPath ());
               ActiveSubscriptionsTableEntry tableValue;
               if (_lockedLookupActiveSubscriptionsEntry (activeSubscriptionsKey,
                   tableValue))
               {
                   tableValue.providers.append (provider);
                   {
                       WriteLock lock (_activeSubscriptionsTableLock);
                       _removeActiveSubscriptionsEntry (activeSubscriptionsKey);
                       _insertActiveSubscriptionsEntry (tableValue.subscription,
                           tableValue.providers);
                   }
               }
               else
               {
                   PEG_TRACE_STRING (TRC_INDICATION_SERVICE, Tracer::LEVEL2,
                       "Subscription (" + activeSubscriptionsKey +
                       ") not found in ActiveSubscriptionsTable");
                   //
                   //  The subscription may have been deleted in the mean time
                   //  If so, no further update is required
                   //
               }
           }
           else if (operationAggregate->getOrigType () ==
               CIM_CREATE_INSTANCE_REQUEST_MESSAGE)
           {
               //
               //  Create Instance -- create the instance in the repository
               //
               CIMCreateInstanceRequestMessage * origRequest =
                   (CIMCreateInstanceRequestMessage *)
                       operationAggregate->getOrigRequest ();
   
               CIMInstance instance = request->subscriptionInstance;
               try
               {
                   instanceRef = _createInstance
                       (origRequest, request->subscriptionInstance, true);
                   instanceRef.setNameSpace
                       (request->subscriptionInstance.getPath().getNameSpace());
                   instance.setPath (instanceRef);
               }
               catch (CIMException & exception)
               {
                   cimException = exception;
               }
               catch (Exception & exception)
               {
                   cimException = PEGASUS_CIM_EXCEPTION
                       (CIM_ERR_FAILED, exception.getMessage ());
               }
   
               if (cimException.getCode () == CIM_ERR_SUCCESS)
               {
                   //
                   //  Insert entries into the subscription hash tables
                   //
                   _insertToHashTables (instance,
                       enableProviders,
                       operationAggregate->getIndicationSubclasses (),
                       request->nameSpace);
   
                   //
                   //  Send Enable message to each provider that accepted
                   //  subscription
                   //
                   _sendEnable (enableProviders,
                       operationAggregate->getOrigRequest ());
               }
           }
           else //  Initialize or Modify Instance
           {
               PEGASUS_ASSERT ((operationAggregate->getOrigType () == 0) ||
                               (operationAggregate->getOrigType () ==
                                CIM_MODIFY_INSTANCE_REQUEST_MESSAGE));
   
               //
               //  Insert entries into the subscription hash tables
               //
               _insertToHashTables (request->subscriptionInstance,
                   enableProviders,
                   operationAggregate->getIndicationSubclasses (),
                   request->nameSpace);
   
               //
               //  Send Enable message to each provider that accepted subscription
               //
               _sendEnable (enableProviders,
                   operationAggregate->getOrigRequest ());
           }
       }
   
       //
       //  For Create Instance or Modify Instance, send response
       //
       if (operationAggregate->requiresResponse ())
       {
           CIMResponseMessage * response;
           if (operationAggregate->getOrigType () ==
               CIM_CREATE_INSTANCE_REQUEST_MESSAGE)
           {
               // l10n
               // Note: don't need to set Content-language in the response
               response = new CIMCreateInstanceResponseMessage (
                   operationAggregate->getOrigMessageId (),
                   cimException,
                   operationAggregate->getOrigRequest ()->queueIds.copyAndPop (),
                   instanceRef);
           }
   
           else  // CIM_MODIFY_INSTANCE_REQUEST_MESSAGE
           {
               // l10n
               // Note: don't need to set Content-language in the response
               //
               response = new CIMModifyInstanceResponseMessage (
                   operationAggregate->getOrigMessageId (),
                   cimException,
                   operationAggregate->getOrigRequest ()->queueIds.copyAndPop ());
           }
   
           //
           //  Preserve message key
           //
           response->setKey (operationAggregate->getOrigRequest ()->getKey ());
   
           //
           //  Set response destination
           //
           response->dest = operationAggregate->getOrigDest ();
   
           //
           //  Set HTTP method in response from request
           //
           response->setHttpMethod
               (operationAggregate->getOrigRequest ()->getHttpMethod ());
   
           Base::_enqueueResponse
               (operationAggregate->getOrigRequest (), response);
       }
   
       PEG_METHOD_EXIT ();
   }
   
   void IndicationService::_handleEnableResponseAggregation (
       IndicationOperationAggregate * operationAggregate)
   {
       PEG_METHOD_ENTER (TRC_INDICATION_SERVICE,
           "IndicationService::_handleEnableResponseAggregation");
   
       //
       //  Examine provider responses
       //
       for (Uint32 i = 0; i < operationAggregate->getNumberResponses (); i++)
       {
           //
           //  If response is not SUCCESS, provider rejected the enable
           //
           CIMResponseMessage * response = operationAggregate->getResponse (i);
           if (response->cimException.getCode () != CIM_ERR_SUCCESS)
           {
               //
               //  Find provider from which response was sent
               //  Log a trace message
               //
               ProviderClassList provider = operationAggregate->findProvider
                   (response->messageId);
               PEG_TRACE_STRING (TRC_INDICATION_SERVICE, Tracer::LEVEL3,
                   "Provider (" + provider.provider.getPath ().toString() +
                   ") rejected enable indications: " +
                   response->cimException.getMessage ());
           }
       }
   
       PEG_METHOD_EXIT ();
   }
   
   void IndicationService::_handleModifyResponseAggregation (
       IndicationOperationAggregate * operationAggregate)
   {
       PEG_METHOD_ENTER (TRC_INDICATION_SERVICE,
           "IndicationService::_handleModifyResponseAggregation");
   
       //
       //  Examine provider responses
       //
       for (Uint32 i = 0; i < operationAggregate->getNumberResponses (); i++)
       {
           //
           //  If response is not SUCCESS, provider rejected the modification
           //
           CIMResponseMessage * response = operationAggregate->getResponse (i);
           if (response->cimException.getCode () != CIM_ERR_SUCCESS)
           {
               //
               //  Find provider from which response was sent
               //  Log a trace message
               //
               ProviderClassList provider = operationAggregate->findProvider
                   (response->messageId);
               PEG_TRACE_STRING (TRC_INDICATION_SERVICE, Tracer::LEVEL3,
                   "Provider (" + provider.provider.getPath ().toString() +
                   ") rejected modify subscription: " +
                   response->cimException.getMessage ());
           }
       }
   
       //
       //  Update subscription hash tables
       //
       CIMModifySubscriptionRequestMessage * request =
           (CIMModifySubscriptionRequestMessage *)
               operationAggregate->getRequest (0);
   
       CIMNotifyProviderRegistrationRequestMessage * origRequest =
           (CIMNotifyProviderRegistrationRequestMessage *)
               operationAggregate->getOrigRequest ();
   
       String activeSubscriptionsKey = _generateActiveSubscriptionsKey
           (request->subscriptionInstance.getPath ());
       ActiveSubscriptionsTableEntry tableValue;
       if (_lockedLookupActiveSubscriptionsEntry (activeSubscriptionsKey,
           tableValue))
       {
           Uint32 providerIndex = _providerInList (origRequest->provider,
               tableValue);
           if (providerIndex != PEG_NOT_FOUND)
           {
               Uint32 classIndex = _classInList (origRequest->className,
                   tableValue.providers [providerIndex]);
               if (classIndex == PEG_NOT_FOUND)
               {
                   tableValue.providers [providerIndex].classList.append
                       (origRequest->className);
               }
               else //  classIndex != PEG_NOT_FOUND
               {
                   tableValue.providers [providerIndex].classList.remove
                       (classIndex);
               }
               {
               WriteLock lock(_activeSubscriptionsTableLock);
               _removeActiveSubscriptionsEntry
                   (activeSubscriptionsKey);
               _insertActiveSubscriptionsEntry
                   (tableValue.subscription, tableValue.providers);
               }
           }
           else
     {     {
               PEG_TRACE_STRING (TRC_INDICATION_SERVICE, Tracer::LEVEL2,
                   "Provider (" + origRequest->provider.getPath().toString() +
                   ") not found in list for Subscription (" +
                   activeSubscriptionsKey +
                   ") in ActiveSubscriptionsTable");
           }
     }     }
     else     else
     {     {
         //          PEG_TRACE_STRING (TRC_INDICATION_SERVICE, Tracer::LEVEL2,
         //  ATTN-CAKG-P3-20020326: Log a message              "Subscription (" + activeSubscriptionsKey +
         //  Should the table entry be updated anyway?              ") not found in ActiveSubscriptionsTable");
         //  
     }     }
  
     delete epl;      PEG_METHOD_EXIT ();
     delete request;  
     delete response;  
     delete asyncRequest;  
     delete asyncReply;  
     op->release ();  
     service->return_op (op);  
 } }
  
 // l10n  void IndicationService::_handleDeleteResponseAggregation (
 void IndicationService::_sendModifyRequests      IndicationOperationAggregate * operationAggregate)
     (const Array <ProviderClassList> & indicationProviders,  
      const CIMNamespaceName & nameSpace,  
      const CIMPropertyList & propertyList,  
      const String & condition,  
      const String & queryLanguage,  
      const CIMInstance & subscription,  
      const AcceptLanguages & acceptLangs,  
      const ContentLanguages & contentLangs,  
      const String & userName,  
      const String & authType)  
 { {
     CIMValue propValue;  
     Uint16 repeatNotificationPolicy;  
   
     PEG_METHOD_ENTER (TRC_INDICATION_SERVICE,     PEG_METHOD_ENTER (TRC_INDICATION_SERVICE,
                       "IndicationService::_sendModifyRequests");          "IndicationService::_handleDeleteResponseAggregation");
   
       CIMException cimException;
  
     //     //
     //  Get repeat notification policy value from subscription instance      //  Examine provider responses
     //     //
     propValue = subscription.getProperty      for (Uint32 i = 0; i < operationAggregate->getNumberResponses (); i++)
         (subscription.findProperty      {
         (_PROPERTY_REPEATNOTIFICATIONPOLICY)).getValue ();  
     propValue.get (repeatNotificationPolicy);  
   
     //     //
     //  Send Modify request to each provider          //  If response is not SUCCESS, provider rejected the delete
     //     //
     for (Uint32 i = 0; i < indicationProviders.size (); i++)          CIMResponseMessage * response = operationAggregate->getResponse (i);
           if (response->cimException.getCode () != CIM_ERR_SUCCESS)
     {     {
               //
        struct enableProviderList *epl =              //  Find provider from which response was sent
           new enableProviderList(indicationProviders[i],              //  Log a trace message
                                  subscription);              //
               ProviderClassList provider = operationAggregate->findProvider
 // l10n                  (response->messageId);
        CIMModifySubscriptionRequestMessage * request =              PEG_TRACE_STRING (TRC_INDICATION_SERVICE, Tracer::LEVEL3,
           new CIMModifySubscriptionRequestMessage(                  "Provider (" + provider.provider.getPath ().toString() +
              XmlWriter::getNextMessageId (),                  ") rejected delete subscription: " +
              nameSpace,                  response->cimException.getMessage ());
              subscription,  
              epl->pcl->classList,  
              epl->pcl->provider,  
              epl->pcl->providerModule,  
              propertyList,  
              repeatNotificationPolicy,  
              condition,  
              queryLanguage,  
              QueueIdStack (_providerManager, getQueueId ()),  
              authType,  
              userName,  
              contentLangs,  
              acceptLangs);  
   
         AsyncOpNode* op = this->get_op();  
   
         AsyncLegacyOperationStart * async_req =  
             new AsyncLegacyOperationStart  
                 (get_next_xid (),  
                 op,  
                 _providerManager,  
                 request,  
                 _queueId);  
   
         SendAsync(op,  
                   _providerManager,  
                   IndicationService::_sendModifyRequestsCallBack,  
                   this,  
                   (void *)epl);  
   
         // AsyncReply * async_reply = SendWait (async_req);  
     }     }
   
     PEG_METHOD_EXIT ();  
 } }
  
       //
       //  Update subscription hash tables
       //
       CIMDeleteSubscriptionRequestMessage * request =
           (CIMDeleteSubscriptionRequestMessage *)
               operationAggregate->getRequest (0);
  
 void IndicationService::_sendDeleteRequestsCallBack (      if (operationAggregate->getOrigType () ==
     AsyncOpNode * op,          CIM_NOTIFY_PROVIDER_REGISTRATION_REQUEST_MESSAGE)
     MessageQueue * q,  
     void * parm)  
 { {
     PEG_METHOD_ENTER (TRC_INDICATION_SERVICE,          CIMNotifyProviderRegistrationRequestMessage * origRequest =
                       "IndicationService::_sendDeleteRequestsCallBack");              (CIMNotifyProviderRegistrationRequestMessage *)
                   operationAggregate->getOrigRequest ();
     IndicationService * service = static_cast <IndicationService *> (q);  
     struct enableProviderList * epl =  
         reinterpret_cast <struct enableProviderList *> (parm);  
   
     AsyncRequest * asyncRequest = static_cast <AsyncRequest *>  
         (op->get_request ());  
     AsyncReply * asyncReply = static_cast <AsyncReply *> (op->get_response ());  
     CIMRequestMessage * request = reinterpret_cast <CIMRequestMessage *>  
         ((static_cast <AsyncLegacyOperationStart *>  
         (asyncRequest))->get_action ());  
   
     CIMDeleteSubscriptionResponseMessage * response =  
         reinterpret_cast <CIMDeleteSubscriptionResponseMessage *>  
         ((static_cast <AsyncLegacyOperationResult *>  
         (asyncReply))->get_result());  
  
     //     //
     //  ATTN: Check for return value indicating invalid queue ID          //  Update the entry in the active subscriptions hash table
     //  If received, need to find Provider Manager Service queue ID again  
     //     //
           String activeSubscriptionsKey = _generateActiveSubscriptionsKey
     PEGASUS_ASSERT (response != 0);              (request->subscriptionInstance.getPath ());
     if (response->cimException.getCode () == CIM_ERR_SUCCESS)          ActiveSubscriptionsTableEntry tableValue;
           if (_lockedLookupActiveSubscriptionsEntry (activeSubscriptionsKey,
               tableValue))
           {
               Uint32 providerIndex = _providerInList (origRequest->provider,
                   tableValue);
               if (providerIndex != PEG_NOT_FOUND)
     {     {
                   tableValue.providers.remove (providerIndex);
                   {
                   WriteLock lock (_activeSubscriptionsTableLock);
                   _removeActiveSubscriptionsEntry (activeSubscriptionsKey);
                   _insertActiveSubscriptionsEntry (tableValue.subscription,
                       tableValue.providers);
                   }
     }     }
     else     else
     {     {
         //                  PEG_TRACE_STRING (TRC_INDICATION_SERVICE, Tracer::LEVEL2,
         //  ATTN-CAKG-P3-20020326: Log a message                      "Provider (" + origRequest->provider.getPath().toString() +
         //  Should the table entry be removed anyway?                      ") not found in list for Subscription (" +
         //                      activeSubscriptionsKey +
                       ") in ActiveSubscriptionsTable");
     }     }
   
     delete epl;  
     delete request;  
     delete response;  
     delete asyncRequest;  
     delete asyncReply;  
     op->release ();  
     service->return_op (op);  
 } }
           else
 // l10n  
 void IndicationService::_sendDeleteRequests  
     (const Array <ProviderClassList> & indicationProviders,  
      const CIMNamespaceName & nameSpace,  
      const CIMInstance & subscription,  
      const AcceptLanguages & acceptLangs,  
      const ContentLanguages & contentLangs,  
      const String & userName,  
      const String & authType)  
 { {
     PEG_METHOD_ENTER (TRC_INDICATION_SERVICE,              PEG_TRACE_STRING (TRC_INDICATION_SERVICE, Tracer::LEVEL2,
                       "IndicationService::_sendDeleteRequests");                  "Subscription (" + activeSubscriptionsKey +
                   ") not found in ActiveSubscriptionsTable");
           }
       }
  
     //     //
     //  Send Delete request to each provider      //  Delete Instance, Modify Instance, or Delete Referencing or Expired
       //  Subscription
     //     //
     for (Uint32 i = 0; i < indicationProviders.size (); i++)      else
     {     {
           //
           //  Remove entries from the subscription hash tables
           //
           _removeFromHashTables (request->subscriptionInstance,
               operationAggregate->getIndicationSubclasses (),
               request->nameSpace);
       }
  
        struct enableProviderList *epl =      //
           new enableProviderList(indicationProviders[i],      //  For Delete Instance or Modify Instance, send response
                                  subscription);      //
       if (operationAggregate->requiresResponse ())
       {
           CIMResponseMessage * response;
           if (operationAggregate->getOrigType () ==
               CIM_DELETE_INSTANCE_REQUEST_MESSAGE)
           {
               // l10n
               // Note: don't need to set Content-language in the response
               response = new CIMDeleteInstanceResponseMessage (
                   operationAggregate->getOrigMessageId (),
                   cimException,
                   operationAggregate->getOrigRequest ()->queueIds.copyAndPop ());
           }
  
           else  // CIM_MODIFY_INSTANCE_REQUEST_MESSAGE
           {
 // l10n // l10n
         CIMDeleteSubscriptionRequestMessage * request =              // Note: don't need to set Content-language in the response
             new CIMDeleteSubscriptionRequestMessage              //
             (XmlWriter::getNextMessageId (),              response = new CIMModifyInstanceResponseMessage (
             nameSpace,                  operationAggregate->getOrigMessageId (),
             subscription,                  cimException,
              epl->pcl->classList,                  operationAggregate->getOrigRequest ()->queueIds.copyAndPop ());
              epl->pcl->provider,          }
              epl->pcl->providerModule,  
              QueueIdStack (_providerManager, getQueueId ()),  
              authType,  
              userName,  
              contentLangs,  
              acceptLangs);  
  
         AsyncOpNode* op = this->get_op();          //
           //  Preserve message key
           //
           response->setKey (operationAggregate->getOrigRequest ()->getKey ());
  
         AsyncLegacyOperationStart * async_req =          //
             new AsyncLegacyOperationStart          //  Set response destination
                 (get_next_xid (),          //
                 op,          response->dest = operationAggregate->getOrigDest ();
                 _providerManager,  
                 request,  
                 _queueId);  
  
         SendAsync(op,          //
                   _providerManager,          //  Set HTTP method in response from request
                   IndicationService::_sendDeleteRequestsCallBack,          //
                   this,          response->setHttpMethod
                   (void *)epl);              (operationAggregate->getOrigRequest ()->getHttpMethod ());
  
         // <<< Fri Apr  5 06:05:55 2002 mdd >>>          Base::_enqueueResponse
         // AsyncReply * async_reply = SendWait (async_req);              (operationAggregate->getOrigRequest (), response);
     }     }
  
     PEG_METHOD_EXIT ();     PEG_METHOD_EXIT ();
Line 5950 
Line 6575 
             //             //
             //  Entry not found in Subscription Classes table             //  Entry not found in Subscription Classes table
             //             //
               PEG_TRACE_STRING (TRC_INDICATION_SERVICE, Tracer::LEVEL2,
             //                  "Indication subclass and namespace (" + subscriptionClassesKey +
             //  ATTN-CAKG-P3-20030403: Log a message                  ") not found in SubscriptionClassesTable");
             //  
         }         }
     }     }
  
Line 6149 
Line 6773 
 } }
 #endif #endif
  
 void IndicationService::_sendEnableCallBack(AsyncOpNode *op,  void IndicationService::_sendEnable (
                                            MessageQueue *q,      const Array <ProviderClassList> & enableProviders,
                                            void *parm)      const CIMRequestMessage * origRequest)
 { {
     PEG_METHOD_ENTER (TRC_INDICATION_SERVICE,      PEG_METHOD_ENTER (TRC_INDICATION_SERVICE, "IndicationService::_sendEnable");
                       "IndicationService::_sendEnableCallBack");  
   
    IndicationService *service =  
       static_cast<IndicationService *>(q);  
   
    AsyncRequest *asyncRequest = static_cast<AsyncRequest *>(op->get_request());  
    AsyncReply *asyncReply = static_cast<AsyncReply *>(op->get_response());  
    CIMEnableIndicationsRequestMessage *request =  
       static_cast<CIMEnableIndicationsRequestMessage *>  
       ((static_cast<AsyncLegacyOperationStart *>(asyncRequest))->get_action());  
   
 //    Message *response =  
 //       ((static_cast<AsyncLegacyOperationResult *>(asyncReply))->get_result());  
  
    CIMEnableIndicationsResponseMessage * response =      CIMRequestMessage * aggRequest;
       reinterpret_cast<CIMEnableIndicationsResponseMessage *>  
       ((static_cast <AsyncLegacyOperationResult *>  
         (asyncReply))->get_result());  
  
     if (response->cimException.getCode () == CIM_ERR_SUCCESS)      if (origRequest == 0)
     {     {
           //
           //  Initialize -- no request associated with this enable
           //
           aggRequest = 0;
     }     }
     else     else
     {     {
     }  
   
    //    //
    //  ATTN: Check for return value indicating invalid queue ID          //  Create Instance, Modify Instance, or Provider Registration Change
    //  If received, need to find Provider Manager Service queue ID  
    //  again  
    //    //
           switch (origRequest->getType ())
           {
               case CIM_CREATE_INSTANCE_REQUEST_MESSAGE:
               {
                   CIMCreateInstanceRequestMessage * request =
                       (CIMCreateInstanceRequestMessage *) origRequest;
                   CIMCreateInstanceRequestMessage * requestCopy =
                       new CIMCreateInstanceRequestMessage (* request);
                   aggRequest = requestCopy;
                   break;
               }
  
    delete request;              case CIM_MODIFY_INSTANCE_REQUEST_MESSAGE:
    delete response;              {
    delete asyncRequest;                  CIMModifyInstanceRequestMessage * request =
    delete asyncReply;                      (CIMModifyInstanceRequestMessage *) origRequest;
    op->release();                  CIMModifyInstanceRequestMessage * requestCopy =
    service->return_op(op);                      new CIMModifyInstanceRequestMessage (* request);
                   aggRequest = requestCopy;
     PEG_METHOD_EXIT ();                  break;
 } }
  
               case CIM_NOTIFY_PROVIDER_REGISTRATION_REQUEST_MESSAGE:
               {
                   CIMNotifyProviderRegistrationRequestMessage * request =
                       (CIMNotifyProviderRegistrationRequestMessage *) origRequest;
                   CIMNotifyProviderRegistrationRequestMessage * requestCopy =
                       new CIMNotifyProviderRegistrationRequestMessage (* request);
                   aggRequest = requestCopy;
                   break;
               }
  
 void IndicationService::_sendEnable (              default:
     const ProviderClassList & enableProvider)  
 { {
     PEG_METHOD_ENTER (TRC_INDICATION_SERVICE, "IndicationService::_sendEnable");                  PEG_TRACE_STRING (TRC_INDICATION_SERVICE, Tracer::LEVEL2,
                       "Unexpected origRequest type " +
                       String (MessageTypeToString (origRequest->getType ())) +
                       " in _sendEnable");
                   break;
               }
           }
       }
   
       //
       //  Create an aggregate object for the enable indications requests
       //
       Array <CIMName> indicationSubclasses;  //  empty array -- not needed
       IndicationOperationAggregate * operationAggregate =
           new IndicationOperationAggregate (aggRequest, indicationSubclasses);
       operationAggregate->setNumberIssued (enableProviders.size ());
  
       //
       //  Send Enable request to each provider
       //
       for (Uint32 i = 0; i < enableProviders.size (); i++)
       {
           //
           //  Create the enable indications request
           //
     CIMEnableIndicationsRequestMessage * request =     CIMEnableIndicationsRequestMessage * request =
         new CIMEnableIndicationsRequestMessage         new CIMEnableIndicationsRequestMessage
             (XmlWriter::getNextMessageId (),             (XmlWriter::getNextMessageId (),
              enableProvider.provider,                  enableProviders [i].provider,
              enableProvider.providerModule,                  enableProviders [i].providerModule,
              QueueIdStack (_providerManager, getQueueId ()));              QueueIdStack (_providerManager, getQueueId ()));
  
           //
           //  Store a copy of the request in the operation aggregate instance
           //
           CIMEnableIndicationsRequestMessage * requestCopy =
               new CIMEnableIndicationsRequestMessage (* request);
           operationAggregate->appendRequest (requestCopy);
   
     AsyncOpNode* op = this->get_op ();     AsyncOpNode* op = this->get_op ();
  
     AsyncLegacyOperationStart * async_req =     AsyncLegacyOperationStart * async_req =
Line 6219 
Line 6876 
             request,             request,
             _queueId);             _queueId);
  
     SendAsync (op,          SendAsync
               (op,
                _providerManager,                _providerManager,
                IndicationService::_sendEnableCallBack,              IndicationService::_aggregationCallBack,
                this,                this,
                NULL);              operationAggregate);
       }
 //    AsyncReply * async_reply = SendWait (async_req);  
     // << Wed Apr 10 12:26:16 2002 mdd >>  
  
     PEG_METHOD_EXIT ();     PEG_METHOD_EXIT ();
 } }


Legend:
Removed from v.1.87  
changed lines
  Added in v.1.88

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2