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