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

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

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2