(file) Return to OperationResponseHandler.h CVS log (file) (dir) Up to [Pegasus] / pegasus / src / Pegasus / ProviderManager2

  1 karl  1.8 //%2004////////////////////////////////////////////////////////////////////////
  2 schuur 1.1 //
  3 karl   1.8 // Copyright (c) 2000, 2001, 2002 BMC Software; Hewlett-Packard Development
  4            // Company, L.P.; IBM Corp.; The Open Group; Tivoli Systems.
  5            // Copyright (c) 2003 BMC Software; Hewlett-Packard Development Company, L.P.;
  6 schuur 1.1 // IBM Corp.; EMC Corporation, The Open Group.
  7 karl   1.8 // Copyright (c) 2004 BMC Software; Hewlett-Packard Development Company, L.P.;
  8            // IBM Corp.; EMC Corporation; VERITAS Software Corporation; The Open Group.
  9 schuur 1.1 //
 10            // Permission is hereby granted, free of charge, to any person obtaining a copy
 11            // of this software and associated documentation files (the "Software"), to
 12            // deal in the Software without restriction, including without limitation the
 13            // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
 14            // sell copies of the Software, and to permit persons to whom the Software is
 15            // furnished to do so, subject to the following conditions:
 16 chip   1.11 //
 17 schuur 1.1  // THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
 18             // ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED
 19             // "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
 20             // LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
 21             // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
 22             // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
 23             // ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
 24             // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 25             //
 26             //==============================================================================
 27             //
 28             // Author: Chip Vincent (cvincent@us.ibm.com)
 29             //
 30 chip   1.11 // Modified By:
 31             //      Carol Ann Krug Graves, Hewlett-Packard Company (carolann_graves@hp.com)
 32             //      Dave Rosckes (rosckes@us.ibm.com)
 33             //      Yi Zhou, Hewlett-Packard Company (yi_zhou@hp.com)
 34             //      Adrian Schuur (schuur@de.ibm.com)
 35             //      Seema Gupta (gseema@in.ibm.com) for PEP135
 36             //      Brian G. Campbell, EMC (campbell_brian@emc.com) - PEP140/phase2
 37 schuur 1.1  //
 38             //%/////////////////////////////////////////////////////////////////////////////
 39             
 40             #ifndef Pegasus_OperationResponseHandler_h
 41             #define Pegasus_OperationResponseHandler_h
 42             
 43             #include <Pegasus/Common/Config.h>
 44             #include <Pegasus/Server/Linkage.h>
 45             #include <Pegasus/Common/CIMMessage.h>
 46             #include <Pegasus/Common/MessageQueueService.h>
 47             #include <Pegasus/Common/Constants.h>
 48             #include <Pegasus/Common/ContentLanguages.h>  // l10n
 49             
 50             #include <Pegasus/Common/CIMClass.h>
 51             #include <Pegasus/Common/CIMInstance.h>
 52             #include <Pegasus/Common/CIMIndication.h>
 53             #include <Pegasus/Common/CIMValue.h>
 54             
 55 chip   1.12 #include <Pegasus/Common/OperationContext.h>
 56             #include <Pegasus/Common/OperationContextInternal.h>
 57             
 58             #include <Pegasus/Common/ObjectNormalizer.h>
 59 schuur 1.1  #include <Pegasus/Common/ResponseHandler.h>
 60             #include <Pegasus/Common/Logger.h>
 61 kumpf  1.6  #include <Pegasus/Common/XmlWriter.h>
 62 schuur 1.1  
 63             #include <Pegasus/ProviderManager2/SimpleResponseHandler.h>
 64             #include <Pegasus/ProviderManager2/Linkage.h>
 65             
 66             PEGASUS_NAMESPACE_BEGIN
 67             
 68             class PEGASUS_PPM_LINKAGE OperationResponseHandler
 69             {
 70 chip   1.11     friend class SimpleResponseHandler;
 71 brian.campbell 1.9  
 72 schuur         1.1  public:
 73 chip           1.11     OperationResponseHandler(
 74                             CIMRequestMessage * request,
 75                             CIMResponseMessage * response);
 76 schuur         1.1  
 77 brian.campbell 1.9      virtual ~OperationResponseHandler(void);
 78 chip           1.11 
 79 schuur         1.1      CIMRequestMessage * getRequest(void) const
 80                         {
 81                             return(_request);
 82                         }
 83                     
 84                         CIMResponseMessage * getResponse(void) const
 85                         {
 86                             return(_response);
 87                         }
 88                     
 89 chip           1.11     virtual void setStatus(
 90                             const Uint32 code,
 91                             const String & message = String::EMPTY)
 92 schuur         1.1      {
 93                             _response->cimException = PEGASUS_CIM_EXCEPTION(CIMStatusCode(code), message);
 94                         }
 95                     
 96 chip           1.11     virtual void setStatus(
 97                             const Uint32 code,
 98                             const ContentLanguages & langs,
 99                             const String & message = String::EMPTY)
100                         {
101                             _response->cimException =
102                                 PEGASUS_CIM_EXCEPTION_LANG(
103                                 langs,
104                                 CIMStatusCode(code),
105                                 message);
106 schuur         1.1      }
107                     
108                     protected:
109 chip           1.11     // the default for all derived handlers. Some handlers may not apply
110                         // async behavior because their callers cannot handle partial responses.
111                         virtual Boolean isAsync(void) const
112                         {
113                             return(true);
114                         }
115 brian.campbell 1.9  
116 chip           1.11     // send (deliver) asynchronously
117                         virtual void send(Boolean isComplete);
118 brian.campbell 1.9  
119 chip           1.11     // transfer any objects from handler to response. this does not clear()
120                         virtual void transfer(void)
121                         {
122                         }
123 brian.campbell 1.9  
124 chip           1.11     // validate whatever is necessary before the transfer
125                         virtual void validate(void)
126                         {
127                         }
128 brian.campbell 1.9  
129 chip           1.11     virtual String getClass(void) const
130                         {
131                             return(String("OperationResponseHandler"));
132                         }
133 brian.campbell 1.9  
134 chip           1.11     Uint32 getResponseObjectTotal(void) const
135                         {
136                             return(_responseObjectTotal);
137                         }
138 brian.campbell 1.9  
139 chip           1.11     // there can be many objects per message (or none at all - i.e complete())
140                         Uint32 getResponseMessageTotal(void) const
141                         {
142                             return(_responseMessageTotal);
143                         }
144 brian.campbell 1.9  
145 chip           1.11     Uint32 getResponseObjectThreshold(void) const
146                         {
147                             return(_responseObjectThreshold);
148                         }
149 brian.campbell 1.9  
150 schuur         1.1      CIMRequestMessage * _request;
151                         CIMResponseMessage * _response;
152                     
153 brian.campbell 1.9  private:
154 chip           1.11     Uint32 _responseObjectTotal;
155                         Uint32 _responseMessageTotal;
156                         Uint32 _responseObjectThreshold;
157                     
158 schuur         1.1  };
159                     
160 chip           1.11 class GetInstanceResponseHandler : public OperationResponseHandler, public SimpleInstanceResponseHandler
161                     {
162                     public:
163                         GetInstanceResponseHandler(
164                             CIMGetInstanceRequestMessage * request,
165                             CIMGetInstanceResponseMessage * response)
166                         : OperationResponseHandler(request, response)
167                         {
168 chip           1.12         #ifdef PEGASUS_ENABLE_OBJECT_NORMALIZATION
169                             // Attempt to get the cached class definition used to validate results of this
170                             // operation. If it does not exist, then this feature is disabled for this
171                             // operation.
172                             try
173                             {
174                                 CachedClassDefinitionContainer container =
175                                     request->operationContext.get(CachedClassDefinitionContainer::NAME);
176                     
177                                 CIMClass cimClass = container.getClass();
178                     
179                                 _normalizer =
180                                     ObjectNormalizer(
181                                         cimClass,
182                                         request->localOnly,
183                                         request->includeQualifiers,
184                                         request->includeClassOrigin);
185                             }
186                             catch(Exception &)
187                             {
188                                 // Do nothing. Container is missing, which implies normalization is disabled
189 chip           1.12             // for this operation.
190                             }
191                             #endif
192                         }
193                     
194                         virtual void deliver(const CIMInstance & cimInstance)
195                         {
196                             // If the normalizer was seeded with a class definition, the results are
197                             // normalized. Otherwise, the normalizer does nothing.
198                             deliver(_normalizer.processInstance(cimInstance));
199 chip           1.11     }
200 schuur         1.1  
201 chip           1.11     virtual String getClass(void) const
202                         {
203                             return(String("GetInstanceResponseHandler"));
204                         }
205                     
206                         virtual void transfer(void)
207                         {
208                             if(size() > 0)
209                             {
210                                 CIMGetInstanceResponseMessage & msg =
211                                     *static_cast<CIMGetInstanceResponseMessage *>(getResponse());
212                     
213                                 msg.cimInstance = getObjects()[0];
214                             }
215                         }
216                     
217                         virtual void validate(void)
218                         {
219                             if(getResponseObjectTotal() == 0)
220                             {
221                                 // error? provider claims success,
222 chip           1.11             // but did not deliver an instance.
223                                 setStatus(CIM_ERR_NOT_FOUND);
224                             }
225                         }
226 chip           1.12 
227                     private:
228                         ObjectNormalizer _normalizer;
229                     
230 schuur         1.1  };
231                     
232                     class EnumerateInstancesResponseHandler : public OperationResponseHandler, public SimpleInstanceResponseHandler
233                     {
234                     public:
235 chip           1.11     EnumerateInstancesResponseHandler(
236                             CIMEnumerateInstancesRequestMessage * request,
237                             CIMEnumerateInstancesResponseMessage * response)
238                         : OperationResponseHandler(request, response)
239                         {
240 chip           1.12         #ifdef PEGASUS_ENABLE_OBJECT_NORMALIZATION
241                             // Attempt to get the cached class definition used to validate results of this
242                             // operation. If it does not exist, then this feature is disabled for this
243                             // operation.
244                             try
245                             {
246                                 CachedClassDefinitionContainer container =
247                                     request->operationContext.get(CachedClassDefinitionContainer::NAME);
248                     
249                                 CIMClass cimClass = container.getClass();
250                     
251                                 _normalizer =
252                                     ObjectNormalizer(
253                                         cimClass,
254                                         request->localOnly,
255                                         request->includeQualifiers,
256                                         request->includeClassOrigin);
257                             }
258                             catch(Exception &)
259                             {
260                                 // Do nothing. Container is missing, which implies normalization is disabled
261 chip           1.12             // for this operation.
262                             }
263                             #endif
264                         }
265                     
266                         virtual void deliver(const CIMInstance & cimInstance)
267                         {
268                             // If the normalizer was seeded with a class definition, the results are
269                             // normalized. Otherwise, the normalizer does nothing.
270                             deliver(_normalizer.processInstance(cimInstance));
271 chip           1.11     }
272 schuur         1.1  
273 chip           1.11     virtual String getClass(void) const
274                         {
275                             return(String("EnumerateInstancesResponseHandler"));
276                         }
277                     
278                         virtual void transfer(void)
279                         {
280                             CIMEnumerateInstancesResponseMessage & msg =
281                                 *static_cast<CIMEnumerateInstancesResponseMessage *>(getResponse());
282                     
283                             msg.cimNamedInstances = getObjects();
284                         }
285 chip           1.12 
286                     private:
287                         ObjectNormalizer _normalizer;
288                     
289 schuur         1.1  };
290                     
291                     class EnumerateInstanceNamesResponseHandler : public OperationResponseHandler, public SimpleObjectPathResponseHandler
292                     {
293                     public:
294 chip           1.11     EnumerateInstanceNamesResponseHandler(
295                             CIMEnumerateInstanceNamesRequestMessage * request,
296                             CIMEnumerateInstanceNamesResponseMessage * response)
297                         : OperationResponseHandler(request, response)
298                         {
299 chip           1.12         #ifdef PEGASUS_ENABLE_OBJECT_NORMALIZATION
300                             // Attempt to get the cached class definition used to validate results of this
301                             // operation. If it does not exist, then this feature is disabled for this
302                             // operation.
303                             try
304                             {
305                                 CachedClassDefinitionContainer container =
306                                     request->operationContext.get(CachedClassDefinitionContainer::NAME);
307                     
308                                 CIMClass cimClass = container.getClass();
309                     
310                                 _normalizer =
311                                     ObjectNormalizer(
312                                         cimClass,
313                                         false,
314                                         false,
315                                         false);
316                             }
317                             catch(Exception &)
318                             {
319                                 // Do nothing. Container is missing, which implies normalization is disabled
320 chip           1.12             // for this operation.
321                             }
322                             #endif
323                         }
324                     
325                         virtual void deliver(const CIMObjectPath & cimObjectPath)
326                         {
327                             // If the normalizer was seeded with a class definition, the results are
328                             // normalized. Otherwise, the normalizer does nothing.
329                             deliver(_normalizer.processInstanceObjectPath(cimObjectPath));
330 chip           1.11     }
331                     
332                         virtual String getClass(void) const
333                         {
334                             return(String("EnumerateInstanceNamesResponseHandler"));
335                         }
336                     
337                         virtual void transfer(void)
338                         {
339                             CIMEnumerateInstanceNamesResponseMessage & msg =
340                                 *static_cast<CIMEnumerateInstanceNamesResponseMessage *>(getResponse());
341                     
342                             msg.instanceNames = getObjects();
343                         }
344 chip           1.12 
345                     private:
346                         ObjectNormalizer _normalizer;
347                     
348 schuur         1.1  };
349                     
350                     class CreateInstanceResponseHandler : public OperationResponseHandler, public SimpleObjectPathResponseHandler
351                     {
352                     public:
353 chip           1.11     CreateInstanceResponseHandler(
354                             CIMCreateInstanceRequestMessage * request,
355                             CIMCreateInstanceResponseMessage * response)
356                         : OperationResponseHandler(request, response)
357                         {
358                         }
359                     
360                         virtual String getClass(void) const
361                         {
362                             return(String("CreateInstanceResponseHandler"));
363                         }
364                     
365 brian.campbell 1.9  #if 0
366 chip           1.11     // ATTN: is it an error to not return instance name?
367                         virtual void validate(void)
368                         {
369                             if(getResponseObjectTotal() == 0)
370                             {
371                                 setStatus(CIM_ERR_NOT_FOUND);
372                             }
373                         }
374 brian.campbell 1.9  #endif
375 schuur         1.1  
376 chip           1.11     virtual void transfer(void)
377                         {
378                             if(size() > 0)
379                             {
380                                 CIMCreateInstanceResponseMessage & msg =
381                                     *static_cast<CIMCreateInstanceResponseMessage *>(getResponse());
382                     
383                                 msg.instanceName = getObjects()[0];
384                             }
385                         }
386 schuur         1.1  };
387                     
388                     class ModifyInstanceResponseHandler : public OperationResponseHandler, public SimpleResponseHandler
389                     {
390                     public:
391 chip           1.11     ModifyInstanceResponseHandler(
392                             CIMModifyInstanceRequestMessage * request,
393                             CIMModifyInstanceResponseMessage * response)
394                         : OperationResponseHandler(request, response)
395                         {
396                         }
397                     
398                         virtual String getClass(void) const
399                         {
400                             return(String("ModifyInstanceResponseHandler"));
401                         }
402                     
403 schuur         1.1  };
404                     
405                     class DeleteInstanceResponseHandler : public OperationResponseHandler, public SimpleResponseHandler
406                     {
407                     public:
408 chip           1.11     DeleteInstanceResponseHandler(
409                             CIMDeleteInstanceRequestMessage * request,
410                             CIMDeleteInstanceResponseMessage * response)
411                         : OperationResponseHandler(request, response)
412                         {
413                         }
414                     
415                         virtual String getClass(void) const
416                         {
417                             return(String("DeleteInstanceResponseHandler"));
418                         }
419                     
420 schuur         1.1  };
421                     
422                     class GetPropertyResponseHandler : public OperationResponseHandler, public SimpleValueResponseHandler
423                     {
424                     public:
425 chip           1.11     GetPropertyResponseHandler(
426                             CIMGetPropertyRequestMessage * request,
427                             CIMGetPropertyResponseMessage * response)
428                         : OperationResponseHandler(request, response)
429                         {
430                         }
431                     
432                         virtual String getClass(void) const
433                         {
434                             return(String("GetPropertyResponseHandler"));
435                         }
436 schuur         1.1  
437 chip           1.11     virtual void transfer(void)
438                         {
439                             if(size() > 0)
440                             {
441                                 CIMGetPropertyResponseMessage & msg =
442                                     *static_cast<CIMGetPropertyResponseMessage *>(getResponse());
443                     
444                                 msg.value = getObjects()[0];
445                             }
446                         }
447                     
448                         virtual void validate(void)
449                         {
450                             // error? provider claims success,
451                             // but did not deliver an instance.
452                             if(getResponseObjectTotal() == 0)
453                             {
454                                 setStatus(CIM_ERR_NOT_FOUND);
455                             }
456                         }
457 schuur         1.1  };
458                     
459                     class SetPropertyResponseHandler : public OperationResponseHandler, public SimpleResponseHandler
460                     {
461                     public:
462 chip           1.11     SetPropertyResponseHandler(
463                             CIMSetPropertyRequestMessage * request,
464                             CIMSetPropertyResponseMessage * response)
465                         : OperationResponseHandler(request, response)
466                         {
467                         }
468                     
469                         virtual String getClass(void) const
470                         {
471                             return(String("SetPropertyResponseHandler"));
472                         }
473                     
474 schuur         1.1  };
475                     
476                     class ExecQueryResponseHandler : public OperationResponseHandler, public SimpleInstance2ObjectResponseHandler
477                     {
478                     public:
479 chip           1.11     ExecQueryResponseHandler(
480                             CIMExecQueryRequestMessage * request,
481                             CIMExecQueryResponseMessage * response)
482                         : OperationResponseHandler(request, response)
483                         {
484                         }
485 schuur         1.1  
486 chip           1.11     virtual String getClass(void) const
487                         {
488                             return(String("ExecQueryResponseHandler"));
489                         }
490 schuur         1.1  
491 chip           1.11     virtual void transfer(void)
492                         {
493                             CIMExecQueryResponseMessage & msg =
494                                 *static_cast<CIMExecQueryResponseMessage *>(getResponse());
495                     
496                             msg.cimObjects = getObjects();
497                         }
498                     
499                         // this handler will not send async
500                         virtual Boolean isAsync(void) const
501                         {
502                             return(false);
503                         }
504 schuur         1.1  };
505                     
506                     class AssociatorsResponseHandler : public OperationResponseHandler, public SimpleObjectResponseHandler
507                     {
508                     public:
509 chip           1.11     AssociatorsResponseHandler(
510                             CIMAssociatorsRequestMessage * request,
511                             CIMAssociatorsResponseMessage * response)
512                         : OperationResponseHandler(request, response)
513                         {
514                         }
515                     
516                         virtual String getClass(void) const
517                         {
518                             return(String("AssociatorsResponseHandler"));
519                         }
520 schuur         1.1  
521 chip           1.11     virtual void transfer(void)
522                         {
523                             CIMAssociatorsResponseMessage & msg =
524                                 *static_cast<CIMAssociatorsResponseMessage *>(getResponse());
525                     
526                             msg.cimObjects = getObjects();
527                         }
528 schuur         1.1  };
529                     
530                     class AssociatorNamesResponseHandler : public OperationResponseHandler, public SimpleObjectPathResponseHandler
531                     {
532                     public:
533 chip           1.11     AssociatorNamesResponseHandler(
534                             CIMAssociatorNamesRequestMessage * request,
535                             CIMAssociatorNamesResponseMessage * response)
536                         : OperationResponseHandler(request, response)
537                         {
538                         }
539                     
540                         virtual String getClass(void) const
541                         {
542                             return(String("AssociatorNamesResponseHandler"));
543                         }
544                     
545                         virtual void transfer(void)
546                         {
547                             CIMAssociatorNamesResponseMessage & msg =
548                                 *static_cast<CIMAssociatorNamesResponseMessage *>(getResponse());
549                     
550                             msg.objectNames = getObjects();
551                         }
552 schuur         1.1  };
553                     
554                     class ReferencesResponseHandler : public OperationResponseHandler, public SimpleObjectResponseHandler
555                     {
556                     public:
557 chip           1.11     ReferencesResponseHandler(
558                             CIMReferencesRequestMessage * request,
559                             CIMReferencesResponseMessage * response)
560                         : OperationResponseHandler(request, response)
561                         {
562                         }
563                     
564                         virtual String getClass(void) const
565                         {
566                             return(String("ReferencesResponseHandler"));
567                         }
568                     
569                         virtual void transfer(void)
570                         {
571                             CIMReferencesResponseMessage & msg =
572                                 *static_cast<CIMReferencesResponseMessage *>(getResponse());
573                     
574                             msg.cimObjects = getObjects();
575                         }
576 schuur         1.1  };
577                     
578                     class ReferenceNamesResponseHandler : public OperationResponseHandler, public SimpleObjectPathResponseHandler
579                     {
580                     public:
581 chip           1.11     ReferenceNamesResponseHandler(
582                             CIMReferenceNamesRequestMessage * request,
583                             CIMReferenceNamesResponseMessage * response)
584                         : OperationResponseHandler(request, response)
585                         {
586                         }
587                     
588                         virtual String getClass(void) const
589                         {
590                             return(String("ReferenceNamesResponseHandler"));
591                         }
592                     
593                         virtual void transfer(void)
594                         {
595                             CIMReferenceNamesResponseMessage & msg =
596                                 *static_cast<CIMReferenceNamesResponseMessage *>(getResponse());
597                     
598                             msg.objectNames = getObjects();
599                         }
600 schuur         1.1  };
601                     
602                     class InvokeMethodResponseHandler : public OperationResponseHandler, public SimpleMethodResultResponseHandler
603                     {
604                     public:
605 chip           1.11     InvokeMethodResponseHandler(
606                             CIMInvokeMethodRequestMessage * request,
607                             CIMInvokeMethodResponseMessage * response)
608                         : OperationResponseHandler(request, response)
609                         {
610                         }
611                     
612                         virtual String getClass(void) const
613                         {
614                             return(String("InvokeMethodResponseHandler"));
615                         }
616                     
617                         virtual void transfer(void)
618                         {
619                             CIMInvokeMethodResponseMessage & msg =
620                                 *static_cast<CIMInvokeMethodResponseMessage *>(getResponse());
621 schuur         1.1  
622 chip           1.11         msg.outParameters = getParamValues();
623                     
624                             // ATTN-RK-20020903: Is it legal for the return value to be null?
625                             // if not, then the check must be done here since deliver() works off the
626                             // virtual size, which refers to out parameters!
627                             msg.retValue = getReturnValue();
628                         }
629 schuur         1.1  };
630                     
631 brian.campbell 1.9  typedef void (*PEGASUS_INDICATION_CALLBACK)(CIMProcessIndicationRequestMessage*);
632 kumpf          1.2  
633 schuur         1.1  class EnableIndicationsResponseHandler : public OperationResponseHandler, public SimpleIndicationResponseHandler
634                     {
635                     public:
636 chip           1.11     EnableIndicationsResponseHandler(
637                             CIMEnableIndicationsRequestMessage * request,
638                             CIMEnableIndicationsResponseMessage * response,
639                             CIMInstance & provider,
640                             PEGASUS_INDICATION_CALLBACK indicationCallback)
641                         : OperationResponseHandler(request, response),
642                             _request_copy(*request),
643                             _response_copy(*response),
644                             _indicationCallback(indicationCallback)
645                         {
646                             _provider = provider;
647                         }
648                     
649                         virtual String getClass(void) const
650                         {
651                             return(String("EnableIndicationsResponseHandler"));
652                         }
653                     
654                         // this handler will not send async
655                         virtual Boolean isAsync(void) const
656                         {
657 chip           1.11         return(false);
658                         }
659                     
660                         virtual void deliver(const CIMIndication & cimIndication)
661                         {
662                             OperationContext context;
663                     
664                             Array<CIMObjectPath> subscriptionInstanceNames;
665                     
666                             context.insert(SubscriptionInstanceNamesContainer(subscriptionInstanceNames));
667                     
668                             deliver(context, cimIndication);
669                         }
670                     
671                         virtual void deliver(const OperationContext & context, const CIMIndication & cimIndication)
672                         {
673                             // ATTN: temporarily convert indication to instance
674                             CIMInstance cimInstance(cimIndication);
675                     
676                             //  Get list of subscription instance names from context
677                             Array<CIMObjectPath> subscriptionInstanceNames;
678 chip           1.11 
679                             try
680                             {
681                                 SubscriptionInstanceNamesContainer container =
682                                     context.get(SubscriptionInstanceNamesContainer::NAME);
683                     
684                                 subscriptionInstanceNames = container.getInstanceNames();
685                             }
686                             catch(Exception &)
687                             {
688                                 subscriptionInstanceNames.clear();
689                             }
690                     
691                             // l10n
692                             ContentLanguages contentLangs;
693                     
694                             try
695                             {
696                                 // Get the Content-Language for this indication.  The provider
697                                 // does not have to add specify a language for the indication.
698                                 ContentLanguageListContainer langContainer =
699 chip           1.11                 context.get(ContentLanguageListContainer::NAME);
700                     
701                                 contentLangs = langContainer.getLanguages();
702                             }
703                             catch(Exception &)
704                             {
705                                 // The provider did not explicitly set a Content-Language for
706                                 // the indication.  Fall back to the lang set in this object.
707                                 contentLangs = getLanguages();
708                             }
709                             // l10n -end
710                     
711                             // create message
712                             // l10n
713                             CIMProcessIndicationRequestMessage * request =
714                                 new CIMProcessIndicationRequestMessage(
715                                 XmlWriter::getNextMessageId(),
716                                 cimInstance.getPath().getNameSpace(),
717                                 cimInstance,
718                                 subscriptionInstanceNames,
719                                 _provider,
720 chip           1.11             QueueIdStack());  // Must be filled in by the callback function
721                     
722                             request->operationContext = context;
723                     
724                             try
725                             {
726                                 request->operationContext.set(ContentLanguageListContainer(contentLangs));
727                             }
728                             catch(Exception &)
729                             {
730                                 request->operationContext.insert(ContentLanguageListContainer(contentLangs));
731                             }
732                     
733                             _indicationCallback(request);
734                         }
735                     
736                         virtual void deliver(const Array<CIMIndication> & cimIndications)
737                         {
738                             OperationContext context;
739                     
740                             deliver(context, cimIndications);
741 chip           1.11     }
742                     
743                         virtual void deliver(const OperationContext & context, const Array<CIMIndication> & cimIndications)
744                         {
745                             for(Uint32 i = 0, n = cimIndications.size(); i < n; i++)
746                             {
747                                 deliver(context, cimIndications[i]);
748                             }
749                         }
750 brian.campbell 1.9  
751                     private:
752 chip           1.11     CIMEnableIndicationsRequestMessage _request_copy;
753                         CIMEnableIndicationsResponseMessage _response_copy;
754                         PEGASUS_INDICATION_CALLBACK _indicationCallback;
755 schuur         1.1  
756 brian.campbell 1.9  };
757 schuur         1.1  
758                     PEGASUS_NAMESPACE_END
759                     
760                     #endif

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2