(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            class PEGASUS_PPM_LINKAGE SimpleResponseHandler : virtual public ResponseHandler
 45            {
 46            public:
 47                SimpleResponseHandler(void)
 48                {
 49                }
 50            
 51                virtual ~SimpleResponseHandler(void)
 52                {
 53                }
 54            
 55                virtual void processing(void)
 56                {
 57            	Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE,
 58            		    "SimpleResponseHandler: processing()");
 59                    // do nothing
 60                }
 61            
 62                virtual void complete(void)
 63                {
 64 schuur 1.1 	Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE,
 65            		    "SimpleResponseHandler: complete()");
 66            
 67                    // do nothing
 68                }
 69            
 70            // l10n
 71                ContentLanguages getLanguages(void)
 72                {
 73                    Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE,
 74                                "SimpleResponseHandler: getLanguages()");
 75            
 76                    ContentLanguages langs;
 77                    try
 78                    {
 79                        // Try to get the ContentLanguages out of the OperationContext
 80                        // in the base ResponseHandler.
 81                        OperationContext context = getContext();
 82                        ContentLanguageListContainer cntr = context.get
 83                                       (ContentLanguageListContainer::NAME);
 84                        langs = cntr.getLanguages();
 85 schuur 1.1         }
 86                    catch (Exception & e)
 87                    {
 88                        // The content language container must not exist.
 89                        // Return the empty ContentLanguages.
 90                    }
 91            
 92                    return langs;
 93                }
 94            };
 95            
 96            class PEGASUS_PPM_LINKAGE SimpleInstanceResponseHandler : public SimpleResponseHandler, public InstanceResponseHandler
 97            {
 98            public:
 99                SimpleInstanceResponseHandler(void)
100                {
101                }
102            
103                void processing(void) { SimpleResponseHandler::processing(); }
104                void complete(void) { SimpleResponseHandler::complete(); }
105            
106 schuur 1.1     virtual void deliver(const CIMInstance & instance)
107                {
108            	Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE,
109            		    "SimpleResponseHandler: deliver()");
110            
111                    _objects.append(instance);
112                }
113            
114                virtual void deliver(const Array<CIMInstance> & instances)
115                {
116                    // call deliver for each object in the array
117                    for(Uint32 i = 0, n = instances.size(); i < n; i++)
118                    {
119                        deliver(instances[i]);
120                    }
121                }
122            
123                const Array<CIMInstance> getObjects(void) const
124                {
125                    return _objects;
126                }
127 schuur 1.1 
128            private:
129                Array<CIMInstance> _objects;
130            
131            };
132            
133            class PEGASUS_PPM_LINKAGE SimpleObjectPathResponseHandler : public SimpleResponseHandler, public ObjectPathResponseHandler
134            {
135            public:
136                SimpleObjectPathResponseHandler(void)
137                {
138                }
139            
140                void processing(void) { SimpleResponseHandler::processing(); }
141                void complete(void) { SimpleResponseHandler::complete(); }
142            
143                virtual void deliver(const CIMObjectPath & objectPath)
144                {
145            	Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE,
146            		    "SimpleResponseHandler: deliver()");
147                    _objects.append(objectPath);
148 schuur 1.1     }
149            
150                virtual void deliver(const Array<CIMObjectPath> & objectPaths)
151                {
152                    // call deliver for each object in the array
153                    for(Uint32 i = 0, n = objectPaths.size(); i < n; i++)
154                    {
155                        deliver(objectPaths[i]);
156                    }
157                }
158            
159                const Array<CIMObjectPath> getObjects(void) const
160                {
161                    return _objects;
162                }
163            
164            private:
165                Array<CIMObjectPath> _objects;
166            
167            };
168            
169 schuur 1.1 class PEGASUS_PPM_LINKAGE SimpleMethodResultResponseHandler : public SimpleResponseHandler, public MethodResultResponseHandler
170            {
171            public:
172                SimpleMethodResultResponseHandler(void)
173                {
174                }
175            
176                void processing(void) { SimpleResponseHandler::processing(); }
177                void complete(void) { SimpleResponseHandler::complete(); }
178            
179                virtual void deliverParamValue(const CIMParamValue & outParamValue)
180                {
181                    _objects.append(outParamValue);
182                }
183            
184                virtual void deliverParamValue(const Array<CIMParamValue> & outParamValues)
185                {
186                    // call deliver for each object in the array
187                    for(Uint32 i = 0, n = outParamValues.size(); i < n; i++)
188                    {
189                        deliverParamValue(outParamValues[i]);
190 schuur 1.1         }
191                }
192            
193                virtual void deliver(const CIMValue & returnValue)
194                {
195            	Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE,
196            		    "SimpleResponseHandler: deliver()");
197                    _returnValue = returnValue;
198                }
199            
200                const Array<CIMParamValue> getParamValues(void) const
201                {
202                    return _objects;
203                }
204            
205                const CIMValue getReturnValue(void) const
206                {
207                    return _returnValue;
208                }
209            
210            private:
211 schuur 1.1     Array<CIMParamValue> _objects;
212            
213                CIMValue _returnValue;
214            
215            };
216            
217            class PEGASUS_PPM_LINKAGE SimpleIndicationResponseHandler : public SimpleResponseHandler, public IndicationResponseHandler
218            {
219            public:
220                SimpleIndicationResponseHandler(void)
221                {
222                }
223            
224                void processing(void) { SimpleResponseHandler::processing(); }
225                void complete(void) { SimpleResponseHandler::complete(); }
226            
227                virtual void deliver(const CIMIndication & indication)
228                {
229            	Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE,
230            		    "SimpleResponseHandler: deliver()");
231            
232 schuur 1.1         _objects.append(indication);
233                }
234            
235                virtual void deliver(const Array<CIMIndication> & indications)
236                {
237                    // call deliver for each object in the array
238                    for(Uint32 i = 0, n = indications.size(); i < n; i++)
239                    {
240                        deliver(indications[i]);
241                    }
242                }
243            
244                virtual void deliver(
245                    const OperationContext & context,
246                    const CIMIndication & indication)
247                {
248            	Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE,
249            		    "SimpleResponseHandler: deliver()");
250            
251                    _objects.append(indication);
252                }
253 schuur 1.1 
254                virtual void deliver(
255                    const OperationContext & context,
256                    const Array<CIMIndication> & indications)
257                {
258                    // call deliver for each object in the array
259                    for(Uint32 i = 0, n = indications.size(); i < n; i++)
260                    {
261                        deliver(indications[i]);
262                    }
263                }
264            
265                const Array<CIMIndication> getObjects(void) const
266                {
267                    return _objects;
268                }
269            
270                CIMInstance _provider;
271            
272            private:
273                Array<CIMIndication> _objects;
274 schuur 1.1 
275            };
276            
277            class PEGASUS_PPM_LINKAGE SimpleObjectResponseHandler : public SimpleResponseHandler, public ObjectResponseHandler
278            {
279            public:
280                SimpleObjectResponseHandler(void)
281                {
282                }
283            
284                void processing(void) { SimpleResponseHandler::processing(); }
285                void complete(void) { SimpleResponseHandler::complete(); }
286            
287                virtual void deliver(const CIMObject & object)
288                {
289            	Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE,
290            		    "SimpleResponseHandler: deliver()");
291            
292                    _objects.append(object);
293                }
294            
295 schuur 1.1     virtual void deliver(const Array<CIMObject> & objects)
296                {
297                    // call deliver for each object in the array
298                    for(Uint32 i = 0, n = objects.size(); i < n; i++)
299                    {
300                        deliver(objects[i]);
301                    }
302                }
303            
304                const Array<CIMObject> getObjects(void) const
305                {
306                    return _objects;
307                }
308            
309            private:
310                Array<CIMObject> _objects;
311            
312            };
313            
314            class PEGASUS_PPM_LINKAGE SimpleInstance2ObjectResponseHandler : public SimpleResponseHandler, public InstanceResponseHandler
315            {
316 schuur 1.1 public:
317                SimpleInstance2ObjectResponseHandler(void)
318                {
319                }
320            
321                void processing(void) { SimpleResponseHandler::processing(); }
322                void complete(void) { SimpleResponseHandler::complete(); }
323            
324                virtual void deliver(const CIMInstance & object)
325                {
326            	Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE,
327            		    "SimpleResponseHandler: deliver()");
328            
329                    _objects.append(CIMObject(object));
330                }
331            
332                virtual void deliver(const Array<CIMInstance> & objects)
333                {
334                    // call deliver for each object in the array
335                    for(Uint32 i = 0, n = objects.size(); i < n; i++)
336                    {
337 schuur 1.1             deliver(objects[i]);
338                    }
339                }
340            
341                const Array<CIMObject> getObjects(void) const
342                {
343                    return _objects;
344                }
345            
346            private:
347                Array<CIMObject> _objects;
348            
349            };
350            
351            class PEGASUS_PPM_LINKAGE SimpleValueResponseHandler : public SimpleResponseHandler, public ValueResponseHandler
352            {
353            public:
354                SimpleValueResponseHandler(void)
355                {
356                }
357            
358 schuur 1.1     void processing(void) { SimpleResponseHandler::processing(); }
359                void complete(void) { SimpleResponseHandler::complete(); }
360            
361                virtual void deliver(const CIMValue & value)
362                {
363            	Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE,
364            		    "SimpleResponseHandler: deliver()");
365            
366                    _objects.append(value);
367                }
368            
369                virtual void deliver(const Array<CIMValue> & values)
370                {
371                    // call deliver for each object in the array
372                    for(Uint32 i = 0, n = values.size(); i < n; i++)
373                    {
374                        deliver(values[i]);
375                    }
376                }
377            
378                const Array<CIMValue> getObjects(void) const
379 schuur 1.1     {
380                    return _objects;
381                }
382            
383            private:
384                Array<CIMValue> _objects;
385            
386            };
387            
388            class PEGASUS_PPM_LINKAGE SimpleClassResponseHandler : public SimpleResponseHandler, public ClassResponseHandler
389            {
390            public:
391                SimpleClassResponseHandler(void)
392                {
393                }
394            
395                void processing(void) { SimpleResponseHandler::processing(); }
396                void complete(void) { SimpleResponseHandler::complete(); }
397            
398                virtual void deliver(const CIMClass & classObj)
399                {
400 schuur 1.1 	Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE,
401            		    "SimpleResponseHandler: deliver()");
402            
403                    _objects.append(classObj);
404                }
405            
406                virtual void deliver(const Array<CIMClass> & classObjs)
407                {
408                    // call deliver for each object in the array
409                    for(Uint32 i = 0, n = classObjs.size(); i < n; i++)
410                    {
411                        deliver(classObjs[i]);
412                    }
413                }
414            
415                const Array<CIMClass> getObjects(void) const
416                {
417                    return _objects;
418                }
419            
420            private:
421 schuur 1.1     Array<CIMClass> _objects;
422            
423            };
424            
425            PEGASUS_NAMESPACE_END
426            
427            #endif

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2