1 martin 1.30 //%LICENSE////////////////////////////////////////////////////////////////
|
2 martin 1.31 //
|
3 martin 1.30 // Licensed to The Open Group (TOG) under one or more contributor license
4 // agreements. Refer to the OpenPegasusNOTICE.txt file distributed with
5 // this work for additional information regarding copyright ownership.
6 // Each contributor licenses this file to you under the OpenPegasus Open
7 // Source License; you may not use this file except in compliance with the
8 // License.
|
9 martin 1.31 //
|
10 martin 1.30 // Permission is hereby granted, free of charge, to any person obtaining a
11 // copy of this software and associated documentation files (the "Software"),
12 // to deal in the Software without restriction, including without limitation
13 // the rights to use, copy, modify, merge, publish, distribute, sublicense,
14 // and/or sell copies of the Software, and to permit persons to whom the
15 // Software is furnished to do so, subject to the following conditions:
|
16 martin 1.31 //
|
17 martin 1.30 // The above copyright notice and this permission notice shall be included
18 // in all copies or substantial portions of the Software.
|
19 martin 1.31 //
|
20 martin 1.30 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
21 martin 1.31 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
22 martin 1.30 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
23 // IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
24 // CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
25 // TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
26 // SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
27 martin 1.31 //
|
28 martin 1.30 //////////////////////////////////////////////////////////////////////////
|
29 schuur 1.1 //
30 //%/////////////////////////////////////////////////////////////////////////////
31
32 #include "OperationResponseHandler.h"
|
33 a.dunfey 1.15 #include "CIMOMHandleContext.h"
|
34 chip 1.7
|
35 marek 1.25 #include <Pegasus/Common/Tracer.h>
|
36 dave.sudlik 1.24 #include <Pegasus/Common/SharedPtr.h>
|
37 a.dunfey 1.15 #include <Pegasus/Provider/CIMOMHandle.h>
|
38 venkat.puvvada 1.26 #include <Pegasus/Config/ConfigManager.h>
|
39 chip 1.7
|
40 schuur 1.1 PEGASUS_NAMESPACE_BEGIN
41
|
42 venkat.puvvada 1.26 static void _initializeNormalizer(
43 CIMOperationRequestMessage *request,
44 Boolean includeQualifiers,
45 Boolean includeClassOrigin,
46 ObjectNormalizer &normalizer)
47 {
|
48 kumpf 1.32 // Attempt to get the cached class definition, normalization is disabled
|
49 venkat.puvvada 1.26 // if it does not exist.
50 if (request->operationContext.contains(
51 CachedClassDefinitionContainer::NAME))
52 {
53 CachedClassDefinitionContainer container =
54 request->operationContext.get(
55 CachedClassDefinitionContainer::NAME);
|
56 mike 1.28 CIMClass cimClass = container.getClass().clone();
|
57 mike 1.29 container = CachedClassDefinitionContainer(cimClass);
|
58 venkat.puvvada 1.26 SharedPtr<NormalizerContext> tmpContext(new CIMOMHandleContext());
59 ObjectNormalizer tmpNormalizer(
60 cimClass,
61 includeQualifiers,
62 includeClassOrigin,
63 request->nameSpace,
64 tmpContext);
65 normalizer = tmpNormalizer;
66 }
67 }
68
|
69 chip 1.7 //
70 // OperationResponseHandler
71 //
72
73 OperationResponseHandler::OperationResponseHandler(
|
74 kumpf 1.23 CIMRequestMessage* request,
75 CIMResponseMessage* response,
|
76 kumpf 1.14 PEGASUS_RESPONSE_CHUNK_CALLBACK_T responseChunkCallback)
|
77 chip 1.7 : _request(request),
78 _response(response),
|
79 kumpf 1.14 _responseChunkCallback(responseChunkCallback),
|
80 chip 1.8 _responseObjectTotal(0),
|
81 chip 1.7 _responseMessageTotal(0),
|
82 kumpf 1.14 _responseObjectThreshold(0)
|
83 brian.campbell 1.3 {
84 #ifndef PEGASUS_RESPONSE_OBJECT_COUNT_THRESHOLD
|
85 kumpf 1.23 # define PEGASUS_RESPONSE_OBJECT_COUNT_THRESHOLD 100
|
86 brian.campbell 1.3 #elif PEGASUS_RESPONSE_OBJECT_COUNT_THRESHOLD == 0
|
87 kumpf 1.23 # undef PEGASUS_RESPONSE_OBJECT_COUNT_THRESHOLD
88 # define PEGASUS_RESPONSE_OBJECT_COUNT_THRESHOLD ~0
|
89 brian.campbell 1.3 #endif
90
|
91 kumpf 1.14 if (!request)
|
92 a.dunfey 1.4 {
93 _responseObjectThreshold = ~0;
94 }
|
95 kumpf 1.23 else
|
96 a.dunfey 1.4 {
97 _responseObjectThreshold = PEGASUS_RESPONSE_OBJECT_COUNT_THRESHOLD;
|
98 brian.campbell 1.3
99 #ifdef PEGASUS_DEBUG
|
100 kumpf 1.23 static const char* responseObjectThreshold =
101 getenv("PEGASUS_RESPONSE_OBJECT_COUNT_THRESHOLD");
|
102 chip 1.7
103 if (responseObjectThreshold)
|
104 kumpf 1.23 {
105 Uint32 i = (Uint32)atoi(responseObjectThreshold);
|
106 chip 1.7
107 if (i > 0)
108 {
109 _responseObjectThreshold = i;
110 }
|
111 kumpf 1.23 }
|
112 brian.campbell 1.3 #endif
|
113 a.dunfey 1.4 }
|
114 brian.campbell 1.3 }
115
116 OperationResponseHandler::~OperationResponseHandler()
117 {
|
118 kumpf 1.23 _request = 0;
119 _response = 0;
|
120 brian.campbell 1.3 }
121
|
122 kumpf 1.23 CIMRequestMessage* OperationResponseHandler::getRequest() const
|
123 chip 1.7 {
|
124 kumpf 1.23 return _request;
|
125 chip 1.7 }
126
|
127 kumpf 1.23 CIMResponseMessage* OperationResponseHandler::getResponse() const
|
128 chip 1.7 {
|
129 kumpf 1.23 return _response;
|
130 chip 1.7 }
131
132 void OperationResponseHandler::setStatus(
133 const Uint32 code,
|
134 kumpf 1.23 const String& message)
|
135 chip 1.7 {
|
136 kumpf 1.23 _response->cimException =
137 PEGASUS_CIM_EXCEPTION(CIMStatusCode(code), message);
|
138 chip 1.7 }
139
140 void OperationResponseHandler::setStatus(
141 const Uint32 code,
|
142 kumpf 1.23 const ContentLanguageList& langs,
143 const String& message)
|
144 chip 1.7 {
145 _response->cimException =
146 PEGASUS_CIM_EXCEPTION_LANG(
147 langs,
148 CIMStatusCode(code),
149 message);
150 }
151
|
152 mike 1.22 void OperationResponseHandler::setCIMException(
153 const CIMException& cimException)
154 {
155 // Assign the cimException argument to _response->cimException. Note that
156 // there is no need to use the PEGASUS_CIM_EXCEPTION_LANG() macro to create
|
157 kumpf 1.32 // a TraceableCIMException since both _response->cimException and
|
158 mike 1.22 // cimException are of type CIMException and the TraceableCIMException
159 // constructor has no side effects.
160 _response->cimException = cimException;
161 }
162
|
163 kumpf 1.23 Boolean OperationResponseHandler::isAsync() const
|
164 chip 1.7 {
|
165 kumpf 1.17 return _responseChunkCallback != 0;
|
166 chip 1.7 }
167
|
168 brian.campbell 1.3 // This is only called from SimpleResponseHandler.deliver() but lives in this
169 // class because all asyncronous response must have a "response" pointer
170 // to go through. Only operation classes have a response pointer
171 void OperationResponseHandler::send(Boolean isComplete)
172 {
|
173 kumpf 1.20 // It is possible to instantiate this class directly (not a derived
174 // class, which would also inherit from SimpleResponseHandler).
175 // The caller would do this only if the operation does not have any
176 // data to be returned.
177
178 SimpleResponseHandler* simpleP =
179 dynamic_cast<SimpleResponseHandler*>(this);
180 if (simpleP == 0)
181 {
182 // if there is no data to be returned, then the message should NEVER be
183 // incomplete (even on an error)
184 PEGASUS_ASSERT(isComplete);
|
185 chip 1.7 return;
|
186 kumpf 1.20 }
|
187 kumpf 1.19
|
188 kumpf 1.20 // some handlers do not send async because their callers cannot handle
189 // partial responses. If this is the case, stop here.
|
190 brian.campbell 1.3
|
191 kumpf 1.20 if (!isAsync())
192 {
193 // preserve traditional behavior
194 if (isComplete)
|
195 chip 1.7 {
|
196 kumpf 1.20 if (_response != 0)
197 {
198 _response->operationContext.set(
199 ContentLanguageListContainer(simpleP->getLanguages()));
200 }
201 transfer();
|
202 chip 1.7 }
203
204 return;
|
205 kumpf 1.20 }
|
206 brian.campbell 1.3
|
207 kumpf 1.23 SimpleResponseHandler& simple = *simpleP;
208 PEGASUS_ASSERT(_response);
209 Uint32 objectCount = simple.size();
|
210 brian.campbell 1.3
|
211 kumpf 1.23 // have not reached threshold yet
212 if ((isComplete == false) && (objectCount < _responseObjectThreshold))
|
213 chip 1.7 {
214 return;
215 }
|
216 brian.campbell 1.3
|
217 kumpf 1.23 CIMResponseMessage* response = _response;
|
218 brian.campbell 1.3
|
219 kumpf 1.23 // for complete responses, just use the one handed down from caller
220 // otherwise, create our own that the caller never sees but is
221 // utilized for async responses underneath
|
222 brian.campbell 1.3
|
223 kumpf 1.23 if (isComplete == false)
|
224 chip 1.7 {
225 _response = _request->buildResponse();
226 }
|
227 brian.campbell 1.3
|
228 kumpf 1.23 _response->setComplete(isComplete);
229 _responseObjectTotal += objectCount;
|
230 brian.campbell 1.3
|
231 kumpf 1.23 // since we are reusing response for every chunk, keep track of original
232 // count
233 _response->setIndex(_responseMessageTotal++);
234
235 // set the originally allocated response to one more than the current.
236 // The reason for doing this is proactive in case of an exception. This
237 // allows the last response to be set as it may not re-enter this code.
|
238 brian.campbell 1.3
|
239 kumpf 1.23 if (isComplete == false)
|
240 chip 1.7 {
241 response->setIndex(_responseMessageTotal);
242 }
|
243 brian.campbell 1.3
|
244 kumpf 1.23 validate();
|
245 brian.campbell 1.3
|
246 kumpf 1.23 if (_response->cimException.getCode() != CIM_ERR_SUCCESS)
|
247 chip 1.7 {
248 simple.clear();
249 }
250
|
251 marek 1.25 PEG_TRACE((
252 TRC_PROVIDERMANAGER,
253 Tracer::LEVEL4,
254 "%s::transfer",
255 (const char*) getClass().getCString()));
|
256 chip 1.7
|
257 kumpf 1.23 transfer();
258 simple.clear();
|
259 brian.campbell 1.3
|
260 kumpf 1.23 _response->operationContext.set(
261 ContentLanguageListContainer(simple.getLanguages()));
|
262 brian.campbell 1.3
|
263 kumpf 1.23 // call thru ProviderManager to get externally declared entry point
|
264 brian.campbell 1.3
|
265 kumpf 1.23 if (isComplete == false)
266 {
267 _responseChunkCallback(_request, _response);
268 }
|
269 brian.campbell 1.3
|
270 kumpf 1.23 // put caller's allocated response back in place. Note that _response
271 // is INVALID after sending because it has been deleted externally
|
272 brian.campbell 1.3
|
273 kumpf 1.23 _response = response;
|
274 brian.campbell 1.3 }
275
|
276 kumpf 1.23 void OperationResponseHandler::transfer()
|
277 chip 1.7 {
278 }
279
|
280 kumpf 1.23 void OperationResponseHandler::validate()
|
281 chip 1.7 {
282 }
283
|
284 kumpf 1.23 String OperationResponseHandler::getClass() const
|
285 chip 1.7 {
|
286 kumpf 1.23 return String("OperationResponseHandler");
|
287 chip 1.7 }
288
|
289 kumpf 1.23 Uint32 OperationResponseHandler::getResponseObjectTotal() const
|
290 chip 1.7 {
|
291 kumpf 1.23 return _responseObjectTotal;
|
292 chip 1.7 }
293
|
294 kumpf 1.23 Uint32 OperationResponseHandler::getResponseMessageTotal() const
|
295 chip 1.7 {
|
296 kumpf 1.23 return _responseMessageTotal;
|
297 chip 1.7 }
298
|
299 kumpf 1.23 Uint32 OperationResponseHandler::getResponseObjectThreshold() const
|
300 chip 1.7 {
|
301 kumpf 1.23 return _responseObjectThreshold;
|
302 chip 1.7 }
303
304 //
305 // GetInstanceResponseHandler
306 //
307
308 GetInstanceResponseHandler::GetInstanceResponseHandler(
|
309 kumpf 1.14 CIMGetInstanceRequestMessage* request,
310 CIMGetInstanceResponseMessage* response,
311 PEGASUS_RESPONSE_CHUNK_CALLBACK_T responseChunkCallback)
312 : OperationResponseHandler(request, response, responseChunkCallback)
|
313 chip 1.7 {
|
314 venkat.puvvada 1.26 _initializeNormalizer(
315 request,
|
316 a.dunfey 1.15 request->includeQualifiers,
317 request->includeClassOrigin,
|
318 venkat.puvvada 1.26 _normalizer);
|
319 chip 1.7 }
320
|
321 marek 1.33.2.3 void GetInstanceResponseHandler::deliver(const CIMInstance& cimInstance)
|
322 r.kieninger 1.33.2.2 {
323 if (cimInstance.isUninitialized())
324 {
325 MessageLoaderParms message(
326 "Common.Exception.UNINITIALIZED_OBJECT_EXCEPTION",
327 "The object is not initialized.");
328
329 throw CIMException(CIM_ERR_FAILED, message);
330 }
331
332 if (SimpleInstanceResponseHandler::size() != 0)
333 {
334 MessageLoaderParms message(
335 "Server.OperationResponseHandler.TOO_MANY_OBJECTS_DELIVERED",
336 "Too many objects delivered.");
337
338 throw CIMException(CIM_ERR_FAILED, message);
339 }
340
|
341 marek 1.33.2.3 CIMInstance localInstance(cimInstance);
|
342 r.kieninger 1.33.2.2 #ifdef PEGASUS_ENABLE_OBJECT_NORMALIZATION
343 // The normalizer expects an object path embedded in instances even
344 // though it is not required by this operation. Use the requested
345 // object path is missing from the instance.
346 if (localInstance.getPath().getKeyBindings().size() == 0)
347 {
348 // ATTN: should clone before modification
349 localInstance.setPath(static_cast<CIMGetInstanceRequestMessage*>(
350 getRequest())->instanceName);
351 }
352 #endif
|
353 marek 1.33.2.3 SimpleInstanceResponseHandler::deliver(
354 _normalizer.processInstance(localInstance));
|
355 r.kieninger 1.33.2.2 }
356
|
357 marek 1.33.2.3 void GetInstanceResponseHandler::deliver(const SCMOInstance& cimInstance)
|
358 chip 1.7 {
|
359 kumpf 1.23 if (cimInstance.isUninitialized())
|
360 chip 1.7 {
361 MessageLoaderParms message(
362 "Common.Exception.UNINITIALIZED_OBJECT_EXCEPTION",
363 "The object is not initialized.");
364
365 throw CIMException(CIM_ERR_FAILED, message);
366 }
367
|
368 kumpf 1.23 if (SimpleInstanceResponseHandler::size() != 0)
|
369 chip 1.9 {
370 MessageLoaderParms message(
371 "Server.OperationResponseHandler.TOO_MANY_OBJECTS_DELIVERED",
372 "Too many objects delivered.");
373
374 throw CIMException(CIM_ERR_FAILED, message);
375 }
376
|
377 marek 1.33.2.3 SimpleInstanceResponseHandler::deliver(cimInstance);
|
378 chip 1.7 }
379
|
380 kumpf 1.23 void GetInstanceResponseHandler::complete()
|
381 chip 1.9 {
|
382 kumpf 1.23 if (SimpleInstanceResponseHandler::size() == 0)
|
383 chip 1.9 {
384 MessageLoaderParms message(
385 "Server.OperationResponseHandler.TOO_FEW_OBJECTS_DELIVERED",
386 "Too few objects delivered.");
|
387 venkat.puvvada 1.21 // Provider claims success, no instances returned. -V see Bug #4104
388 setStatus(CIM_ERR_NOT_FOUND);
|
389 chip 1.9 throw CIMException(CIM_ERR_FAILED, message);
390 }
391
392 SimpleInstanceResponseHandler::complete();
393 }
394
|
395 kumpf 1.23 String GetInstanceResponseHandler::getClass() const
|
396 chip 1.7 {
|
397 kumpf 1.23 return String("GetInstanceResponseHandler");
|
398 chip 1.7 }
399
|
400 kumpf 1.23 void GetInstanceResponseHandler::transfer()
|
401 chip 1.7 {
|
402 kumpf 1.23 if (size() > 0)
|
403 chip 1.7 {
|
404 kumpf 1.23 CIMGetInstanceResponseMessage& msg =
405 *static_cast<CIMGetInstanceResponseMessage*>(getResponse());
|
406 marek 1.33.2.3 Array<CIMInstance> cimObjs= getObjects();
407 Array<SCMOInstance> scmoObjs= getSCMOObjects();
408 if (cimObjs.size() != 0)
409 {
410 msg.getResponseData().setInstance(cimObjs[0]);
411 }
412 else
413 {
414 msg.getResponseData().setSCMO(scmoObjs);
415 }
|
416 chip 1.7 }
417 }
418
|
419 kumpf 1.23 void GetInstanceResponseHandler::validate()
|
420 chip 1.7 {
|
421 kumpf 1.23 if (getResponseObjectTotal() == 0)
|
422 chip 1.7 {
423 // error? provider claims success,
424 // but did not deliver an instance.
425 setStatus(CIM_ERR_NOT_FOUND);
426 }
427 }
428
429 //
430 // EnumerateInstancesResponseHandler
431 //
432
433 EnumerateInstancesResponseHandler::EnumerateInstancesResponseHandler(
|
434 kumpf 1.14 CIMEnumerateInstancesRequestMessage* request,
435 CIMEnumerateInstancesResponseMessage* response,
436 PEGASUS_RESPONSE_CHUNK_CALLBACK_T responseChunkCallback)
437 : OperationResponseHandler(request, response, responseChunkCallback)
|
438 chip 1.7 {
|
439 venkat.puvvada 1.26 _initializeNormalizer(
440 request,
|
441 a.dunfey 1.15 request->includeQualifiers,
442 request->includeClassOrigin,
|
443 venkat.puvvada 1.26 _normalizer);
|
444 chip 1.7 }
445
|
446 kumpf 1.23 void EnumerateInstancesResponseHandler::deliver(const CIMInstance& cimInstance)
|
447 chip 1.7 {
|
448 kumpf 1.23 if (cimInstance.isUninitialized())
|
449 chip 1.7 {
450 MessageLoaderParms message(
451 "Common.Exception.UNINITIALIZED_OBJECT_EXCEPTION",
452 "The object is not initialized.");
453
454 throw CIMException(CIM_ERR_FAILED, message);
455 }
456
|
457 kumpf 1.23 SimpleInstanceResponseHandler::deliver(
458 _normalizer.processInstance(cimInstance));
|
459 chip 1.7 }
460
|
461 marek 1.33.2.3 void EnumerateInstancesResponseHandler::deliver(
462 const SCMOInstance& scmoInstance)
|
463 r.kieninger 1.33.2.1 {
|
464 marek 1.33.2.3 if (scmoInstance.isUninitialized())
|
465 r.kieninger 1.33.2.1 {
466 MessageLoaderParms message(
467 "Common.Exception.UNINITIALIZED_OBJECT_EXCEPTION",
468 "The object is not initialized.");
469
470 throw CIMException(CIM_ERR_FAILED, message);
|
471 r.kieninger 1.33.2.2 }
|
472 marek 1.33.2.3 SimpleInstanceResponseHandler::deliver(scmoInstance);
|
473 r.kieninger 1.33.2.1 }
474
|
475 kumpf 1.23 String EnumerateInstancesResponseHandler::getClass() const
|
476 chip 1.7 {
|
477 kumpf 1.23 return String("EnumerateInstancesResponseHandler");
|
478 chip 1.7 }
479
|
480 kumpf 1.23 void EnumerateInstancesResponseHandler::transfer()
|
481 chip 1.7 {
|
482 kumpf 1.23 CIMEnumerateInstancesResponseMessage& msg =
483 *static_cast<CIMEnumerateInstancesResponseMessage*>(getResponse());
|
484 chip 1.7
|
485 marek 1.33.2.3 Array<CIMInstance> cimObjs= getObjects();
486 Array<SCMOInstance> scmoObjs= getSCMOObjects();
487 if (cimObjs.size() != 0)
488 {
489 msg.getResponseData().setInstances(cimObjs);
490 }
491 if (scmoObjs.size() != 0)
492 {
493 msg.getResponseData().setSCMO(scmoObjs);
494 }
|
495 chip 1.7 }
496
497 //
498 // EnumerateInstanceNamesResponseHandler
499 //
500
501 EnumerateInstanceNamesResponseHandler::EnumerateInstanceNamesResponseHandler(
|
502 kumpf 1.14 CIMEnumerateInstanceNamesRequestMessage* request,
503 CIMEnumerateInstanceNamesResponseMessage* response,
504 PEGASUS_RESPONSE_CHUNK_CALLBACK_T responseChunkCallback)
505 : OperationResponseHandler(request, response, responseChunkCallback)
|
506 chip 1.7 {
|
507 venkat.puvvada 1.26 _initializeNormalizer(
508 request,
|
509 a.dunfey 1.15 false,
510 false,
|
511 venkat.puvvada 1.26 _normalizer);
|
512 chip 1.7 }
513
|
514 kumpf 1.23 void EnumerateInstanceNamesResponseHandler::deliver(
515 const CIMObjectPath& cimObjectPath)
|
516 chip 1.7 {
|
517 kumpf 1.23 if (cimObjectPath.getClassName().isNull())
|
518 chip 1.7 {
519 MessageLoaderParms message(
520 "Common.Exception.UNINITIALIZED_OBJECT_EXCEPTION",
521 "The object is not initialized.");
522
523 throw CIMException(CIM_ERR_FAILED, message);
524 }
525
|
526 kumpf 1.23 SimpleObjectPathResponseHandler::deliver(
527 _normalizer.processInstanceObjectPath(cimObjectPath));
|
528 chip 1.7 }
529
|
530 r.kieninger 1.33.2.1 void EnumerateInstanceNamesResponseHandler::deliver(
531 const SCMOInstance& scmoObjectPath)
532 {
533 if (scmoObjectPath.getClassName()==NULL)
534 {
535 MessageLoaderParms message(
536 "Common.Exception.UNINITIALIZED_OBJECT_EXCEPTION",
537 "The object is not initialized.");
538
539 throw CIMException(CIM_ERR_FAILED, message);
540 }
541
542 SimpleObjectPathResponseHandler::deliver(scmoObjectPath);
543 }
544
|
545 kumpf 1.23 String EnumerateInstanceNamesResponseHandler::getClass() const
|
546 chip 1.7 {
|
547 kumpf 1.23 return String("EnumerateInstanceNamesResponseHandler");
|
548 chip 1.7 }
549
|
550 kumpf 1.23 void EnumerateInstanceNamesResponseHandler::transfer()
|
551 chip 1.7 {
|
552 kumpf 1.23 CIMEnumerateInstanceNamesResponseMessage& msg =
553 *static_cast<CIMEnumerateInstanceNamesResponseMessage*>(getResponse());
|
554 chip 1.7
|
555 marek 1.33.2.3 Array<CIMObjectPath> cimObjs= getObjects();
556 Array<SCMOInstance> scmoObjs= getSCMOObjects();
557 if (cimObjs.size() != 0)
558 {
559 msg.getResponseData().setInstanceNames(cimObjs);
560 }
561 if (scmoObjs.size() != 0)
562 {
563 msg.getResponseData().setSCMO(scmoObjs);
564 }
|
565 chip 1.7 }
566
567 //
568 // CreateInstanceResponseHandler
569 //
570
571 CreateInstanceResponseHandler::CreateInstanceResponseHandler(
|
572 kumpf 1.14 CIMCreateInstanceRequestMessage* request,
573 CIMCreateInstanceResponseMessage* response,
574 PEGASUS_RESPONSE_CHUNK_CALLBACK_T responseChunkCallback)
575 : OperationResponseHandler(request, response, responseChunkCallback)
|
576 chip 1.7 {
577 }
578
|
579 kumpf 1.23 void CreateInstanceResponseHandler::deliver(const CIMObjectPath& cimObjectPath)
|
580 chip 1.7 {
|
581 kumpf 1.23 if (cimObjectPath.getClassName().isNull())
|
582 chip 1.7 {
583 MessageLoaderParms message(
584 "Common.Exception.UNINITIALIZED_OBJECT_EXCEPTION",
585 "The object is not initialized.");
586
587 throw CIMException(CIM_ERR_FAILED, message);
588 }
589
|
590 kumpf 1.23 if (SimpleObjectPathResponseHandler::size() != 0)
|
591 chip 1.11 {
592 MessageLoaderParms message(
593 "Server.OperationResponseHandler.TOO_MANY_OBJECTS_DELIVERED",
594 "Too many objects delivered.");
595
596 throw CIMException(CIM_ERR_FAILED, message);
597 }
598
|
599 chip 1.7 SimpleObjectPathResponseHandler::deliver(cimObjectPath);
600 }
601
|
602 kumpf 1.23 void CreateInstanceResponseHandler::complete()
|
603 chip 1.9 {
|
604 kumpf 1.23 if (SimpleObjectPathResponseHandler::size() == 0)
|
605 chip 1.9 {
606 MessageLoaderParms message(
607 "Server.OperationResponseHandler.TOO_FEW_OBJECTS_DELIVERED",
608 "Too few objects delivered.");
609
610 throw CIMException(CIM_ERR_FAILED, message);
611 }
612
613 SimpleObjectPathResponseHandler::complete();
614 }
615
|
616 kumpf 1.23 String CreateInstanceResponseHandler::getClass() const
|
617 chip 1.7 {
|
618 kumpf 1.23 return String("CreateInstanceResponseHandler");
|
619 chip 1.7 }
620
621 #if 0
622 // ATTN: is it an error to not return instance name?
|
623 kumpf 1.23 void CreateInstanceResponseHandler::validate()
|
624 chip 1.7 {
|
625 kumpf 1.23 if (getResponseObjectTotal() == 0)
|
626 chip 1.7 {
627 setStatus(CIM_ERR_NOT_FOUND);
628 }
629 }
630 #endif
631
|
632 kumpf 1.23 void CreateInstanceResponseHandler::transfer()
|
633 chip 1.7 {
|
634 kumpf 1.23 if (size() > 0)
|
635 chip 1.7 {
|
636 kumpf 1.23 CIMCreateInstanceResponseMessage& msg =
637 *static_cast<CIMCreateInstanceResponseMessage*>(getResponse());
|
638 chip 1.7
|
639 r.kieninger 1.33.2.4 Array<CIMObjectPath> cimObjs= getObjects();
640 Array<SCMOInstance> scmoObjs= getSCMOObjects();
641 if (cimObjs.size() != 0)
642 {
643 msg.instanceName = cimObjs[0];
644 }
645 else
646 {
647 fprintf(stderr,"TBD: Scaffold code for "
648 "CreateInstanceResponseHandler::transfer()\n");
649 scmoObjs[0].getCIMObjectPath(msg.instanceName);
650 }
|
651 chip 1.7 }
652 }
653
654 //
655 // ModifyInstanceResponseHandler
656 //
657
658 ModifyInstanceResponseHandler::ModifyInstanceResponseHandler(
|
659 kumpf 1.14 CIMModifyInstanceRequestMessage* request,
660 CIMModifyInstanceResponseMessage* response,
661 PEGASUS_RESPONSE_CHUNK_CALLBACK_T responseChunkCallback)
662 : OperationResponseHandler(request, response, responseChunkCallback)
|
663 chip 1.7 {
664 }
665
|
666 kumpf 1.23 String ModifyInstanceResponseHandler::getClass() const
|
667 chip 1.7 {
|
668 kumpf 1.23 return String("ModifyInstanceResponseHandler");
|
669 chip 1.7 }
670
671 //
672 // DeleteInstanceResponseHandler
673 //
674
675 DeleteInstanceResponseHandler::DeleteInstanceResponseHandler(
|
676 kumpf 1.14 CIMDeleteInstanceRequestMessage* request,
677 CIMDeleteInstanceResponseMessage* response,
678 PEGASUS_RESPONSE_CHUNK_CALLBACK_T responseChunkCallback)
679 : OperationResponseHandler(request, response, responseChunkCallback)
|
680 chip 1.7 {
681 }
682
|
683 kumpf 1.23 String DeleteInstanceResponseHandler::getClass() const
|
684 chip 1.7 {
|
685 kumpf 1.23 return String("DeleteInstanceResponseHandler");
|
686 chip 1.7 }
687
688 //
689 // GetPropertyResponseHandler
690 //
691
692 GetPropertyResponseHandler::GetPropertyResponseHandler(
|
693 kumpf 1.14 CIMGetPropertyRequestMessage* request,
694 CIMGetPropertyResponseMessage* response,
695 PEGASUS_RESPONSE_CHUNK_CALLBACK_T responseChunkCallback)
696 : OperationResponseHandler(request, response, responseChunkCallback)
|
697 chip 1.7 {
698 }
699
|
700 kumpf 1.23 void GetPropertyResponseHandler::deliver(const CIMValue& cimValue)
|
701 chip 1.7 {
|
702 kumpf 1.23 if (cimValue.isNull())
|
703 chip 1.7 {
704 MessageLoaderParms message(
705 "Common.Exception.UNINITIALIZED_OBJECT_EXCEPTION",
706 "The object is not initialized.");
707
708 throw CIMException(CIM_ERR_FAILED, message);
709 }
710
711 SimpleValueResponseHandler::deliver(cimValue);
712 }
713
|
714 kumpf 1.23 String GetPropertyResponseHandler::getClass() const
|
715 chip 1.7 {
|
716 kumpf 1.23 return String("GetPropertyResponseHandler");
|
717 chip 1.7 }
718
|
719 kumpf 1.23 void GetPropertyResponseHandler::transfer()
|
720 chip 1.7 {
|
721 kumpf 1.23 if (size() > 0)
|
722 chip 1.7 {
|
723 kumpf 1.23 CIMGetPropertyResponseMessage& msg =
724 *static_cast<CIMGetPropertyResponseMessage*>(getResponse());
|
725 chip 1.7
726 msg.value = getObjects()[0];
727 }
728 }
729
|
730 kumpf 1.23 void GetPropertyResponseHandler::validate()
|
731 chip 1.7 {
732 // error? provider claims success,
733 // but did not deliver an instance.
|
734 kumpf 1.23 if (getResponseObjectTotal() == 0)
|
735 chip 1.7 {
736 setStatus(CIM_ERR_NOT_FOUND);
737 }
738 }
739
740 //
741 // SetPropertyResponseHandler
742 //
743
744 SetPropertyResponseHandler::SetPropertyResponseHandler(
|
745 kumpf 1.14 CIMSetPropertyRequestMessage* request,
746 CIMSetPropertyResponseMessage* response,
747 PEGASUS_RESPONSE_CHUNK_CALLBACK_T responseChunkCallback)
748 : OperationResponseHandler(request, response, responseChunkCallback)
|
749 chip 1.7 {
750 }
751
|
752 kumpf 1.23 String SetPropertyResponseHandler::getClass() const
|
753 chip 1.7 {
|
754 kumpf 1.23 return String("SetPropertyResponseHandler");
|
755 chip 1.7 }
756
757 //
758 // ExecQueryResponseHandler
759 //
760
761 ExecQueryResponseHandler::ExecQueryResponseHandler(
|
762 kumpf 1.14 CIMExecQueryRequestMessage* request,
763 CIMExecQueryResponseMessage* response,
764 PEGASUS_RESPONSE_CHUNK_CALLBACK_T responseChunkCallback)
765 : OperationResponseHandler(request, response, responseChunkCallback)
|
766 chip 1.7 {
767 }
768
|
769 kumpf 1.23 void ExecQueryResponseHandler::deliver(const CIMInstance& cimInstance)
|
770 chip 1.7 {
|
771 kumpf 1.23 if (cimInstance.isUninitialized())
|
772 chip 1.7 {
773 MessageLoaderParms message(
774 "Common.Exception.UNINITIALIZED_OBJECT_EXCEPTION",
775 "The object is not initialized.");
776
777 throw CIMException(CIM_ERR_FAILED, message);
778 }
779
780 SimpleInstance2ObjectResponseHandler::deliver(cimInstance);
781 }
782
|
783 marek 1.33.2.3 void ExecQueryResponseHandler::deliver(const SCMOInstance& scmoInstance)
|
784 r.kieninger 1.33.2.1 {
|
785 marek 1.33.2.3 if (scmoInstance.isUninitialized())
|
786 r.kieninger 1.33.2.1 {
787 MessageLoaderParms message(
788 "Common.Exception.UNINITIALIZED_OBJECT_EXCEPTION",
789 "The object is not initialized.");
790
791 throw CIMException(CIM_ERR_FAILED, message);
|
792 r.kieninger 1.33.2.2 }
|
793 r.kieninger 1.33.2.1
|
794 marek 1.33.2.3 SimpleInstance2ObjectResponseHandler::deliver(scmoInstance);
|
795 r.kieninger 1.33.2.1 }
796
|
797 kumpf 1.23 String ExecQueryResponseHandler::getClass() const
|
798 chip 1.7 {
|
799 kumpf 1.23 return String("ExecQueryResponseHandler");
|
800 chip 1.7 }
801
|
802 kumpf 1.23 void ExecQueryResponseHandler::transfer()
|
803 chip 1.7 {
|
804 kumpf 1.23 CIMExecQueryResponseMessage& msg =
805 *static_cast<CIMExecQueryResponseMessage*>(getResponse());
|
806 chip 1.7
|
807 marek 1.33.2.3 Array<CIMObject> cimObjs= getObjects();
808 Array<SCMOInstance> scmoObjs= getSCMOObjects();
809 if (cimObjs.size() != 0)
810 {
811 msg.getResponseData().setObjects(cimObjs);
812 }
813 if (scmoObjs.size() != 0)
814 {
815 msg.getResponseData().setSCMO(scmoObjs);
816 }
|
817 chip 1.7 }
818
|
819 kumpf 1.23 Boolean ExecQueryResponseHandler::isAsync() const
|
820 chip 1.7 {
|
821 kumpf 1.23 return false;
|
822 chip 1.7 }
823
824 //
825 // AssociatorsResponseHandler
826 //
827
828 AssociatorsResponseHandler::AssociatorsResponseHandler(
|
829 kumpf 1.14 CIMAssociatorsRequestMessage* request,
830 CIMAssociatorsResponseMessage* response,
831 PEGASUS_RESPONSE_CHUNK_CALLBACK_T responseChunkCallback)
832 : OperationResponseHandler(request, response, responseChunkCallback)
|
833 chip 1.7 {
834 }
835
|
836 kumpf 1.23 void AssociatorsResponseHandler::deliver(const CIMObject& cimObject)
|
837 chip 1.7 {
|
838 kumpf 1.23 if (cimObject.isUninitialized())
|
839 chip 1.7 {
840 MessageLoaderParms message(
841 "Common.Exception.UNINITIALIZED_OBJECT_EXCEPTION",
842 "The object is not initialized.");
843
844 throw CIMException(CIM_ERR_FAILED, message);
845 }
846
847 SimpleObjectResponseHandler::deliver(cimObject);
848 }
849
|
850 thilo.boehm 1.33.2.5 void AssociatorsResponseHandler::deliver(const CIMInstance& cimInstance)
851 {
852 if (cimInstance.isUninitialized())
853 {
854 MessageLoaderParms message(
855 "Common.Exception.UNINITIALIZED_OBJECT_EXCEPTION",
856 "The object is not initialized.");
857
858 throw CIMException(CIM_ERR_FAILED, message);
859 }
860
861 SimpleObjectResponseHandler::deliver(cimInstance);
862 }
863
|
864 marek 1.33.2.3 void AssociatorsResponseHandler::deliver(const SCMOInstance& scmoObject)
|
865 r.kieninger 1.33.2.2 {
|
866 marek 1.33.2.3 if (scmoObject.isUninitialized())
|
867 r.kieninger 1.33.2.2 {
868 MessageLoaderParms message(
869 "Common.Exception.UNINITIALIZED_OBJECT_EXCEPTION",
870 "The object is not initialized.");
871
872 throw CIMException(CIM_ERR_FAILED, message);
873 }
|
874 marek 1.33.2.3 SimpleObjectResponseHandler::deliver(scmoObject);
|
875 r.kieninger 1.33.2.2 }
876
|
877 kumpf 1.23 String AssociatorsResponseHandler::getClass() const
|
878 chip 1.7 {
|
879 kumpf 1.23 return String("AssociatorsResponseHandler");
|
880 chip 1.7 }
881
|
882 kumpf 1.23 void AssociatorsResponseHandler::transfer()
|
883 chip 1.7 {
|
884 kumpf 1.23 CIMAssociatorsResponseMessage& msg =
885 *static_cast<CIMAssociatorsResponseMessage*>(getResponse());
|
886 chip 1.7
|
887 marek 1.33.2.3 Array<CIMObject> cimObjs= getObjects();
888 Array<SCMOInstance> scmoObjs= getSCMOObjects();
889 if (cimObjs.size() != 0)
890 {
891 msg.getResponseData().setObjects(cimObjs);
892 }
893 if (scmoObjs.size() != 0)
894 {
895 msg.getResponseData().setSCMO(scmoObjs);
896 }
|
897 chip 1.7 }
898
899 //
900 // AssociatorNamesResponseHandler
901 //
902
903 AssociatorNamesResponseHandler::AssociatorNamesResponseHandler(
|
904 kumpf 1.14 CIMAssociatorNamesRequestMessage* request,
905 CIMAssociatorNamesResponseMessage* response,
906 PEGASUS_RESPONSE_CHUNK_CALLBACK_T responseChunkCallback)
907 : OperationResponseHandler(request, response, responseChunkCallback)
|
908 chip 1.7 {
909 }
910
|
911 kumpf 1.23 void AssociatorNamesResponseHandler::deliver(const CIMObjectPath& cimObjectPath)
|
912 chip 1.7 {
|
913 kumpf 1.23 if (cimObjectPath.getClassName().isNull())
|
914 chip 1.7 {
915 MessageLoaderParms message(
916 "Common.Exception.UNINITIALIZED_OBJECT_EXCEPTION",
917 "The object is not initialized.");
918
919 throw CIMException(CIM_ERR_FAILED, message);
920 }
921
922 SimpleObjectPathResponseHandler::deliver(cimObjectPath);
923 }
924
|
925 marek 1.33.2.3 void AssociatorNamesResponseHandler::deliver(const SCMOInstance& scmoObjectPath)
|
926 r.kieninger 1.33.2.2 {
|
927 marek 1.33.2.3 SimpleObjectPathResponseHandler::deliver(scmoObjectPath);
|
928 r.kieninger 1.33.2.2 }
929
|
930 kumpf 1.23 String AssociatorNamesResponseHandler::getClass() const
|
931 chip 1.7 {
|
932 kumpf 1.23 return String("AssociatorNamesResponseHandler");
|
933 chip 1.7 }
934
|
935 kumpf 1.23 void AssociatorNamesResponseHandler::transfer()
|
936 chip 1.7 {
|
937 kumpf 1.23 CIMAssociatorNamesResponseMessage& msg =
938 *static_cast<CIMAssociatorNamesResponseMessage*>(getResponse());
|
939 chip 1.7
|
940 marek 1.33.2.3 Array<CIMObjectPath> cimObjs= getObjects();
941 Array<SCMOInstance> scmoObjs= getSCMOObjects();
942 if (cimObjs.size() != 0)
943 {
944 msg.getResponseData().setInstanceNames(cimObjs);
945 }
946 if (scmoObjs.size() != 0)
947 {
948 msg.getResponseData().setSCMO(scmoObjs);
949 }
|
950 chip 1.7 }
951
952 //
953 // ReferencesResponseHandler
954 //
955
956 ReferencesResponseHandler::ReferencesResponseHandler(
|
957 kumpf 1.14 CIMReferencesRequestMessage* request,
958 CIMReferencesResponseMessage* response,
959 PEGASUS_RESPONSE_CHUNK_CALLBACK_T responseChunkCallback)
960 : OperationResponseHandler(request, response, responseChunkCallback)
|
961 chip 1.7 {
962 }
963
|
964 kumpf 1.23 void ReferencesResponseHandler::deliver(const CIMObject& cimObject)
|
965 chip 1.7 {
|
966 kumpf 1.23 if (cimObject.isUninitialized())
|
967 chip 1.7 {
968 MessageLoaderParms message(
969 "Common.Exception.UNINITIALIZED_OBJECT_EXCEPTION",
970 "The object is not initialized.");
971
972 throw CIMException(CIM_ERR_FAILED, message);
973 }
974
975 SimpleObjectResponseHandler::deliver(cimObject);
976 }
977
|
978 marek 1.33.2.3 void ReferencesResponseHandler::deliver(const SCMOInstance& scmoObject)
|
979 r.kieninger 1.33.2.2 {
|
980 marek 1.33.2.3 if (scmoObject.isUninitialized())
|
981 r.kieninger 1.33.2.2 {
982 MessageLoaderParms message(
983 "Common.Exception.UNINITIALIZED_OBJECT_EXCEPTION",
984 "The object is not initialized.");
985
986 throw CIMException(CIM_ERR_FAILED, message);
987 }
|
988 marek 1.33.2.3 SimpleObjectResponseHandler::deliver(scmoObject);
|
989 r.kieninger 1.33.2.2 }
990
|
991 kumpf 1.23 String ReferencesResponseHandler::getClass() const
|
992 chip 1.7 {
|
993 kumpf 1.23 return String("ReferencesResponseHandler");
|
994 chip 1.7 }
995
|
996 kumpf 1.23 void ReferencesResponseHandler::transfer()
|
997 chip 1.7 {
|
998 kumpf 1.23 CIMReferencesResponseMessage& msg =
999 *static_cast<CIMReferencesResponseMessage*>(getResponse());
|
1000 chip 1.7
|
1001 marek 1.33.2.3 Array<CIMObject> cimObjs= getObjects();
1002 Array<SCMOInstance> scmoObjs= getSCMOObjects();
1003 if (cimObjs.size() != 0)
1004 {
1005 msg.getResponseData().setObjects(cimObjs);
1006 }
1007 if (scmoObjs.size() != 0)
1008 {
1009 msg.getResponseData().setSCMO(scmoObjs);
1010 }
|
1011 chip 1.7 }
1012
1013 //
1014 // ReferenceNamesResponseHandler
1015 //
1016
1017 ReferenceNamesResponseHandler::ReferenceNamesResponseHandler(
|
1018 kumpf 1.14 CIMReferenceNamesRequestMessage* request,
1019 CIMReferenceNamesResponseMessage* response,
1020 PEGASUS_RESPONSE_CHUNK_CALLBACK_T responseChunkCallback)
1021 : OperationResponseHandler(request, response, responseChunkCallback)
|
1022 chip 1.7 {
1023 }
1024
|
1025 kumpf 1.23 void ReferenceNamesResponseHandler::deliver(const CIMObjectPath& cimObjectPath)
|
1026 chip 1.7 {
|
1027 kumpf 1.23 if (cimObjectPath.getClassName().isNull())
|
1028 chip 1.7 {
1029 MessageLoaderParms message(
1030 "Common.Exception.UNINITIALIZED_OBJECT_EXCEPTION",
1031 "The object is not initialized.");
1032
1033 throw CIMException(CIM_ERR_FAILED, message);
1034 }
1035
1036 SimpleObjectPathResponseHandler::deliver(cimObjectPath);
1037 }
1038
|
1039 marek 1.33.2.3 void ReferenceNamesResponseHandler::deliver(const SCMOInstance& scmoObjectPath)
|
1040 r.kieninger 1.33.2.2 {
|
1041 marek 1.33.2.3 SimpleObjectPathResponseHandler::deliver(scmoObjectPath);
|
1042 r.kieninger 1.33.2.2 }
1043
|
1044 kumpf 1.23 String ReferenceNamesResponseHandler::getClass() const
|
1045 chip 1.7 {
|
1046 kumpf 1.23 return String("ReferenceNamesResponseHandler");
|
1047 chip 1.7 }
1048
|
1049 kumpf 1.23 void ReferenceNamesResponseHandler::transfer()
|
1050 chip 1.7 {
|
1051 kumpf 1.23 CIMReferenceNamesResponseMessage& msg =
1052 *static_cast<CIMReferenceNamesResponseMessage*>(getResponse());
|
1053 chip 1.7
|
1054 marek 1.33.2.3 Array<CIMObjectPath> cimObjs= getObjects();
1055 Array<SCMOInstance> scmoObjs= getSCMOObjects();
1056 if (cimObjs.size() != 0)
1057 {
1058 msg.getResponseData().setInstanceNames(cimObjs);
1059 }
1060 if (scmoObjs.size() != 0)
1061 {
1062 msg.getResponseData().setSCMO(scmoObjs);
1063 }
|
1064 chip 1.7 }
1065
1066 //
1067 // InvokeMethodResponseHandler
1068 //
1069
1070 InvokeMethodResponseHandler::InvokeMethodResponseHandler(
|
1071 kumpf 1.14 CIMInvokeMethodRequestMessage* request,
1072 CIMInvokeMethodResponseMessage* response,
1073 PEGASUS_RESPONSE_CHUNK_CALLBACK_T responseChunkCallback)
1074 : OperationResponseHandler(request, response, responseChunkCallback)
|
1075 chip 1.7 {
1076 }
1077
|
1078 kumpf 1.23 void InvokeMethodResponseHandler::deliverParamValue(
1079 const CIMParamValue& cimParamValue)
|
1080 chip 1.7 {
|
1081 kumpf 1.23 if (cimParamValue.isUninitialized())
|
1082 chip 1.7 {
1083 MessageLoaderParms message(
1084 "Common.Exception.UNINITIALIZED_OBJECT_EXCEPTION",
1085 "The object is not initialized.");
1086
1087 throw CIMException(CIM_ERR_FAILED, message);
1088 }
1089
1090 SimpleMethodResultResponseHandler::deliverParamValue(cimParamValue);
1091 }
1092
|
1093 kumpf 1.23 void InvokeMethodResponseHandler::deliver(const CIMValue& cimValue)
|
1094 chip 1.7 {
|
1095 kumpf 1.23 if (cimValue.isNull())
|
1096 chip 1.7 {
1097 MessageLoaderParms message(
1098 "Common.Exception.UNINITIALIZED_OBJECT_EXCEPTION",
1099 "The object is not initialized.");
1100
1101 throw CIMException(CIM_ERR_FAILED, message);
1102 }
1103
1104 SimpleMethodResultResponseHandler::deliver(cimValue);
1105 }
1106
|
1107 kumpf 1.23 String InvokeMethodResponseHandler::getClass() const
|
1108 chip 1.7 {
|
1109 kumpf 1.23 return String("InvokeMethodResponseHandler");
|
1110 chip 1.7 }
1111
|
1112 kumpf 1.23 void InvokeMethodResponseHandler::transfer()
|
1113 chip 1.7 {
|
1114 kumpf 1.23 CIMInvokeMethodResponseMessage& msg =
1115 *static_cast<CIMInvokeMethodResponseMessage*>(getResponse());
|
1116 chip 1.7
1117 msg.outParameters = getParamValues();
1118
1119 // ATTN-RK-20020903: Is it legal for the return value to be null?
1120 // if not, then the check must be done here since deliver() works off the
1121 // virtual size, which refers to out parameters!
1122 msg.retValue = getReturnValue();
1123 }
1124
1125 //
1126 // EnableIndicationsResponseHandler
1127 //
1128
1129 EnableIndicationsResponseHandler::EnableIndicationsResponseHandler(
|
1130 kumpf 1.14 CIMRequestMessage* request,
1131 CIMResponseMessage* response,
|
1132 kumpf 1.17 const CIMInstance& provider,
|
1133 kumpf 1.14 PEGASUS_INDICATION_CALLBACK_T indicationCallback,
1134 PEGASUS_RESPONSE_CHUNK_CALLBACK_T responseChunkCallback)
1135 : OperationResponseHandler(request, response, responseChunkCallback),
1136 _indicationCallback(indicationCallback)
|
1137 chip 1.7 {
1138 _provider = provider;
1139 }
1140
|
1141 kumpf 1.23 void EnableIndicationsResponseHandler::deliver(
1142 const CIMIndication& cimIndication)
|
1143 chip 1.7 {
1144 OperationContext context;
1145
1146 Array<CIMObjectPath> subscriptionInstanceNames;
1147
|
1148 kumpf 1.23 context.insert(
1149 SubscriptionInstanceNamesContainer(subscriptionInstanceNames));
|
1150 chip 1.7
1151 deliver(context, cimIndication);
1152 }
1153
|
1154 kumpf 1.23 void EnableIndicationsResponseHandler::deliver(
1155 const OperationContext& context,
1156 const CIMIndication& cimIndication)
|
1157 chip 1.7 {
|
1158 kumpf 1.23 if (cimIndication.isUninitialized())
|
1159 chip 1.7 {
1160 MessageLoaderParms message(
1161 "Common.Exception.UNINITIALIZED_OBJECT_EXCEPTION",
1162 "The object is not initialized.");
1163
1164 throw CIMException(CIM_ERR_FAILED, message);
1165 }
1166
1167 // ATTN: temporarily convert indication to instance
1168 CIMInstance cimInstance(cimIndication);
1169
1170 // Get list of subscription instance names from context
1171 Array<CIMObjectPath> subscriptionInstanceNames;
1172
|
1173 kumpf 1.23 if (context.contains(SubscriptionInstanceNamesContainer::NAME))
|
1174 chip 1.7 {
1175 SubscriptionInstanceNamesContainer container =
1176 context.get(SubscriptionInstanceNamesContainer::NAME);
1177
1178 subscriptionInstanceNames = container.getInstanceNames();
1179 }
|
1180 a.dunfey 1.16 else
|
1181 chip 1.7 {
1182 subscriptionInstanceNames.clear();
1183 }
1184
|
1185 kumpf 1.12 ContentLanguageList contentLangs;
|
1186 chip 1.7
|
1187 kumpf 1.23 if (context.contains(ContentLanguageListContainer::NAME))
|
1188 chip 1.7 {
1189 // Get the Content-Language for this indication. The provider
1190 // does not have to add specify a language for the indication.
1191 ContentLanguageListContainer langContainer =
1192 context.get(ContentLanguageListContainer::NAME);
1193
1194 contentLangs = langContainer.getLanguages();
1195 }
|
1196 a.dunfey 1.16 else
|
1197 chip 1.7 {
1198 // The provider did not explicitly set a Content-Language for
1199 // the indication. Fall back to the lang set in this object.
1200 contentLangs = getLanguages();
1201 }
1202
1203 // create message
|
1204 kumpf 1.23 CIMProcessIndicationRequestMessage* request =
|
1205 chip 1.7 new CIMProcessIndicationRequestMessage(
1206 XmlWriter::getNextMessageId(),
1207 cimInstance.getPath().getNameSpace(),
1208 cimInstance,
1209 subscriptionInstanceNames,
1210 _provider,
1211 QueueIdStack()); // Must be filled in by the callback function
1212
1213 request->operationContext = context;
1214
|
1215 kumpf 1.23 if (request->operationContext.contains(ContentLanguageListContainer::NAME))
|
1216 chip 1.7 {
|
1217 kumpf 1.23 request->operationContext.set(
1218 ContentLanguageListContainer(contentLangs));
|
1219 chip 1.7 }
|
1220 a.dunfey 1.16 else
|
1221 chip 1.7 {
|
1222 kumpf 1.23 request->operationContext.insert(
1223 ContentLanguageListContainer(contentLangs));
|
1224 chip 1.7 }
1225
1226 _indicationCallback(request);
1227 }
1228
|
1229 kumpf 1.23 void EnableIndicationsResponseHandler::deliver(
1230 const Array<CIMIndication>& cimIndications)
|
1231 chip 1.7 {
1232 OperationContext context;
1233
1234 deliver(context, cimIndications);
1235 }
1236
|
1237 kumpf 1.23 void EnableIndicationsResponseHandler::deliver(
1238 const OperationContext& context,
1239 const Array<CIMIndication>& cimIndications)
|
1240 chip 1.7 {
|
1241 kumpf 1.23 for (Uint32 i = 0, n = cimIndications.size(); i < n; i++)
|
1242 chip 1.7 {
1243 deliver(context, cimIndications[i]);
1244 }
1245 }
1246
|
1247 kumpf 1.23 String EnableIndicationsResponseHandler::getClass() const
|
1248 chip 1.7 {
|
1249 kumpf 1.23 return String("EnableIndicationsResponseHandler");
|
1250 chip 1.7 }
1251
|
1252 kumpf 1.23 Boolean EnableIndicationsResponseHandler::isAsync() const
|
1253 chip 1.7 {
|
1254 kumpf 1.23 return false;
|
1255 chip 1.7 }
1256
|
1257 schuur 1.1 PEGASUS_NAMESPACE_END
|