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

  1 schuur 1.1 //%2003////////////////////////////////////////////////////////////////////////
  2            //
  3            // 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            // IBM Corp.; EMC Corporation, The Open Group.
  7            //
  8            // Permission is hereby granted, free of charge, to any person obtaining a copy
  9            // of this software and associated documentation files (the "Software"), to
 10            // deal in the Software without restriction, including without limitation the
 11            // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
 12            // sell copies of the Software, and to permit persons to whom the Software is
 13            // furnished to do so, subject to the following conditions:
 14            // 
 15            // THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
 16            // ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED
 17            // "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
 18            // LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
 19            // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
 20            // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
 21            // ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
 22 schuur 1.1 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 23            //
 24            //==============================================================================
 25            //
 26            // Author: Chip Vincent (cvincent@us.ibm.com)
 27            //
 28            // Modified By: Roger Kumpf, Hewlett-Packard Company (roger_kumpf@hp.com)
 29            //              Dave Rosckes (rosckes@us.ibm.com)
 30            //
 31            //%/////////////////////////////////////////////////////////////////////////////
 32            
 33            #ifndef Pegasus_SimpleResponseHandler_h
 34            #define Pegasus_SimpleResponseHandler_h
 35            
 36            #include <Pegasus/Common/Config.h>
 37            #include <Pegasus/Common/ResponseHandler.h>
 38            #include <Pegasus/Common/Logger.h>
 39            
 40            #include <Pegasus/ProviderManager2/Linkage.h>
 41            
 42            PEGASUS_NAMESPACE_BEGIN
 43 schuur 1.1 
 44 kumpf  1.3 //
 45            // ValueResponseHandler (used internally to implement property operations)
 46            //
 47            class PEGASUS_PPM_LINKAGE ValueResponseHandler : virtual public ResponseHandler
 48            {
 49            public:
 50                virtual void deliver(const CIMValue & value) = 0;
 51            
 52                virtual void deliver(const Array<CIMValue> & values) = 0;
 53            };
 54            
 55            
 56            //
 57            // SimpleResponseHandler
 58            //
 59 schuur 1.1 class PEGASUS_PPM_LINKAGE SimpleResponseHandler : virtual public ResponseHandler
 60            {
 61            public:
 62                SimpleResponseHandler(void)
 63                {
 64                }
 65            
 66                virtual ~SimpleResponseHandler(void)
 67                {
 68                }
 69            
 70                virtual void processing(void)
 71                {
 72            	Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE,
 73            		    "SimpleResponseHandler: processing()");
 74                    // do nothing
 75                }
 76            
 77                virtual void complete(void)
 78                {
 79            	Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE,
 80 schuur 1.1 		    "SimpleResponseHandler: complete()");
 81            
 82                    // do nothing
 83                }
 84            
 85            // l10n
 86                ContentLanguages getLanguages(void)
 87                {
 88                    Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE,
 89                                "SimpleResponseHandler: getLanguages()");
 90            
 91                    ContentLanguages langs;
 92                    try
 93                    {
 94                        // Try to get the ContentLanguages out of the OperationContext
 95                        // in the base ResponseHandler.
 96                        OperationContext context = getContext();
 97                        ContentLanguageListContainer cntr = context.get
 98                                       (ContentLanguageListContainer::NAME);
 99                        langs = cntr.getLanguages();
100                    }
101 david.dillard 1.2         catch (const Exception &)
102 schuur        1.1         {
103                               // The content language container must not exist.
104                               // Return the empty ContentLanguages.
105                           }
106                   
107                           return langs;
108                       }
109                   };
110                   
111                   class PEGASUS_PPM_LINKAGE SimpleInstanceResponseHandler : public SimpleResponseHandler, public InstanceResponseHandler
112                   {
113                   public:
114                       SimpleInstanceResponseHandler(void)
115                       {
116                       }
117                   
118                       void processing(void) { SimpleResponseHandler::processing(); }
119                       void complete(void) { SimpleResponseHandler::complete(); }
120                   
121                       virtual void deliver(const CIMInstance & instance)
122                       {
123 schuur        1.1 	Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE,
124                   		    "SimpleResponseHandler: deliver()");
125                   
126                           _objects.append(instance);
127                       }
128                   
129                       virtual void deliver(const Array<CIMInstance> & instances)
130                       {
131                           // call deliver for each object in the array
132                           for(Uint32 i = 0, n = instances.size(); i < n; i++)
133                           {
134                               deliver(instances[i]);
135                           }
136                       }
137                   
138                       const Array<CIMInstance> getObjects(void) const
139                       {
140                           return _objects;
141                       }
142                   
143                   private:
144 schuur        1.1     Array<CIMInstance> _objects;
145                   
146                   };
147                   
148                   class PEGASUS_PPM_LINKAGE SimpleObjectPathResponseHandler : public SimpleResponseHandler, public ObjectPathResponseHandler
149                   {
150                   public:
151                       SimpleObjectPathResponseHandler(void)
152                       {
153                       }
154                   
155                       void processing(void) { SimpleResponseHandler::processing(); }
156                       void complete(void) { SimpleResponseHandler::complete(); }
157                   
158                       virtual void deliver(const CIMObjectPath & objectPath)
159                       {
160                   	Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE,
161                   		    "SimpleResponseHandler: deliver()");
162                           _objects.append(objectPath);
163                       }
164                   
165 schuur        1.1     virtual void deliver(const Array<CIMObjectPath> & objectPaths)
166                       {
167                           // call deliver for each object in the array
168                           for(Uint32 i = 0, n = objectPaths.size(); i < n; i++)
169                           {
170                               deliver(objectPaths[i]);
171                           }
172                       }
173                   
174                       const Array<CIMObjectPath> getObjects(void) const
175                       {
176                           return _objects;
177                       }
178                   
179                   private:
180                       Array<CIMObjectPath> _objects;
181                   
182                   };
183                   
184                   class PEGASUS_PPM_LINKAGE SimpleMethodResultResponseHandler : public SimpleResponseHandler, public MethodResultResponseHandler
185                   {
186 schuur        1.1 public:
187                       SimpleMethodResultResponseHandler(void)
188                       {
189                       }
190                   
191                       void processing(void) { SimpleResponseHandler::processing(); }
192                       void complete(void) { SimpleResponseHandler::complete(); }
193                   
194                       virtual void deliverParamValue(const CIMParamValue & outParamValue)
195                       {
196                           _objects.append(outParamValue);
197                       }
198                   
199                       virtual void deliverParamValue(const Array<CIMParamValue> & outParamValues)
200                       {
201                           // call deliver for each object in the array
202                           for(Uint32 i = 0, n = outParamValues.size(); i < n; i++)
203                           {
204                               deliverParamValue(outParamValues[i]);
205                           }
206                       }
207 schuur        1.1 
208                       virtual void deliver(const CIMValue & returnValue)
209                       {
210                   	Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE,
211                   		    "SimpleResponseHandler: deliver()");
212                           _returnValue = returnValue;
213                       }
214                   
215                       const Array<CIMParamValue> getParamValues(void) const
216                       {
217                           return _objects;
218                       }
219                   
220                       const CIMValue getReturnValue(void) const
221                       {
222                           return _returnValue;
223                       }
224                   
225                   private:
226                       Array<CIMParamValue> _objects;
227                   
228 schuur        1.1     CIMValue _returnValue;
229                   
230                   };
231                   
232                   class PEGASUS_PPM_LINKAGE SimpleIndicationResponseHandler : public SimpleResponseHandler, public IndicationResponseHandler
233                   {
234                   public:
235                       SimpleIndicationResponseHandler(void)
236                       {
237                       }
238                   
239                       void processing(void) { SimpleResponseHandler::processing(); }
240                       void complete(void) { SimpleResponseHandler::complete(); }
241                   
242                       virtual void deliver(const CIMIndication & indication)
243                       {
244                   	Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE,
245                   		    "SimpleResponseHandler: deliver()");
246                   
247                           _objects.append(indication);
248                       }
249 schuur        1.1 
250                       virtual void deliver(const Array<CIMIndication> & indications)
251                       {
252                           // call deliver for each object in the array
253                           for(Uint32 i = 0, n = indications.size(); i < n; i++)
254                           {
255                               deliver(indications[i]);
256                           }
257                       }
258                   
259                       virtual void deliver(
260                           const OperationContext & context,
261                           const CIMIndication & indication)
262                       {
263                   	Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE,
264                   		    "SimpleResponseHandler: deliver()");
265                   
266                           _objects.append(indication);
267                       }
268                   
269                       virtual void deliver(
270 schuur        1.1         const OperationContext & context,
271                           const Array<CIMIndication> & indications)
272                       {
273                           // call deliver for each object in the array
274                           for(Uint32 i = 0, n = indications.size(); i < n; i++)
275                           {
276                               deliver(indications[i]);
277                           }
278                       }
279                   
280                       const Array<CIMIndication> getObjects(void) const
281                       {
282                           return _objects;
283                       }
284                   
285                       CIMInstance _provider;
286                   
287                   private:
288                       Array<CIMIndication> _objects;
289                   
290                   };
291 schuur        1.1 
292                   class PEGASUS_PPM_LINKAGE SimpleObjectResponseHandler : public SimpleResponseHandler, public ObjectResponseHandler
293                   {
294                   public:
295                       SimpleObjectResponseHandler(void)
296                       {
297                       }
298                   
299                       void processing(void) { SimpleResponseHandler::processing(); }
300                       void complete(void) { SimpleResponseHandler::complete(); }
301                   
302                       virtual void deliver(const CIMObject & object)
303                       {
304                   	Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE,
305                   		    "SimpleResponseHandler: deliver()");
306                   
307                           _objects.append(object);
308                       }
309                   
310                       virtual void deliver(const Array<CIMObject> & objects)
311                       {
312 schuur        1.1         // call deliver for each object in the array
313                           for(Uint32 i = 0, n = objects.size(); i < n; i++)
314                           {
315                               deliver(objects[i]);
316                           }
317                       }
318                   
319                       const Array<CIMObject> getObjects(void) const
320                       {
321                           return _objects;
322                       }
323                   
324                   private:
325                       Array<CIMObject> _objects;
326                   
327                   };
328                   
329                   class PEGASUS_PPM_LINKAGE SimpleInstance2ObjectResponseHandler : public SimpleResponseHandler, public InstanceResponseHandler
330                   {
331                   public:
332                       SimpleInstance2ObjectResponseHandler(void)
333 schuur        1.1     {
334                       }
335                   
336                       void processing(void) { SimpleResponseHandler::processing(); }
337                       void complete(void) { SimpleResponseHandler::complete(); }
338                   
339                       virtual void deliver(const CIMInstance & object)
340                       {
341                   	Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE,
342                   		    "SimpleResponseHandler: deliver()");
343                   
344                           _objects.append(CIMObject(object));
345                       }
346                   
347                       virtual void deliver(const Array<CIMInstance> & objects)
348                       {
349                           // call deliver for each object in the array
350                           for(Uint32 i = 0, n = objects.size(); i < n; i++)
351                           {
352                               deliver(objects[i]);
353                           }
354 schuur        1.1     }
355                   
356                       const Array<CIMObject> getObjects(void) const
357                       {
358                           return _objects;
359                       }
360                   
361                   private:
362                       Array<CIMObject> _objects;
363                   
364                   };
365                   
366                   class PEGASUS_PPM_LINKAGE SimpleValueResponseHandler : public SimpleResponseHandler, public ValueResponseHandler
367                   {
368                   public:
369                       SimpleValueResponseHandler(void)
370                       {
371                       }
372                   
373                       void processing(void) { SimpleResponseHandler::processing(); }
374                       void complete(void) { SimpleResponseHandler::complete(); }
375 schuur        1.1 
376                       virtual void deliver(const CIMValue & value)
377                       {
378                   	Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE,
379                   		    "SimpleResponseHandler: deliver()");
380                   
381                           _objects.append(value);
382                       }
383                   
384                       virtual void deliver(const Array<CIMValue> & values)
385                       {
386                           // call deliver for each object in the array
387                           for(Uint32 i = 0, n = values.size(); i < n; i++)
388                           {
389                               deliver(values[i]);
390                           }
391                       }
392                   
393                       const Array<CIMValue> getObjects(void) const
394                       {
395                           return _objects;
396 schuur        1.1     }
397                   
398                   private:
399                       Array<CIMValue> _objects;
400                   
401                   };
402                   
403                   class PEGASUS_PPM_LINKAGE SimpleClassResponseHandler : public SimpleResponseHandler, public ClassResponseHandler
404                   {
405                   public:
406                       SimpleClassResponseHandler(void)
407                       {
408                       }
409                   
410                       void processing(void) { SimpleResponseHandler::processing(); }
411                       void complete(void) { SimpleResponseHandler::complete(); }
412                   
413                       virtual void deliver(const CIMClass & classObj)
414                       {
415                   	Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE,
416                   		    "SimpleResponseHandler: deliver()");
417 schuur        1.1 
418                           _objects.append(classObj);
419                       }
420                   
421                       virtual void deliver(const Array<CIMClass> & classObjs)
422                       {
423                           // call deliver for each object in the array
424                           for(Uint32 i = 0, n = classObjs.size(); i < n; i++)
425                           {
426                               deliver(classObjs[i]);
427                           }
428                       }
429                   
430                       const Array<CIMClass> getObjects(void) const
431                       {
432                           return _objects;
433                       }
434                   
435                   private:
436                       Array<CIMClass> _objects;
437                   
438 schuur        1.1 };
439                   
440                   PEGASUS_NAMESPACE_END
441                   
442                   #endif

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2