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