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 // TBD: Extend CIMCreateInstanceResponseMessage with ResponseData.
640 Array<CIMObjectPath> cimObjs= getObjects();
641 Array<SCMOInstance> scmoObjs= getSCMOObjects();
642 if (cimObjs.size() != 0)
643 {
644 msg.instanceName = cimObjs[0];
645 }
646 else
647 {
648 fprintf(stderr,"TBD: Scaffold code for "
649 "CreateInstanceResponseHandler::transfer()\n");
650 scmoObjs[0].getCIMObjectPath(msg.instanceName);
651 }
|
652 chip 1.7 }
653 }
654
655 //
656 // ModifyInstanceResponseHandler
657 //
658
659 ModifyInstanceResponseHandler::ModifyInstanceResponseHandler(
|
660 kumpf 1.14 CIMModifyInstanceRequestMessage* request,
661 CIMModifyInstanceResponseMessage* response,
662 PEGASUS_RESPONSE_CHUNK_CALLBACK_T responseChunkCallback)
663 : OperationResponseHandler(request, response, responseChunkCallback)
|
664 chip 1.7 {
665 }
666
|
667 kumpf 1.23 String ModifyInstanceResponseHandler::getClass() const
|
668 chip 1.7 {
|
669 kumpf 1.23 return String("ModifyInstanceResponseHandler");
|
670 chip 1.7 }
671
672 //
673 // DeleteInstanceResponseHandler
674 //
675
676 DeleteInstanceResponseHandler::DeleteInstanceResponseHandler(
|
677 kumpf 1.14 CIMDeleteInstanceRequestMessage* request,
678 CIMDeleteInstanceResponseMessage* response,
679 PEGASUS_RESPONSE_CHUNK_CALLBACK_T responseChunkCallback)
680 : OperationResponseHandler(request, response, responseChunkCallback)
|
681 chip 1.7 {
682 }
683
|
684 kumpf 1.23 String DeleteInstanceResponseHandler::getClass() const
|
685 chip 1.7 {
|
686 kumpf 1.23 return String("DeleteInstanceResponseHandler");
|
687 chip 1.7 }
688
689 //
690 // GetPropertyResponseHandler
691 //
692
693 GetPropertyResponseHandler::GetPropertyResponseHandler(
|
694 kumpf 1.14 CIMGetPropertyRequestMessage* request,
695 CIMGetPropertyResponseMessage* response,
696 PEGASUS_RESPONSE_CHUNK_CALLBACK_T responseChunkCallback)
697 : OperationResponseHandler(request, response, responseChunkCallback)
|
698 chip 1.7 {
699 }
700
|
701 kumpf 1.23 void GetPropertyResponseHandler::deliver(const CIMValue& cimValue)
|
702 chip 1.7 {
|
703 kumpf 1.23 if (cimValue.isNull())
|
704 chip 1.7 {
705 MessageLoaderParms message(
706 "Common.Exception.UNINITIALIZED_OBJECT_EXCEPTION",
707 "The object is not initialized.");
708
709 throw CIMException(CIM_ERR_FAILED, message);
710 }
711
712 SimpleValueResponseHandler::deliver(cimValue);
713 }
714
|
715 kumpf 1.23 String GetPropertyResponseHandler::getClass() const
|
716 chip 1.7 {
|
717 kumpf 1.23 return String("GetPropertyResponseHandler");
|
718 chip 1.7 }
719
|
720 kumpf 1.23 void GetPropertyResponseHandler::transfer()
|
721 chip 1.7 {
|
722 kumpf 1.23 if (size() > 0)
|
723 chip 1.7 {
|
724 kumpf 1.23 CIMGetPropertyResponseMessage& msg =
725 *static_cast<CIMGetPropertyResponseMessage*>(getResponse());
|
726 chip 1.7
727 msg.value = getObjects()[0];
728 }
729 }
730
|
731 kumpf 1.23 void GetPropertyResponseHandler::validate()
|
732 chip 1.7 {
733 // error? provider claims success,
734 // but did not deliver an instance.
|
735 kumpf 1.23 if (getResponseObjectTotal() == 0)
|
736 chip 1.7 {
737 setStatus(CIM_ERR_NOT_FOUND);
738 }
739 }
740
741 //
742 // SetPropertyResponseHandler
743 //
744
745 SetPropertyResponseHandler::SetPropertyResponseHandler(
|
746 kumpf 1.14 CIMSetPropertyRequestMessage* request,
747 CIMSetPropertyResponseMessage* response,
748 PEGASUS_RESPONSE_CHUNK_CALLBACK_T responseChunkCallback)
749 : OperationResponseHandler(request, response, responseChunkCallback)
|
750 chip 1.7 {
751 }
752
|
753 kumpf 1.23 String SetPropertyResponseHandler::getClass() const
|
754 chip 1.7 {
|
755 kumpf 1.23 return String("SetPropertyResponseHandler");
|
756 chip 1.7 }
757
758 //
759 // ExecQueryResponseHandler
760 //
761
762 ExecQueryResponseHandler::ExecQueryResponseHandler(
|
763 kumpf 1.14 CIMExecQueryRequestMessage* request,
764 CIMExecQueryResponseMessage* response,
765 PEGASUS_RESPONSE_CHUNK_CALLBACK_T responseChunkCallback)
766 : OperationResponseHandler(request, response, responseChunkCallback)
|
767 chip 1.7 {
768 }
769
|
770 kumpf 1.23 void ExecQueryResponseHandler::deliver(const CIMInstance& cimInstance)
|
771 chip 1.7 {
|
772 kumpf 1.23 if (cimInstance.isUninitialized())
|
773 chip 1.7 {
774 MessageLoaderParms message(
775 "Common.Exception.UNINITIALIZED_OBJECT_EXCEPTION",
776 "The object is not initialized.");
777
778 throw CIMException(CIM_ERR_FAILED, message);
779 }
780
781 SimpleInstance2ObjectResponseHandler::deliver(cimInstance);
782 }
783
|
784 marek 1.33.2.3 void ExecQueryResponseHandler::deliver(const SCMOInstance& scmoInstance)
|
785 r.kieninger 1.33.2.1 {
|
786 marek 1.33.2.3 if (scmoInstance.isUninitialized())
|
787 r.kieninger 1.33.2.1 {
788 MessageLoaderParms message(
789 "Common.Exception.UNINITIALIZED_OBJECT_EXCEPTION",
790 "The object is not initialized.");
791
792 throw CIMException(CIM_ERR_FAILED, message);
|
793 r.kieninger 1.33.2.2 }
|
794 r.kieninger 1.33.2.1
|
795 marek 1.33.2.3 SimpleInstance2ObjectResponseHandler::deliver(scmoInstance);
|
796 r.kieninger 1.33.2.1 }
797
|
798 kumpf 1.23 String ExecQueryResponseHandler::getClass() const
|
799 chip 1.7 {
|
800 kumpf 1.23 return String("ExecQueryResponseHandler");
|
801 chip 1.7 }
802
|
803 kumpf 1.23 void ExecQueryResponseHandler::transfer()
|
804 chip 1.7 {
|
805 kumpf 1.23 CIMExecQueryResponseMessage& msg =
806 *static_cast<CIMExecQueryResponseMessage*>(getResponse());
|
807 chip 1.7
|
808 marek 1.33.2.3 Array<CIMObject> cimObjs= getObjects();
809 Array<SCMOInstance> scmoObjs= getSCMOObjects();
810 if (cimObjs.size() != 0)
811 {
812 msg.getResponseData().setObjects(cimObjs);
813 }
814 if (scmoObjs.size() != 0)
815 {
816 msg.getResponseData().setSCMO(scmoObjs);
817 }
|
818 chip 1.7 }
819
|
820 kumpf 1.23 Boolean ExecQueryResponseHandler::isAsync() const
|
821 chip 1.7 {
|
822 kumpf 1.23 return false;
|
823 chip 1.7 }
824
825 //
826 // AssociatorsResponseHandler
827 //
828
829 AssociatorsResponseHandler::AssociatorsResponseHandler(
|
830 kumpf 1.14 CIMAssociatorsRequestMessage* request,
831 CIMAssociatorsResponseMessage* response,
832 PEGASUS_RESPONSE_CHUNK_CALLBACK_T responseChunkCallback)
833 : OperationResponseHandler(request, response, responseChunkCallback)
|
834 chip 1.7 {
835 }
836
|
837 kumpf 1.23 void AssociatorsResponseHandler::deliver(const CIMObject& cimObject)
|
838 chip 1.7 {
|
839 kumpf 1.23 if (cimObject.isUninitialized())
|
840 chip 1.7 {
841 MessageLoaderParms message(
842 "Common.Exception.UNINITIALIZED_OBJECT_EXCEPTION",
843 "The object is not initialized.");
844
845 throw CIMException(CIM_ERR_FAILED, message);
846 }
847
848 SimpleObjectResponseHandler::deliver(cimObject);
849 }
850
|
851 thilo.boehm 1.33.2.5 void AssociatorsResponseHandler::deliver(const CIMInstance& cimInstance)
852 {
853 if (cimInstance.isUninitialized())
854 {
855 MessageLoaderParms message(
856 "Common.Exception.UNINITIALIZED_OBJECT_EXCEPTION",
857 "The object is not initialized.");
858
859 throw CIMException(CIM_ERR_FAILED, message);
860 }
861
862 SimpleObjectResponseHandler::deliver(cimInstance);
863 }
864
|
865 marek 1.33.2.3 void AssociatorsResponseHandler::deliver(const SCMOInstance& scmoObject)
|
866 r.kieninger 1.33.2.2 {
|
867 marek 1.33.2.3 if (scmoObject.isUninitialized())
|
868 r.kieninger 1.33.2.2 {
869 MessageLoaderParms message(
870 "Common.Exception.UNINITIALIZED_OBJECT_EXCEPTION",
871 "The object is not initialized.");
872
873 throw CIMException(CIM_ERR_FAILED, message);
874 }
|
875 marek 1.33.2.3 SimpleObjectResponseHandler::deliver(scmoObject);
|
876 r.kieninger 1.33.2.2 }
877
|
878 kumpf 1.23 String AssociatorsResponseHandler::getClass() const
|
879 chip 1.7 {
|
880 kumpf 1.23 return String("AssociatorsResponseHandler");
|
881 chip 1.7 }
882
|
883 kumpf 1.23 void AssociatorsResponseHandler::transfer()
|
884 chip 1.7 {
|
885 kumpf 1.23 CIMAssociatorsResponseMessage& msg =
886 *static_cast<CIMAssociatorsResponseMessage*>(getResponse());
|
887 chip 1.7
|
888 marek 1.33.2.3 Array<CIMObject> cimObjs= getObjects();
889 Array<SCMOInstance> scmoObjs= getSCMOObjects();
890 if (cimObjs.size() != 0)
891 {
892 msg.getResponseData().setObjects(cimObjs);
893 }
894 if (scmoObjs.size() != 0)
895 {
896 msg.getResponseData().setSCMO(scmoObjs);
897 }
|
898 chip 1.7 }
899
900 //
901 // AssociatorNamesResponseHandler
902 //
903
904 AssociatorNamesResponseHandler::AssociatorNamesResponseHandler(
|
905 kumpf 1.14 CIMAssociatorNamesRequestMessage* request,
906 CIMAssociatorNamesResponseMessage* response,
907 PEGASUS_RESPONSE_CHUNK_CALLBACK_T responseChunkCallback)
908 : OperationResponseHandler(request, response, responseChunkCallback)
|
909 chip 1.7 {
910 }
911
|
912 kumpf 1.23 void AssociatorNamesResponseHandler::deliver(const CIMObjectPath& cimObjectPath)
|
913 chip 1.7 {
|
914 kumpf 1.23 if (cimObjectPath.getClassName().isNull())
|
915 chip 1.7 {
916 MessageLoaderParms message(
917 "Common.Exception.UNINITIALIZED_OBJECT_EXCEPTION",
918 "The object is not initialized.");
919
920 throw CIMException(CIM_ERR_FAILED, message);
921 }
922
923 SimpleObjectPathResponseHandler::deliver(cimObjectPath);
924 }
925
|
926 marek 1.33.2.3 void AssociatorNamesResponseHandler::deliver(const SCMOInstance& scmoObjectPath)
|
927 r.kieninger 1.33.2.2 {
|
928 marek 1.33.2.3 SimpleObjectPathResponseHandler::deliver(scmoObjectPath);
|
929 r.kieninger 1.33.2.2 }
930
|
931 kumpf 1.23 String AssociatorNamesResponseHandler::getClass() const
|
932 chip 1.7 {
|
933 kumpf 1.23 return String("AssociatorNamesResponseHandler");
|
934 chip 1.7 }
935
|
936 kumpf 1.23 void AssociatorNamesResponseHandler::transfer()
|
937 chip 1.7 {
|
938 kumpf 1.23 CIMAssociatorNamesResponseMessage& msg =
939 *static_cast<CIMAssociatorNamesResponseMessage*>(getResponse());
|
940 chip 1.7
|
941 marek 1.33.2.3 Array<CIMObjectPath> cimObjs= getObjects();
942 Array<SCMOInstance> scmoObjs= getSCMOObjects();
943 if (cimObjs.size() != 0)
944 {
945 msg.getResponseData().setInstanceNames(cimObjs);
946 }
947 if (scmoObjs.size() != 0)
948 {
949 msg.getResponseData().setSCMO(scmoObjs);
950 }
|
951 chip 1.7 }
952
953 //
954 // ReferencesResponseHandler
955 //
956
957 ReferencesResponseHandler::ReferencesResponseHandler(
|
958 kumpf 1.14 CIMReferencesRequestMessage* request,
959 CIMReferencesResponseMessage* response,
960 PEGASUS_RESPONSE_CHUNK_CALLBACK_T responseChunkCallback)
961 : OperationResponseHandler(request, response, responseChunkCallback)
|
962 chip 1.7 {
963 }
964
|
965 kumpf 1.23 void ReferencesResponseHandler::deliver(const CIMObject& cimObject)
|
966 chip 1.7 {
|
967 kumpf 1.23 if (cimObject.isUninitialized())
|
968 chip 1.7 {
969 MessageLoaderParms message(
970 "Common.Exception.UNINITIALIZED_OBJECT_EXCEPTION",
971 "The object is not initialized.");
972
973 throw CIMException(CIM_ERR_FAILED, message);
974 }
975
976 SimpleObjectResponseHandler::deliver(cimObject);
977 }
978
|
979 marek 1.33.2.3 void ReferencesResponseHandler::deliver(const SCMOInstance& scmoObject)
|
980 r.kieninger 1.33.2.2 {
|
981 marek 1.33.2.3 if (scmoObject.isUninitialized())
|
982 r.kieninger 1.33.2.2 {
983 MessageLoaderParms message(
984 "Common.Exception.UNINITIALIZED_OBJECT_EXCEPTION",
985 "The object is not initialized.");
986
987 throw CIMException(CIM_ERR_FAILED, message);
988 }
|
989 marek 1.33.2.3 SimpleObjectResponseHandler::deliver(scmoObject);
|
990 r.kieninger 1.33.2.2 }
991
|
992 kumpf 1.23 String ReferencesResponseHandler::getClass() const
|
993 chip 1.7 {
|
994 kumpf 1.23 return String("ReferencesResponseHandler");
|
995 chip 1.7 }
996
|
997 kumpf 1.23 void ReferencesResponseHandler::transfer()
|
998 chip 1.7 {
|
999 kumpf 1.23 CIMReferencesResponseMessage& msg =
1000 *static_cast<CIMReferencesResponseMessage*>(getResponse());
|
1001 chip 1.7
|
1002 marek 1.33.2.3 Array<CIMObject> cimObjs= getObjects();
1003 Array<SCMOInstance> scmoObjs= getSCMOObjects();
1004 if (cimObjs.size() != 0)
1005 {
1006 msg.getResponseData().setObjects(cimObjs);
1007 }
1008 if (scmoObjs.size() != 0)
1009 {
1010 msg.getResponseData().setSCMO(scmoObjs);
1011 }
|
1012 chip 1.7 }
1013
1014 //
1015 // ReferenceNamesResponseHandler
1016 //
1017
1018 ReferenceNamesResponseHandler::ReferenceNamesResponseHandler(
|
1019 kumpf 1.14 CIMReferenceNamesRequestMessage* request,
1020 CIMReferenceNamesResponseMessage* response,
1021 PEGASUS_RESPONSE_CHUNK_CALLBACK_T responseChunkCallback)
1022 : OperationResponseHandler(request, response, responseChunkCallback)
|
1023 chip 1.7 {
1024 }
1025
|
1026 kumpf 1.23 void ReferenceNamesResponseHandler::deliver(const CIMObjectPath& cimObjectPath)
|
1027 chip 1.7 {
|
1028 kumpf 1.23 if (cimObjectPath.getClassName().isNull())
|
1029 chip 1.7 {
1030 MessageLoaderParms message(
1031 "Common.Exception.UNINITIALIZED_OBJECT_EXCEPTION",
1032 "The object is not initialized.");
1033
1034 throw CIMException(CIM_ERR_FAILED, message);
1035 }
1036
1037 SimpleObjectPathResponseHandler::deliver(cimObjectPath);
1038 }
1039
|
1040 marek 1.33.2.3 void ReferenceNamesResponseHandler::deliver(const SCMOInstance& scmoObjectPath)
|
1041 r.kieninger 1.33.2.2 {
|
1042 marek 1.33.2.3 SimpleObjectPathResponseHandler::deliver(scmoObjectPath);
|
1043 r.kieninger 1.33.2.2 }
1044
|
1045 kumpf 1.23 String ReferenceNamesResponseHandler::getClass() const
|
1046 chip 1.7 {
|
1047 kumpf 1.23 return String("ReferenceNamesResponseHandler");
|
1048 chip 1.7 }
1049
|
1050 kumpf 1.23 void ReferenceNamesResponseHandler::transfer()
|
1051 chip 1.7 {
|
1052 kumpf 1.23 CIMReferenceNamesResponseMessage& msg =
1053 *static_cast<CIMReferenceNamesResponseMessage*>(getResponse());
|
1054 chip 1.7
|
1055 marek 1.33.2.3 Array<CIMObjectPath> cimObjs= getObjects();
1056 Array<SCMOInstance> scmoObjs= getSCMOObjects();
1057 if (cimObjs.size() != 0)
1058 {
1059 msg.getResponseData().setInstanceNames(cimObjs);
1060 }
1061 if (scmoObjs.size() != 0)
1062 {
1063 msg.getResponseData().setSCMO(scmoObjs);
1064 }
|
1065 chip 1.7 }
1066
1067 //
1068 // InvokeMethodResponseHandler
1069 //
1070
1071 InvokeMethodResponseHandler::InvokeMethodResponseHandler(
|
1072 kumpf 1.14 CIMInvokeMethodRequestMessage* request,
1073 CIMInvokeMethodResponseMessage* response,
1074 PEGASUS_RESPONSE_CHUNK_CALLBACK_T responseChunkCallback)
1075 : OperationResponseHandler(request, response, responseChunkCallback)
|
1076 chip 1.7 {
1077 }
1078
|
1079 kumpf 1.23 void InvokeMethodResponseHandler::deliverParamValue(
1080 const CIMParamValue& cimParamValue)
|
1081 chip 1.7 {
|
1082 kumpf 1.23 if (cimParamValue.isUninitialized())
|
1083 chip 1.7 {
1084 MessageLoaderParms message(
1085 "Common.Exception.UNINITIALIZED_OBJECT_EXCEPTION",
1086 "The object is not initialized.");
1087
1088 throw CIMException(CIM_ERR_FAILED, message);
1089 }
1090
1091 SimpleMethodResultResponseHandler::deliverParamValue(cimParamValue);
1092 }
1093
|
1094 kumpf 1.23 void InvokeMethodResponseHandler::deliver(const CIMValue& cimValue)
|
1095 chip 1.7 {
|
1096 kumpf 1.23 if (cimValue.isNull())
|
1097 chip 1.7 {
1098 MessageLoaderParms message(
1099 "Common.Exception.UNINITIALIZED_OBJECT_EXCEPTION",
1100 "The object is not initialized.");
1101
1102 throw CIMException(CIM_ERR_FAILED, message);
1103 }
1104
1105 SimpleMethodResultResponseHandler::deliver(cimValue);
1106 }
1107
|
1108 kumpf 1.23 String InvokeMethodResponseHandler::getClass() const
|
1109 chip 1.7 {
|
1110 kumpf 1.23 return String("InvokeMethodResponseHandler");
|
1111 chip 1.7 }
1112
|
1113 kumpf 1.23 void InvokeMethodResponseHandler::transfer()
|
1114 chip 1.7 {
|
1115 kumpf 1.23 CIMInvokeMethodResponseMessage& msg =
1116 *static_cast<CIMInvokeMethodResponseMessage*>(getResponse());
|
1117 chip 1.7
1118 msg.outParameters = getParamValues();
1119
1120 // ATTN-RK-20020903: Is it legal for the return value to be null?
1121 // if not, then the check must be done here since deliver() works off the
1122 // virtual size, which refers to out parameters!
1123 msg.retValue = getReturnValue();
1124 }
1125
1126 //
1127 // EnableIndicationsResponseHandler
1128 //
1129
1130 EnableIndicationsResponseHandler::EnableIndicationsResponseHandler(
|
1131 kumpf 1.14 CIMRequestMessage* request,
1132 CIMResponseMessage* response,
|
1133 kumpf 1.17 const CIMInstance& provider,
|
1134 kumpf 1.14 PEGASUS_INDICATION_CALLBACK_T indicationCallback,
1135 PEGASUS_RESPONSE_CHUNK_CALLBACK_T responseChunkCallback)
1136 : OperationResponseHandler(request, response, responseChunkCallback),
1137 _indicationCallback(indicationCallback)
|
1138 chip 1.7 {
1139 _provider = provider;
1140 }
1141
|
1142 kumpf 1.23 void EnableIndicationsResponseHandler::deliver(
1143 const CIMIndication& cimIndication)
|
1144 chip 1.7 {
1145 OperationContext context;
1146
1147 Array<CIMObjectPath> subscriptionInstanceNames;
1148
|
1149 kumpf 1.23 context.insert(
1150 SubscriptionInstanceNamesContainer(subscriptionInstanceNames));
|
1151 chip 1.7
1152 deliver(context, cimIndication);
1153 }
1154
|
1155 kumpf 1.23 void EnableIndicationsResponseHandler::deliver(
1156 const OperationContext& context,
1157 const CIMIndication& cimIndication)
|
1158 chip 1.7 {
|
1159 kumpf 1.23 if (cimIndication.isUninitialized())
|
1160 chip 1.7 {
1161 MessageLoaderParms message(
1162 "Common.Exception.UNINITIALIZED_OBJECT_EXCEPTION",
1163 "The object is not initialized.");
1164
1165 throw CIMException(CIM_ERR_FAILED, message);
1166 }
1167
1168 // ATTN: temporarily convert indication to instance
1169 CIMInstance cimInstance(cimIndication);
1170
1171 // Get list of subscription instance names from context
1172 Array<CIMObjectPath> subscriptionInstanceNames;
1173
|
1174 kumpf 1.23 if (context.contains(SubscriptionInstanceNamesContainer::NAME))
|
1175 chip 1.7 {
1176 SubscriptionInstanceNamesContainer container =
1177 context.get(SubscriptionInstanceNamesContainer::NAME);
1178
1179 subscriptionInstanceNames = container.getInstanceNames();
1180 }
|
1181 a.dunfey 1.16 else
|
1182 chip 1.7 {
1183 subscriptionInstanceNames.clear();
1184 }
1185
|
1186 kumpf 1.12 ContentLanguageList contentLangs;
|
1187 chip 1.7
|
1188 kumpf 1.23 if (context.contains(ContentLanguageListContainer::NAME))
|
1189 chip 1.7 {
1190 // Get the Content-Language for this indication. The provider
1191 // does not have to add specify a language for the indication.
1192 ContentLanguageListContainer langContainer =
1193 context.get(ContentLanguageListContainer::NAME);
1194
1195 contentLangs = langContainer.getLanguages();
1196 }
|
1197 a.dunfey 1.16 else
|
1198 chip 1.7 {
1199 // The provider did not explicitly set a Content-Language for
1200 // the indication. Fall back to the lang set in this object.
1201 contentLangs = getLanguages();
1202 }
1203
1204 // create message
|
1205 kumpf 1.23 CIMProcessIndicationRequestMessage* request =
|
1206 chip 1.7 new CIMProcessIndicationRequestMessage(
1207 XmlWriter::getNextMessageId(),
1208 cimInstance.getPath().getNameSpace(),
1209 cimInstance,
1210 subscriptionInstanceNames,
1211 _provider,
1212 QueueIdStack()); // Must be filled in by the callback function
1213
1214 request->operationContext = context;
1215
|
1216 kumpf 1.23 if (request->operationContext.contains(ContentLanguageListContainer::NAME))
|
1217 chip 1.7 {
|
1218 kumpf 1.23 request->operationContext.set(
1219 ContentLanguageListContainer(contentLangs));
|
1220 chip 1.7 }
|
1221 a.dunfey 1.16 else
|
1222 chip 1.7 {
|
1223 kumpf 1.23 request->operationContext.insert(
1224 ContentLanguageListContainer(contentLangs));
|
1225 chip 1.7 }
1226
1227 _indicationCallback(request);
1228 }
1229
|
1230 kumpf 1.23 void EnableIndicationsResponseHandler::deliver(
1231 const Array<CIMIndication>& cimIndications)
|
1232 chip 1.7 {
1233 OperationContext context;
1234
1235 deliver(context, cimIndications);
1236 }
1237
|
1238 kumpf 1.23 void EnableIndicationsResponseHandler::deliver(
1239 const OperationContext& context,
1240 const Array<CIMIndication>& cimIndications)
|
1241 chip 1.7 {
|
1242 kumpf 1.23 for (Uint32 i = 0, n = cimIndications.size(); i < n; i++)
|
1243 chip 1.7 {
1244 deliver(context, cimIndications[i]);
1245 }
1246 }
1247
|
1248 kumpf 1.23 String EnableIndicationsResponseHandler::getClass() const
|
1249 chip 1.7 {
|
1250 kumpf 1.23 return String("EnableIndicationsResponseHandler");
|
1251 chip 1.7 }
1252
|
1253 kumpf 1.23 Boolean EnableIndicationsResponseHandler::isAsync() const
|
1254 chip 1.7 {
|
1255 kumpf 1.23 return false;
|
1256 chip 1.7 }
1257
|
1258 schuur 1.1 PEGASUS_NAMESPACE_END
|