1 karl 1.15 //%2003////////////////////////////////////////////////////////////////////////
|
2 chip 1.1 //
|
3 karl 1.15 // Copyright (c) 2000, 2001, 2002 BMC Software, Hewlett-Packard Development
4 // Company, L. P., IBM Corp., The Open Group, Tivoli Systems.
5 // Copyright (c) 2003 BMC Software; Hewlett-Packard Development Company, L. P.;
6 // IBM Corp.; EMC Corporation, The Open Group.
|
7 chip 1.1 //
8 // Permission is hereby granted, free of charge, to any person obtaining a copy
9 // of this software and associated documentation files (the "Software"), to
10 // deal in the Software without restriction, including without limitation the
11 // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
12 // sell copies of the Software, and to permit persons to whom the Software is
13 // furnished to do so, subject to the following conditions:
|
14 chip 1.17 //
|
15 chip 1.1 // THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
16 // ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED
17 // "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
18 // LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
19 // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
20 // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
21 // ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23 //
24 //==============================================================================
25 //
26 // Author: Chip Vincent (cvincent@us.ibm.com)
27 //
28 // Modified By: Carol Ann Krug Graves, Hewlett-Packard Company
29 // (carolann_graves@hp.com)
30 // Mike Day, IBM (mdday@us.ibm.com)
31 // Karl Schopmeyer(k.schopmeyer@opengroup.org) - Fix associators.
|
32 chip 1.9 // Yi Zhou, Hewlett-Packard Company (yi_zhou@hp.com)
|
33 schuur 1.19 // Adrian Schuur, IBM (schuur@de.ibm.com)
|
34 a.arora 1.37 // Amit K Arora (amita@in.ibm.com) for PEP-101
|
35 kumpf 1.39 // Roger Kumpf, Hewlett-Packard Company (roger_kumpf@hp.com)
|
36 se.gupta 1.41 // Seema Gupta (gseema@in.ibm.com for PEP135)
|
37 chip 1.1 //
38 //%/////////////////////////////////////////////////////////////////////////////
39
40 #include "ProviderManagerService.h"
41
42 #include <Pegasus/Common/Config.h>
43 #include <Pegasus/Common/Constants.h>
44 #include <Pegasus/Common/CIMMessage.h>
|
45 kumpf 1.39 #include <Pegasus/Common/Thread.h>
|
46 chip 1.1 #include <Pegasus/Common/Tracer.h>
47 #include <Pegasus/Common/Logger.h>
|
48 a.arora 1.37 #include <Pegasus/Common/AutoPtr.h>
|
49 kumpf 1.50 #include <Pegasus/Common/Constants.h>
|
50 chip 1.1
|
51 chip 1.6 #include <Pegasus/Config/ConfigManager.h>
52
|
53 kumpf 1.39 #include <Pegasus/ProviderManager2/BasicProviderManagerRouter.h>
|
54 kumpf 1.51 #include <Pegasus/ProviderManager2/OOPProviderManagerRouter.h>
|
55 chip 1.17
|
56 chip 1.1 PEGASUS_NAMESPACE_BEGIN
57
|
58 chip 1.11 inline Boolean _isSupportedRequestType(const Message * message)
59 {
60 // ATTN: needs implementation
61
62 // for now, assume all requests are valid
63
64 return(true);
|
65 chip 1.3 }
66
67 inline Boolean _isSupportedResponseType(const Message * message)
68 {
|
69 chip 1.11 // ATTN: needs implementation
70
71 // for now, assume all responses are invalid
|
72 chip 1.3
|
73 chip 1.11 return(false);
|
74 chip 1.3 }
75
|
76 schuur 1.19 ProviderManagerService* ProviderManagerService::providerManagerService=NULL;
|
77 kumpf 1.39 Uint32 ProviderManagerService::_indicationServiceQueueId = PEG_NOT_FOUND;
|
78 schuur 1.19
|
79 chip 1.1 ProviderManagerService::ProviderManagerService(void)
80 : MessageQueueService(PEGASUS_QUEUENAME_PROVIDERMANAGER_CPP)
81 {
|
82 schuur 1.19 providerManagerService=this;
|
83 chip 1.1 }
84
|
85 schuur 1.25 ProviderManagerService::ProviderManagerService(
86 ProviderRegistrationManager * providerRegistrationManager,
87 CIMRepository * repository)
|
88 chip 1.1 : MessageQueueService(PEGASUS_QUEUENAME_PROVIDERMANAGER_CPP)
89 {
|
90 schuur 1.19 providerManagerService=this;
|
91 schuur 1.25 _repository=repository;
|
92 dj.gorey 1.31
|
93 kumpf 1.38 _providerRegistrationManager = providerRegistrationManager;
|
94 kumpf 1.44
95 _unloadIdleProvidersBusy = 0;
96
|
97 kumpf 1.51 // Determine whether Out-of-Process Provider support is enabled
98 ConfigManager* configManager = ConfigManager::getInstance();
99 if (String::equal(
100 configManager->getCurrentValue("enableProviderProcesses"), "true"))
101 {
102 _providerManagerRouter =
103 new OOPProviderManagerRouter(indicationCallback);
104 }
105 else
106 {
107 _providerManagerRouter =
108 new BasicProviderManagerRouter(indicationCallback);
109 }
|
110 chip 1.1 }
111
112 ProviderManagerService::~ProviderManagerService(void)
113 {
|
114 kumpf 1.39 delete _providerManagerRouter;
|
115 schuur 1.19 providerManagerService=NULL;
|
116 chip 1.1 }
117
118 Boolean ProviderManagerService::messageOK(const Message * message)
119 {
120 PEGASUS_ASSERT(message != 0);
121
|
122 chip 1.3 if(_isSupportedRequestType(message))
|
123 chip 1.1 {
|
124 chip 1.3 return(MessageQueueService::messageOK(message));
|
125 chip 1.1 }
126
|
127 chip 1.3 return(false);
|
128 chip 1.1 }
129
130 void ProviderManagerService::handleEnqueue(void)
131 {
132 Message * message = dequeue();
133
134 handleEnqueue(message);
135 }
136
137 void ProviderManagerService::handleEnqueue(Message * message)
138 {
139 PEGASUS_ASSERT(message != 0);
140
141 AsyncLegacyOperationStart * asyncRequest;
142
143 if(message->_async != NULL)
144 {
145 asyncRequest = static_cast<AsyncLegacyOperationStart *>(message->_async);
146 }
147 else
148 {
149 chip 1.1 asyncRequest = new AsyncLegacyOperationStart(
150 get_next_xid(),
151 0,
152 this->getQueueId(),
153 message,
154 this->getQueueId());
155 }
156
157 _handle_async_request(asyncRequest);
158 }
159
160 void ProviderManagerService::_handle_async_request(AsyncRequest * request)
161 {
162 PEG_METHOD_ENTER(TRC_PROVIDERMANAGER,
163 "ProviderManagerService::_handle_async_request");
164
165 PEGASUS_ASSERT((request != 0) && (request->op != 0));
166
167 if(request->getType() == async_messages::ASYNC_LEGACY_OP_START)
168 {
169 request->op->processing();
170 chip 1.1
171 _incomingQueue.enqueue(request->op);
172
|
173 schuur 1.32 while (!_thread_pool->allocate_and_awaken(
174 (void *)this, ProviderManagerService::handleCimOperation))
175 {
176 pegasus_yield();
177 }
|
178 chip 1.1 }
179 else
180 {
181 // pass all other operations to the default handler
182 MessageQueueService::_handle_async_request(request);
183 }
184
185 PEG_METHOD_EXIT();
186
187 return;
188 }
189
|
190 se.gupta 1.56 /* The following method shouldn't throw an exception as this runs on its own thread and the exceptions thrown by it
191 don't go anywhere and get lost.
192 */
|
193 kumpf 1.39 PEGASUS_THREAD_RETURN PEGASUS_THREAD_CDECL
|
194 se.gupta 1.56 ProviderManagerService::handleCimOperation(void * arg)
|
195 chip 1.1 {
|
196 kumpf 1.39 PEG_METHOD_ENTER(TRC_PROVIDERMANAGER,
197 "ProviderManagerService::handleCimOperation");
|
198 chip 1.1
|
199 chip 1.8 if(arg == 0)
200 {
201 // thread started with invalid argument.
202 return(PEGASUS_THREAD_RETURN(1));
203 }
204
|
205 chip 1.1 // get the service from argument
|
206 kumpf 1.39 ProviderManagerService * service =
207 reinterpret_cast<ProviderManagerService *>(arg);
|
208 chip 1.1
209 if(service->_incomingQueue.size() == 0)
210 {
211 PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
|
212 kumpf 1.39 "ProviderManagerService::handleCimOperation() called with no "
213 "op node in queue");
|
214 chip 1.1
215 PEG_METHOD_EXIT();
216
217 // thread started with no message in queue.
218 return(PEGASUS_THREAD_RETURN(1));
219 }
220
221 AsyncOpNode * op = service->_incomingQueue.dequeue();
222
|
223 chip 1.8 if((op == 0) || (op->_request.count() == 0))
|
224 chip 1.1 {
|
225 kumpf 1.39 // ATTN: This may dereference a null pointer!
|
226 chip 1.1 MessageQueue * queue = MessageQueue::lookup(op->_source_queue);
227
228 PEGASUS_ASSERT(queue != 0);
229
230 PEG_METHOD_EXIT();
231
232 // no request in op node
233 return(PEGASUS_THREAD_RETURN(1));
234 }
235
236 AsyncRequest * request = static_cast<AsyncRequest *>(op->_request.next(0));
237
|
238 kumpf 1.39 if ((request == 0) ||
239 (request->getType() != async_messages::ASYNC_LEGACY_OP_START))
|
240 chip 1.1 {
241 // reply with NAK
242 PEG_METHOD_EXIT();
243 return(PEGASUS_THREAD_RETURN(0));
244 }
245
|
246 chip 1.8 try
|
247 chip 1.1 {
|
248 kumpf 1.39 Message* legacy =
249 static_cast<AsyncLegacyOperationStart *>(request)->get_action();
|
250 chip 1.1
|
251 chip 1.8 if(_isSupportedRequestType(legacy))
|
252 chip 1.1 {
|
253 a.arora 1.37 AutoPtr<Message> xmessage(legacy);
|
254 chip 1.1
|
255 chip 1.8 // Set the client's requested language into this service thread.
256 // This will allow functions in this service to return messages
257 // in the correct language.
|
258 kumpf 1.39 CIMMessage* msg = dynamic_cast<CIMMessage *>(legacy);
|
259 chip 1.8
|
260 kumpf 1.39 if (msg != 0)
|
261 chip 1.8 {
|
262 se.gupta 1.48 AcceptLanguages* langs =
263 new AcceptLanguages(((AcceptLanguageListContainer)msg->operationContext.get
264 (AcceptLanguageListContainer::NAME)).getLanguages());
|
265 chip 1.8 Thread::setLanguages(langs);
266 }
267 else
268 {
269 Thread::clearLanguages();
270 }
|
271 chip 1.1
272 service->handleCimRequest(op, legacy);
|
273 chip 1.3 }
|
274 chip 1.8 }
275 catch(...)
276 {
277 // ATTN: log error
|
278 chip 1.1 }
279
280 PEG_METHOD_EXIT();
281
282 return(PEGASUS_THREAD_RETURN(0));
283 }
284
|
285 kumpf 1.39 void ProviderManagerService::handleCimRequest(
286 AsyncOpNode * op,
287 Message * message)
|
288 chip 1.1 {
|
289 kumpf 1.39 PEG_METHOD_ENTER(TRC_PROVIDERMANAGER,
290 "ProviderManagerService::handleCimRequest");
|
291 chip 1.1
|
292 kumpf 1.38 CIMRequestMessage * request = dynamic_cast<CIMRequestMessage *>(message);
293 PEGASUS_ASSERT(request != 0);
|
294 chip 1.1
295 // get request from op node
296 AsyncRequest * async = static_cast<AsyncRequest *>(op->_request.next(0));
|
297 kumpf 1.38 PEGASUS_ASSERT(async != 0);
298
299 Message * response = 0;
|
300 chip 1.1
|
301 kumpf 1.38 if ((dynamic_cast<CIMOperationRequestMessage*>(request) != 0) ||
|
302 kumpf 1.46 (dynamic_cast<CIMIndicationRequestMessage*>(request) != 0) ||
|
303 kumpf 1.40 (request->getType() == CIM_EXPORT_INDICATION_REQUEST_MESSAGE) ||
|
304 kumpf 1.45 (request->getType() == CIM_INITIALIZE_PROVIDER_REQUEST_MESSAGE))
|
305 kumpf 1.38 {
|
306 kumpf 1.45 // Handle CIMOperationRequestMessage, CIMExportIndicationRequestMessage,
|
307 kumpf 1.46 // CIMIndicationRequestMessage, and CIMInitializeProviderRequestMessage.
308 // (These should be blocked when the provider module is disabled.)
|
309 kumpf 1.45
|
310 kumpf 1.46 //
311 // Get the provider module instance to check for a disabled module
312 //
313 CIMInstance providerModule;
|
314 kumpf 1.45
|
315 kumpf 1.54 if (request->getType() == CIM_EXPORT_INDICATION_REQUEST_MESSAGE)
316 {
317 // Get a ProviderIdContainer for ExportIndicationRequestMessage.
318 // Note: This can be removed when the CIMExportRequestDispatcher
319 // is updated to add the ProviderIdContainer to the message.
320 CIMInstance provider;
321 const CIMExportIndicationRequestMessage* expRequest =
322 dynamic_cast<const CIMExportIndicationRequestMessage*>(request);
323 _providerRegistrationManager->lookupIndicationConsumer(
324 expRequest->destinationPath, provider, providerModule);
325 request->operationContext.insert(
326 ProviderIdContainer(providerModule, provider));
|
327 kumpf 1.46 }
328 else
329 {
330 // The provider ID container is added to the OperationContext
331 // by the CIMOperationRequestDispatcher for all CIM operation
332 // requests to providers, so it does not need to be added again.
333 // CIMInitializeProviderRequestMessage also has a provider ID
334 // container.
335 ProviderIdContainer pidc =
336 request->operationContext.get(ProviderIdContainer::NAME);
337 providerModule = pidc.getModule();
|
338 kumpf 1.45 }
|
339 kumpf 1.38
|
340 kumpf 1.45 //
341 // Check if the target provider is disabled
342 //
343 Boolean moduleDisabled = false;
344 Uint32 pos = providerModule.findProperty(CIMName("OperationalStatus"));
345 PEGASUS_ASSERT(pos != PEG_NOT_FOUND);
346 Array<Uint16> operationalStatus;
347 providerModule.getProperty(pos).getValue().get(operationalStatus);
348
349 for(Uint32 i = 0; i < operationalStatus.size(); i++)
350 {
|
351 kumpf 1.50 if ((operationalStatus[i] == CIM_MSE_OPSTATUS_VALUE_STOPPED) ||
352 (operationalStatus[i] == CIM_MSE_OPSTATUS_VALUE_STOPPING))
|
353 kumpf 1.45 {
354 moduleDisabled = true;
355 break;
356 }
357 }
358
359 if (moduleDisabled)
360 {
361 //
362 // Send a "provider blocked" response
363 //
364 CIMResponseMessage* cimResponse = request->buildResponse();
365 cimResponse->cimException = PEGASUS_CIM_EXCEPTION_L(
366 CIM_ERR_ACCESS_DENIED,
367 MessageLoaderParms(
368 "ProviderManager.ProviderManagerService.PROVIDER_BLOCKED",
369 "provider blocked."));
370 response = cimResponse;
371 }
372 else
373 {
374 kumpf 1.45 //
375 // Forward the request to the appropriate ProviderManagerRouter
376 //
377 response = _providerManagerRouter->processMessage(request);
378 }
|
379 schuur 1.19 }
|
380 kumpf 1.38 else if (request->getType() == CIM_ENABLE_MODULE_REQUEST_MESSAGE)
381 {
382 // Handle CIMEnableModuleRequestMessage
383 CIMEnableModuleRequestMessage * emReq =
384 dynamic_cast<CIMEnableModuleRequestMessage*>(request);
385
386 CIMInstance providerModule = emReq->providerModule;
|
387 dj.gorey 1.31
|
388 kumpf 1.38 try
389 {
|
390 kumpf 1.39 // Forward the request to the ProviderManager
391 response = _providerManagerRouter->processMessage(request);
|
392 kumpf 1.38
393 // If successful, update provider module status to OK
394 // ATTN: Use CIMEnableModuleResponseMessage operationalStatus?
395 CIMEnableModuleResponseMessage * emResp =
396 dynamic_cast<CIMEnableModuleResponseMessage*>(response);
397 if (emResp->cimException.getCode() == CIM_ERR_SUCCESS)
398 {
399 _updateProviderModuleStatus(
|
400 kumpf 1.50 providerModule, CIM_MSE_OPSTATUS_VALUE_STOPPED,
401 CIM_MSE_OPSTATUS_VALUE_OK);
|
402 kumpf 1.38 }
403 }
404 catch (Exception& e)
405 {
406 // Get the OperationalStatus property from the provider module
407 Array<Uint16> operationalStatus;
408 CIMValue itValue = emReq->providerModule.getProperty(
409 emReq->providerModule.findProperty("OperationalStatus"))
410 .getValue();
411 itValue.get(operationalStatus);
412
413 if (response != 0)
414 {
415 delete response;
416 }
417
418 response = new CIMEnableModuleResponseMessage(
419 request->messageId,
420 CIMException(CIM_ERR_FAILED, e.getMessage()),
421 request->queueIds.copyAndPop(),
422 operationalStatus);
423 kumpf 1.38 }
424 }
425 else if (request->getType() == CIM_DISABLE_MODULE_REQUEST_MESSAGE)
426 {
427 // Handle CIMDisableModuleRequestMessage
428 CIMDisableModuleRequestMessage * dmReq =
429 dynamic_cast<CIMDisableModuleRequestMessage*>(request);
430
431 CIMInstance providerModule = dmReq->providerModule;
432 Boolean updateModuleStatus = !dmReq->disableProviderOnly;
433
434 try
435 {
436 // Change module status from OK to STOPPING
437 if (updateModuleStatus)
438 {
439 _updateProviderModuleStatus(
|
440 kumpf 1.50 providerModule, CIM_MSE_OPSTATUS_VALUE_OK,
441 CIM_MSE_OPSTATUS_VALUE_STOPPING);
|
442 kumpf 1.38 }
443
|
444 kumpf 1.39 // Forward the request to the ProviderManager
445 response = _providerManagerRouter->processMessage(request);
|
446 kumpf 1.38
447 // Update provider module status based on success or failure
448 if (updateModuleStatus)
449 {
450 CIMDisableModuleResponseMessage * dmResp =
451 dynamic_cast<CIMDisableModuleResponseMessage*>(response);
452 if (dmResp->cimException.getCode() != CIM_ERR_SUCCESS)
453 {
454 // Disable operation failed. Module not stopped.
455 _updateProviderModuleStatus(
|
456 kumpf 1.50 providerModule, CIM_MSE_OPSTATUS_VALUE_STOPPING,
457 CIM_MSE_OPSTATUS_VALUE_OK);
|
458 kumpf 1.38 }
459 else
460 {
461 // Disable may or may not have been successful,
462 // depending on whether there are outstanding requests.
463 // Use last operationalStatus entry.
464 _updateProviderModuleStatus(
|
465 kumpf 1.50 providerModule, CIM_MSE_OPSTATUS_VALUE_STOPPING,
|
466 kumpf 1.38 dmResp->operationalStatus[
467 dmResp->operationalStatus.size()-1]);
468 }
469 }
470 }
471 catch (Exception& e)
472 {
473 // Get the OperationalStatus property from the provider module
474 Array<Uint16> operationalStatus;
475 CIMValue itValue = dmReq->providerModule.getProperty(
476 dmReq->providerModule.findProperty("OperationalStatus"))
477 .getValue();
478 itValue.get(operationalStatus);
479
480 if (response != 0)
481 {
482 delete response;
483 }
484
485 response = new CIMDisableModuleResponseMessage(
486 request->messageId,
487 kumpf 1.38 CIMException(CIM_ERR_FAILED, e.getMessage()),
488 request->queueIds.copyAndPop(),
489 operationalStatus);
490 }
491 }
492 else
493 {
|
494 kumpf 1.39 response = _providerManagerRouter->processMessage(request);
|
495 schuur 1.23 }
|
496 chip 1.13
|
497 schuur 1.19 AsyncLegacyOperationResult * async_result =
498 new AsyncLegacyOperationResult(
499 async->getKey(),
500 async->getRouting(),
501 op,
502 response);
|
503 chip 1.13
|
504 schuur 1.19 _complete_op_node(op, ASYNC_OPSTATE_COMPLETE, 0, 0);
|
505 chip 1.13
|
506 schuur 1.19 PEG_METHOD_EXIT();
507 }
|
508 chip 1.13
|
509 kumpf 1.44 void ProviderManagerService::unloadIdleProviders()
510 {
511 PEG_METHOD_ENTER(TRC_PROVIDERMANAGER,
512 "ProviderManagerService::unloadIdleProviders");
513
514 // Ensure that only one _unloadIdleProvidersHandler thread runs at a time
515 _unloadIdleProvidersBusy++;
516 if ((_unloadIdleProvidersBusy.value() == 1) &&
517 (_thread_pool->allocate_and_awaken(
518 (void*)this, ProviderManagerService::_unloadIdleProvidersHandler)))
519 {
520 // _unloadIdleProvidersBusy is decremented in
521 // _unloadIdleProvidersHandler
522 }
523 else
524 {
525 // If we fail to allocate a thread, don't retry now.
526 _unloadIdleProvidersBusy--;
527 }
528
529 PEG_METHOD_EXIT();
530 kumpf 1.44 }
531
532 PEGASUS_THREAD_RETURN PEGASUS_THREAD_CDECL
533 ProviderManagerService::_unloadIdleProvidersHandler(void* arg) throw()
|
534 chip 1.1 {
|
535 kumpf 1.44 try
536 {
537 PEG_METHOD_ENTER(TRC_PROVIDERMANAGER,
538 "ProviderManagerService::unloadIdleProvidersHandler");
539
540 ProviderManagerService* myself =
541 reinterpret_cast<ProviderManagerService*>(arg);
542
543 try
544 {
545 myself->_providerManagerRouter->unloadIdleProviders();
546 }
547 catch (...)
548 {
549 // Ignore errors
550 PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL2,
551 "Unexpected exception in _unloadIdleProvidersHandler");
552 }
553
554 myself->_unloadIdleProvidersBusy--;
555 PEG_METHOD_EXIT();
556 kumpf 1.44 }
557 catch (...)
558 {
559 // Ignore errors
560 PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL2,
561 "Unexpected exception in _unloadIdleProvidersHandler");
562 }
563
564 return(PEGASUS_THREAD_RETURN(0));
|
565 kumpf 1.38 }
566
567 // Updates the providerModule instance and the ProviderRegistrationManager
568 void ProviderManagerService::_updateProviderModuleStatus(
569 CIMInstance& providerModule,
570 Uint16 fromStatus,
571 Uint16 toStatus)
572 {
573 PEG_METHOD_ENTER(TRC_PROVIDERMANAGER,
574 "ProviderManagerService::_updateProviderModuleStatus");
575
576 Array<Uint16> operationalStatus;
577 String providerModuleName;
578
579 Uint32 pos = providerModule.findProperty(CIMName("Name"));
580 PEGASUS_ASSERT(pos != PEG_NOT_FOUND);
581 providerModule.getProperty(pos).getValue().get(providerModuleName);
582
583 //
584 // get operational status
585 //
586 kumpf 1.38 pos = providerModule.findProperty(CIMName("OperationalStatus"));
587 PEGASUS_ASSERT(pos != PEG_NOT_FOUND);
588 CIMProperty operationalStatusProperty = providerModule.getProperty(pos);
589 CIMValue operationalStatusValue = operationalStatusProperty.getValue();
590
591 if (!operationalStatusValue.isNull())
592 {
593 operationalStatusValue.get(operationalStatus);
594 }
595
596 //
597 // update module status
598 //
599 for (Uint32 i = operationalStatus.size(); i > 0; i--)
600 {
601 if (operationalStatus[i-1] == fromStatus)
602 {
603 operationalStatus.remove(i-1);
604 }
605 }
606
607 kumpf 1.38 operationalStatus.append(toStatus);
608
609 if (_providerRegistrationManager->setProviderModuleStatus(
610 providerModuleName, operationalStatus) == false)
611 {
612 throw PEGASUS_CIM_EXCEPTION_L(
613 CIM_ERR_FAILED,
614 MessageLoaderParms(
615 "ProviderManager.ProviderManagerService."
616 "SET_MODULE_STATUS_FAILED",
617 "set module status failed."));
618 }
619
620 operationalStatusProperty.setValue(CIMValue(operationalStatus));
621
622 PEG_METHOD_EXIT();
|
623 kumpf 1.39 }
624
625 void ProviderManagerService::indicationCallback(
626 CIMProcessIndicationRequestMessage* request)
627 {
|
628 se.gupta 1.52 try
629 {
630 AcceptLanguageListContainer cntr = request->operationContext.get(AcceptLanguageListContainer::NAME);
|
631 david.dillard 1.55 }catch(const Exception &)
|
632 se.gupta 1.52 {
633 request->operationContext.insert(AcceptLanguageListContainer(AcceptLanguages::EMPTY));
634 }
635
636 if (_indicationServiceQueueId == PEG_NOT_FOUND)
|
637 kumpf 1.39 {
638 Array<Uint32> serviceIds;
639
640 providerManagerService->find_services(
641 PEGASUS_QUEUENAME_INDICATIONSERVICE, 0, 0, &serviceIds);
642 PEGASUS_ASSERT(serviceIds.size() != 0);
643
644 _indicationServiceQueueId = serviceIds[0];
645 }
646
647 request->queueIds = QueueIdStack(
648 _indicationServiceQueueId, providerManagerService->getQueueId());
649
650 AsyncLegacyOperationStart * asyncRequest =
651 new AsyncLegacyOperationStart(
652 providerManagerService->get_next_xid(),
653 0,
654 _indicationServiceQueueId,
655 request,
656 _indicationServiceQueueId);
657
658 kumpf 1.39 providerManagerService->SendForget(asyncRequest);
|
659 chip 1.1 }
660
|
661 a.arora 1.37 PEGASUS_NAMESPACE_END
|