1 chip 1.1 //%/////////////////////////////////////////////////////////////////////////////
2 //
3 // Copyright (c) 2000 - 2003 BMC Software, Hewlett-Packard Company, IBM,
4 // The Open Group, Tivoli Systems
5 //
6 // Permission is hereby granted, free of charge, to any person obtaining a copy
7 // of this software and associated documentation files (the "Software"), to
8 // deal in the Software without restriction, including without limitation the
9 // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
10 // sell copies of the Software, and to permit persons to whom the Software is
11 // furnished to do so, subject to the following conditions:
12 //
13 // THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
14 // ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED
15 // "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
16 // LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
17 // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
18 // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
19 // ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21 //
22 chip 1.1 //==============================================================================
23 //
24 // Author: Chip Vincent (cvincent@us.ibm.com)
25 //
26 // Modified By: Carol Ann Krug Graves, Hewlett-Packard Company
27 // (carolann_graves@hp.com)
28 // Mike Day, IBM (mdday@us.ibm.com)
29 // Karl Schopmeyer(k.schopmeyer@opengroup.org) - Fix associators.
30 // Yi Zhou, Hewlett-Packard Company (yi_zhou@hp.com)
31 //
32 //%/////////////////////////////////////////////////////////////////////////////
33
34 #include "DefaultProviderManager.h"
35
36 #include <Pegasus/Common/CIMMessage.h>
37 #include <Pegasus/Common/OperationContext.h>
38 #include <Pegasus/Common/Destroyer.h>
39 #include <Pegasus/Common/Tracer.h>
40 #include <Pegasus/Common/StatisticalData.h>
41 #include <Pegasus/Common/Logger.h>
42 #include <Pegasus/Common/MessageLoader.h> //l10n
43 chip 1.1
44 #include <Pegasus/Config/ConfigManager.h>
45
46 #include <Pegasus/ProviderManager2/Default/Provider.h>
47 #include <Pegasus/ProviderManager2/Default/OperationResponseHandler.h>
48
49 #include <Pegasus/Server/ProviderRegistrationManager/ProviderRegistrationManager.h>
50
51 PEGASUS_NAMESPACE_BEGIN
52
53 // auto variable to protect provider during operations
54 class pm_service_op_lock
55 {
56 private:
57 pm_service_op_lock(void);
58
59 public:
60 pm_service_op_lock(Provider *provider) : _provider(provider)
61 {
62 _provider->protect();
63 }
64 chip 1.1
65 ~pm_service_op_lock(void)
66 {
67 _provider->unprotect();
68 }
69
70 Provider * _provider;
71 };
72
73 //
74 // Provider module status
75 //
76 static const Uint16 _MODULE_OK = 2;
77 static const Uint16 _MODULE_STOPPING = 9;
78 static const Uint16 _MODULE_STOPPED = 10;
79
80 // provider manager
81 LocalProviderManager providerManager;
82
83 DefaultProviderManager::DefaultProviderManager(void)
84 {
85 chip 1.1 }
86
87 DefaultProviderManager::~DefaultProviderManager(void)
88 {
89 }
90
|
91 kumpf 1.3 Message * DefaultProviderManager::processMessage(Message * request) throw()
|
92 chip 1.1 {
93 PEG_METHOD_ENTER(TRC_PROVIDERMANAGER,
94 "DefaultProviderManager::processMessage()");
95
96 Message * response = 0;
97
98 // pass the request message to a handler method based on message type
99 switch(request->getType())
100 {
101 case CIM_GET_INSTANCE_REQUEST_MESSAGE:
102 response = handleGetInstanceRequest(request);
103
104 break;
105 case CIM_ENUMERATE_INSTANCES_REQUEST_MESSAGE:
106 response = handleEnumerateInstancesRequest(request);
107
108 break;
109 case CIM_ENUMERATE_INSTANCE_NAMES_REQUEST_MESSAGE:
110 response = handleEnumerateInstanceNamesRequest(request);
111
112 break;
113 chip 1.1 case CIM_CREATE_INSTANCE_REQUEST_MESSAGE:
114 response = handleCreateInstanceRequest(request);
115
116 break;
117 case CIM_MODIFY_INSTANCE_REQUEST_MESSAGE:
118 response = handleModifyInstanceRequest(request);
119
120 break;
121 case CIM_DELETE_INSTANCE_REQUEST_MESSAGE:
122 response = handleDeleteInstanceRequest(request);
123
124 break;
125 case CIM_EXEC_QUERY_REQUEST_MESSAGE:
126 response = handleExecuteQueryRequest(request);
127
128 break;
129 case CIM_ASSOCIATORS_REQUEST_MESSAGE:
130 response = handleAssociatorsRequest(request);
131
132 break;
133 case CIM_ASSOCIATOR_NAMES_REQUEST_MESSAGE:
134 chip 1.1 response = handleAssociatorNamesRequest(request);
135
136 break;
137 case CIM_REFERENCES_REQUEST_MESSAGE:
138 response = handleReferencesRequest(request);
139
140 break;
141 case CIM_REFERENCE_NAMES_REQUEST_MESSAGE:
142 response = handleReferenceNamesRequest(request);
143
144 break;
145 case CIM_GET_PROPERTY_REQUEST_MESSAGE:
146 response = handleGetPropertyRequest(request);
147
148 break;
149 case CIM_SET_PROPERTY_REQUEST_MESSAGE:
150 response = handleSetPropertyRequest(request);
151
152 break;
153 case CIM_INVOKE_METHOD_REQUEST_MESSAGE:
154 response = handleInvokeMethodRequest(request);
155 chip 1.1
156 break;
157 case CIM_CREATE_SUBSCRIPTION_REQUEST_MESSAGE:
158 response = handleCreateSubscriptionRequest(request);
159
160 break;
161 case CIM_MODIFY_SUBSCRIPTION_REQUEST_MESSAGE:
162 response = handleModifySubscriptionRequest(request);
163
164 break;
165 case CIM_DELETE_SUBSCRIPTION_REQUEST_MESSAGE:
166 response = handleDeleteSubscriptionRequest(request);
167
168 break;
169 case CIM_ENABLE_INDICATIONS_REQUEST_MESSAGE:
170 response = handleEnableIndicationsRequest(request);
171
172 break;
173 case CIM_DISABLE_INDICATIONS_REQUEST_MESSAGE:
174 response = handleDisableIndicationsRequest(request);
175
176 chip 1.1 break;
177 case CIM_CONSUME_INDICATION_REQUEST_MESSAGE:
178 response = handleConsumeIndicationRequest(request);
179 break;
180
181 case CIM_DISABLE_MODULE_REQUEST_MESSAGE:
182 response = handleDisableModuleRequest(request);
183
184 break;
185 case CIM_ENABLE_MODULE_REQUEST_MESSAGE:
186 response = handleEnableModuleRequest(request);
187
188 break;
189 case CIM_STOP_ALL_PROVIDERS_REQUEST_MESSAGE:
190 response = handleStopAllProvidersRequest(request);
191
192 break;
193 default:
194 response = handleUnsupportedRequest(request);
195
196 break;
197 chip 1.1 }
198
199 PEG_METHOD_EXIT();
200
201 return(response);
202 }
203
204 Message * DefaultProviderManager::handleUnsupportedRequest(const Message * message) throw()
205 {
206 PEG_METHOD_ENTER(TRC_PROVIDERMANAGER, "DefaultProviderManager::handleUnsupportedRequest");
207
208 PEG_METHOD_EXIT();
209
210 // a null response implies unsupported or unknown operation
211 return(0);
212 }
213
214 Message * DefaultProviderManager::handleGetInstanceRequest(const Message * message) throw()
215 {
216 PEG_METHOD_ENTER(TRC_PROVIDERMANAGER, "DefaultProviderManager::handleGetInstanceRequest");
217
218 chip 1.1 CIMGetInstanceRequestMessage * request =
219 dynamic_cast<CIMGetInstanceRequestMessage *>(const_cast<Message *>(message));
220
221 PEGASUS_ASSERT(request != 0);
222
223 CIMGetInstanceResponseMessage * response =
224 new CIMGetInstanceResponseMessage(
225 request->messageId,
226 CIMException(),
227 request->queueIds.copyAndPop(),
228 CIMInstance());
229
230 PEGASUS_ASSERT(response != 0);
231
232 // preserve message key
233 response->setKey(request->getKey());
234
235 // Set HTTP method in response from request
236 response->setHttpMethod(request->getHttpMethod());
237
238 // create a handler for this request
239 chip 1.1 GetInstanceResponseHandler handler(request, response);
240
241 try
242 {
243 Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE,
244 "DefaultProviderManager::handleGetInstanceRequest - Host name: $0 Name space: $1 Class name: $2",
245 System::getHostName(),
246 request->nameSpace.getString(),
247 request->instanceName.getClassName().getString());
248
249 // make target object path
250 CIMObjectPath objectPath(
251 System::getHostName(),
252 request->nameSpace,
253 request->instanceName.getClassName(),
254 request->instanceName.getKeyBindings());
255
|
256 chip 1.4 ProviderName name(
257 objectPath.toString(),
|
258 chip 1.1 String::EMPTY,
259 String::EMPTY,
|
260 chip 1.4 String::EMPTY,
261 0);
|
262 chip 1.1
|
263 chip 1.5 // resolve provider name
264 name = _resolveProviderName(name);
|
265 chip 1.1
266 // get cached or load new provider module
267 OpProviderHolder ph =
268 providerManager.getProvider(name.getPhysicalName(), name.getLogicalName(), String::EMPTY);
269
270 // convert arguments
271 OperationContext context;
272
273 context.insert(IdentityContainer(request->userName));
274 context.insert(AcceptLanguageListContainer(request->acceptLanguages));
275 context.insert(ContentLanguageListContainer(request->contentLanguages));
276
277 CIMPropertyList propertyList(request->propertyList);
278
279 // forward request
280 PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
281 "Calling provider.getInstance: " +
282 ph.GetProvider().getName());
283
284 pm_service_op_lock op_lock(&ph.GetProvider());
285
286 chip 1.1 STAT_GETSTARTTIME;
287
288 ph.GetProvider().getInstance(
289 context,
290 objectPath,
291 request->includeQualifiers,
292 request->includeClassOrigin,
293 propertyList,
294 handler);
295
296 STAT_PMS_PROVIDEREND;
297 }
298 catch(CIMException & e)
299 {
300 PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
301 "Exception: " + e.getMessage());
302
303 handler.setStatus(e.getCode(), e.getContentLanguages(), e.getMessage()); // l10n
304 }
305 catch(Exception & e)
306 {
307 chip 1.1 PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
308 "Exception: " + e.getMessage());
|
309 chip 1.2
|
310 chip 1.1 handler.setStatus(CIM_ERR_FAILED, e.getContentLanguages(), e.getMessage()); // l10n
311 }
312 catch(...)
313 {
314 PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
315 "Exception: Unknown");
|
316 chip 1.2
|
317 chip 1.1 handler.setStatus(CIM_ERR_FAILED, "Unknown error.");
318 }
319
320 PEG_METHOD_EXIT();
321
322 return(response);
323 }
324
325 Message * DefaultProviderManager::handleEnumerateInstancesRequest(const Message * message) throw()
326 {
327 PEG_METHOD_ENTER(TRC_PROVIDERMANAGER, "DefaultProviderManager::handleEnumerateInstanceRequest");
328
329 CIMEnumerateInstancesRequestMessage * request =
330 dynamic_cast<CIMEnumerateInstancesRequestMessage *>(const_cast<Message *>(message));
331
332 PEGASUS_ASSERT(request != 0);
333
334 CIMEnumerateInstancesResponseMessage * response =
335 new CIMEnumerateInstancesResponseMessage(
336 request->messageId,
337 CIMException(),
338 chip 1.1 request->queueIds.copyAndPop(),
339 Array<CIMInstance>());
340
341 PEGASUS_ASSERT(response != 0);
342
343 // preserve message key
344 response->setKey(request->getKey());
345
346 // Set HTTP method in response from request
347 response->setHttpMethod (request->getHttpMethod ());
348
349 // create a handler for this request
350 EnumerateInstancesResponseHandler handler(request, response);
351
352 try
353 {
354 Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE,
355 "DefaultProviderManager::handleEnumerateInstancesRequest - Host name: $0 Name space: $1 Class name: $2",
356 System::getHostName(),
357 request->nameSpace.getString(),
358 request->className.getString());
359 chip 1.1
360 // make target object path
361 CIMObjectPath objectPath(
362 System::getHostName(),
363 request->nameSpace,
364 request->className);
365
|
366 chip 1.4 ProviderName name(
367 objectPath.toString(),
|
368 chip 1.1 String::EMPTY,
369 String::EMPTY,
|
370 chip 1.4 String::EMPTY,
371 0);
|
372 chip 1.1
|
373 chip 1.5 // resolve provider name
374 name = _resolveProviderName(name);
|
375 chip 1.1
376 // get cached or load new provider module
377 OpProviderHolder ph =
378 providerManager.getProvider(name.getPhysicalName(), name.getLogicalName(), String::EMPTY);
379
380 // convert arguments
381 OperationContext context;
382
383 context.insert(IdentityContainer(request->userName));
384 context.insert(AcceptLanguageListContainer(request->acceptLanguages));
385 context.insert(ContentLanguageListContainer(request->contentLanguages));
386
387 CIMPropertyList propertyList(request->propertyList);
388
389 // forward request
390 PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
391 "Calling provider.enumerateInstances: " +
392 ph.GetProvider().getName());
393
394 pm_service_op_lock op_lock(&ph.GetProvider());
395
396 chip 1.1 STAT_GETSTARTTIME;
397
398 ph.GetProvider().enumerateInstances(
399 context,
400 objectPath,
401 request->includeQualifiers,
402 request->includeClassOrigin,
403 propertyList,
404 handler);
405
406 STAT_PMS_PROVIDEREND;
407 }
408 catch(CIMException & e)
409 {
410 PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
411 "Exception: " + e.getMessage());
|
412 chip 1.2
|
413 chip 1.1 handler.setStatus(e.getCode(), e.getContentLanguages(), e.getMessage()); // l10n
414 }
415 catch(Exception & e)
416 {
417 PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
418 "Exception: " + e.getMessage());
|
419 chip 1.2
|
420 chip 1.1 handler.setStatus(CIM_ERR_FAILED, e.getContentLanguages(), e.getMessage()); // l10n
421 }
422 catch(...)
423 {
424 PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
425 "Exception: Unknown");
|
426 chip 1.2
|
427 chip 1.1 handler.setStatus(CIM_ERR_FAILED, "Unknown error.");
428 }
429
430 PEG_METHOD_EXIT();
431
432 return(response);
433 }
434
435 Message * DefaultProviderManager::handleEnumerateInstanceNamesRequest(const Message * message) throw()
436 {
437 PEG_METHOD_ENTER(TRC_PROVIDERMANAGER, "DefaultProviderManager::handleEnumerateInstanceNamesRequest");
438
439 CIMEnumerateInstanceNamesRequestMessage * request =
440 dynamic_cast<CIMEnumerateInstanceNamesRequestMessage *>(const_cast<Message *>(message));
441
442 PEGASUS_ASSERT(request != 0);
443
444 CIMEnumerateInstanceNamesResponseMessage * response =
445 new CIMEnumerateInstanceNamesResponseMessage(
446 request->messageId,
447 CIMException(),
448 chip 1.1 request->queueIds.copyAndPop(),
449 Array<CIMObjectPath>());
450
451 PEGASUS_ASSERT(response != 0);
452
453 // preserve message key
454 response->setKey(request->getKey());
455
456 //set HTTP method in response from request
457 response->setHttpMethod(request->getHttpMethod());;
458
459 // create a handler for this request
460 EnumerateInstanceNamesResponseHandler handler(request, response);
461
462 // process the request
463 try
464 {
465 Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE,
466 "DefaultProviderManager::handleEnumerateInstanceNamesRequest - Host name: $0 Name space: $1 Class name: $2",
467 System::getHostName(),
468 request->nameSpace.getString(),
469 chip 1.1 request->className.getString());
470
471 // make target object path
472 CIMObjectPath objectPath(
473 System::getHostName(),
474 request->nameSpace,
475 request->className);
476
477 // build an internal provider name from the request arguments
|
478 chip 1.4 ProviderName name(
479 objectPath.toString(),
|
480 chip 1.1 String::EMPTY,
481 String::EMPTY,
|
482 chip 1.4 String::EMPTY,
483 0);
|
484 chip 1.1
|
485 chip 1.5 // resolve provider name
486 name = _resolveProviderName(name);
|
487 chip 1.1
488 // get cached or load new provider module
489 OpProviderHolder ph =
490 providerManager.getProvider(name.getPhysicalName(), name.getLogicalName());
491
492 // convert arguments
493 OperationContext context;
494
495 context.insert(IdentityContainer(request->userName));
496 context.insert(AcceptLanguageListContainer(request->acceptLanguages));
497 context.insert(ContentLanguageListContainer(request->contentLanguages));
498
499 // forward request
500 PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
501 "Calling provider.enumerateInstanceNames: " +
502 ph.GetProvider().getName());
503
504 pm_service_op_lock op_lock(&ph.GetProvider());
505
506 STAT_GETSTARTTIME;
507
508 chip 1.1 ph.GetProvider().enumerateInstanceNames(
509 context,
510 objectPath,
511 handler);
512
513 STAT_PMS_PROVIDEREND;
514 }
515 catch(CIMException & e)
516 {
517 PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
518 "Exception: " + e.getMessage());
|
519 chip 1.2
|
520 chip 1.1 handler.setStatus(e.getCode(), e.getContentLanguages(), e.getMessage()); // l10n
521 }
522 catch(Exception & e)
523 {
524 PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
525 "Exception: " + e.getMessage());
|
526 chip 1.2
|
527 chip 1.1 handler.setStatus(CIM_ERR_FAILED, e.getContentLanguages(), e.getMessage()); // l10n
528 }
529 catch(...)
530 {
531 PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
532 "Exception: Unknown");
|
533 chip 1.2
|
534 chip 1.1 handler.setStatus(CIM_ERR_FAILED, "Unknown error.");
535 }
536
537 PEG_METHOD_EXIT();
538
539 return(response);
540 }
541
542 Message * DefaultProviderManager::handleCreateInstanceRequest(const Message * message) throw()
543 {
544 PEG_METHOD_ENTER(TRC_PROVIDERMANAGER, "DefaultProviderManager::handleCreateInstanceRequest");
545
546 CIMCreateInstanceRequestMessage * request =
547 dynamic_cast<CIMCreateInstanceRequestMessage *>(const_cast<Message *>(message));
548
549 PEGASUS_ASSERT(request != 0);
550
551 // create response message
552 CIMCreateInstanceResponseMessage * response =
553 new CIMCreateInstanceResponseMessage(
554 request->messageId,
555 chip 1.1 CIMException(),
556 request->queueIds.copyAndPop(),
557 CIMObjectPath());
558
559 PEGASUS_ASSERT(response != 0);
560
561 // preserve message key
562 response->setKey(request->getKey());
563
564 // Set HTTP method in response from request
565 response->setHttpMethod (request->getHttpMethod ());
566
567 // create a handler for this request
568 CreateInstanceResponseHandler handler(request, response);
569
570 try
571 {
572 Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE,
573 "DefaultProviderManager::handleCreateInstanceRequest - Host name: $0 Name space: $1 Class name: $2",
574 System::getHostName(),
575 request->nameSpace.getString(),
576 chip 1.1 request->newInstance.getPath().getClassName().getString());
577
578 // make target object path
579 CIMObjectPath objectPath(
580 System::getHostName(),
581 request->nameSpace,
582 request->newInstance.getPath().getClassName(),
583 request->newInstance.getPath().getKeyBindings());
584
|
585 chip 1.4 ProviderName name(
586 objectPath.toString(),
|
587 chip 1.1 String::EMPTY,
588 String::EMPTY,
|
589 chip 1.4 String::EMPTY,
590 0);
|
591 chip 1.1
|
592 chip 1.5 // resolve provider name
593 name = _resolveProviderName(name);
|
594 chip 1.1
595 // get cached or load new provider module
596 OpProviderHolder ph =
597 providerManager.getProvider(name.getPhysicalName(), name.getLogicalName(), String::EMPTY);
598
599 // convert arguments
600 OperationContext context;
601
602 context.insert(IdentityContainer(request->userName));
603 context.insert(AcceptLanguageListContainer(request->acceptLanguages));
604 context.insert(ContentLanguageListContainer(request->contentLanguages));
605
606 // forward request
607 PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
608 "Calling provider.createInstance: " +
609 ph.GetProvider().getName());
610
611 pm_service_op_lock op_lock(&ph.GetProvider());
612
613 STAT_GETSTARTTIME;
614
615 chip 1.1 ph.GetProvider().createInstance(
616 context,
617 objectPath,
618 request->newInstance,
619 handler);
620
621 STAT_PMS_PROVIDEREND;
622 }
623 catch(CIMException & e)
624 {
625 PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
626 "Exception: " + e.getMessage());
|
627 chip 1.2
|
628 chip 1.1 handler.setStatus(e.getCode(), e.getContentLanguages(), e.getMessage()); // l10n
629 }
630 catch(Exception & e)
631 {
632 PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
633 "Exception: " + e.getMessage());
|
634 chip 1.2
|
635 chip 1.1 handler.setStatus(CIM_ERR_FAILED, e.getContentLanguages(), e.getMessage()); // l10n
636 }
637 catch(...)
638 {
639 PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
640 "Exception: Unknown");
|
641 chip 1.2
|
642 chip 1.1 handler.setStatus(CIM_ERR_FAILED, "Unknown error.");
643 }
644
645 PEG_METHOD_EXIT();
646
647 return(response);
648 }
649
650 Message * DefaultProviderManager::handleModifyInstanceRequest(const Message * message) throw()
651 {
652 PEG_METHOD_ENTER(TRC_PROVIDERMANAGER, "DefaultProviderManager::handleModifyInstanceRequest");
653
654 CIMModifyInstanceRequestMessage * request =
655 dynamic_cast<CIMModifyInstanceRequestMessage *>(const_cast<Message *>(message));
656
657 PEGASUS_ASSERT(request != 0);
658
659 // create response message
660 CIMModifyInstanceResponseMessage * response =
661 new CIMModifyInstanceResponseMessage(
662 request->messageId,
663 chip 1.1 CIMException(),
664 request->queueIds.copyAndPop());
665
666 PEGASUS_ASSERT(response != 0);
667
668 // preserve message key
669 response->setKey(request->getKey());
670
671 // Set HTTP method in response from request
672 response->setHttpMethod (request->getHttpMethod ());
673
674 // create a handler for this request
675 ModifyInstanceResponseHandler handler(request, response);
676
677 try
678 {
679 Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE,
680 "DefaultProviderManager::handleModifyInstanceRequest - Host name: $0 Name space: $1 Class name: $2",
681 System::getHostName(),
682 request->nameSpace.getString(),
683 request->modifiedInstance.getPath().getClassName().getString());
684 chip 1.1
685 // make target object path
686 CIMObjectPath objectPath(
687 System::getHostName(),
688 request->nameSpace,
689 request->modifiedInstance.getPath ().getClassName(),
690 request->modifiedInstance.getPath ().getKeyBindings());
691
|
692 chip 1.4 ProviderName name(
693 objectPath.toString(),
|
694 chip 1.1 String::EMPTY,
695 String::EMPTY,
|
696 chip 1.4 String::EMPTY,
697 0);
|
698 chip 1.1
|
699 chip 1.5 // resolve provider name
700 name = _resolveProviderName(name);
|
701 chip 1.1
702 // get cached or load new provider module
703 OpProviderHolder ph =
704 providerManager.getProvider(name.getPhysicalName(), name.getLogicalName(), String::EMPTY);
705
706 // convert arguments
707 OperationContext context;
708
709 context.insert(IdentityContainer(request->userName));
710 context.insert(AcceptLanguageListContainer(request->acceptLanguages));
711 context.insert(ContentLanguageListContainer(request->contentLanguages));
712
713 CIMPropertyList propertyList(request->propertyList);
714
715 // forward request
716 PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
717 "Calling provider.modifyInstance: " +
718 ph.GetProvider().getName());
719
720 pm_service_op_lock op_lock(&ph.GetProvider());
721
722 chip 1.1 STAT_GETSTARTTIME;
723
724 ph.GetProvider().modifyInstance(
725 context,
726 objectPath,
727 request->modifiedInstance,
728 request->includeQualifiers,
729 propertyList,
730 handler);
731
732 STAT_PMS_PROVIDEREND;
733 }
734 catch(CIMException & e)
735 {
736 PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
737 "Exception: " + e.getMessage());
|
738 chip 1.2
|
739 chip 1.1 handler.setStatus(e.getCode(), e.getContentLanguages(), e.getMessage()); // l10n
740 }
741 catch(Exception & e)
742 {
743 PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
744 "Exception: " + e.getMessage());
|
745 chip 1.2
|
746 chip 1.1 handler.setStatus(CIM_ERR_FAILED, e.getContentLanguages(), e.getMessage()); // l10n
747 }
748 catch(...)
749 {
750 PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
751 "Exception: Unknown");
|
752 chip 1.2
|
753 chip 1.1 handler.setStatus(CIM_ERR_FAILED, "Unknown error.");
754 }
755
756 PEG_METHOD_EXIT();
757
758 return(response);
759 }
760
761 Message * DefaultProviderManager::handleDeleteInstanceRequest(const Message * message) throw()
762 {
763 PEG_METHOD_ENTER(TRC_PROVIDERMANAGER, "DefaultProviderManager::handleDeleteInstanceRequest");
764
765 CIMDeleteInstanceRequestMessage * request =
766 dynamic_cast<CIMDeleteInstanceRequestMessage *>(const_cast<Message *>(message));
767
768 PEGASUS_ASSERT(request != 0);
769
770 // create response message
771 CIMDeleteInstanceResponseMessage * response =
772 new CIMDeleteInstanceResponseMessage(
773 request->messageId,
774 chip 1.1 CIMException(),
775 request->queueIds.copyAndPop());
776
777 PEGASUS_ASSERT(response != 0);
778
779 // preserve message key
780 response->setKey(request->getKey());
781
782 // Set HTTP method in response from request
783 response->setHttpMethod (request->getHttpMethod ());
784
785 // create a handler for this request
786 DeleteInstanceResponseHandler handler(request, response);
787
788 try
789 {
790 Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE,
791 "DefaultProviderManager::handleDeleteInstanceRequest - Host name: $0 Name space: $1 Class name: $2",
792 System::getHostName(),
793 request->nameSpace.getString(),
794 request->instanceName.getClassName().getString());
795 chip 1.1
796 // make target object path
797 CIMObjectPath objectPath(
798 System::getHostName(),
799 request->nameSpace,
800 request->instanceName.getClassName(),
801 request->instanceName.getKeyBindings());
802
|
803 chip 1.4 ProviderName name(
804 objectPath.toString(),
|
805 chip 1.1 String::EMPTY,
806 String::EMPTY,
|
807 chip 1.4 String::EMPTY,
808 0);
|
809 chip 1.1
|
810 chip 1.5 // resolve provider name
811 name = _resolveProviderName(name);
|
812 chip 1.1
813 // get cached or load new provider module
814 OpProviderHolder ph =
815 providerManager.getProvider(name.getPhysicalName(), name.getLogicalName(), String::EMPTY);
816
817 // convert arguments
818 OperationContext context;
819
820 context.insert(IdentityContainer(request->userName));
821 context.insert(AcceptLanguageListContainer(request->acceptLanguages));
822 context.insert(ContentLanguageListContainer(request->contentLanguages));
823
824 // forward request
825 PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
826 "Calling provider.deleteInstance: " +
827 ph.GetProvider().getName());
828
829 pm_service_op_lock op_lock(&ph.GetProvider());
830
831 STAT_GETSTARTTIME;
832
833 chip 1.1 ph.GetProvider().deleteInstance(
834 context,
835 objectPath,
836 handler);
837
838 STAT_PMS_PROVIDEREND;
839 }
840 catch(CIMException & e)
841 {
842 PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
843 "Exception: " + e.getMessage());
|
844 chip 1.2
|
845 chip 1.1 handler.setStatus(e.getCode(), e.getContentLanguages(), e.getMessage()); // l10n
846 }
847 catch(Exception & e)
848 {
849 PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
850 "Exception: " + e.getMessage());
|
851 chip 1.2
|
852 chip 1.1 handler.setStatus(CIM_ERR_FAILED, e.getContentLanguages(), e.getMessage()); // l10n
853 }
854 catch(...)
855 {
856 PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
857 "Exception: Unknown");
|
858 chip 1.2
|
859 chip 1.1 handler.setStatus(CIM_ERR_FAILED, "Unknown error.");
860 }
861
862 PEG_METHOD_EXIT();
863
864 return(response);
865 }
866
867 Message * DefaultProviderManager::handleExecuteQueryRequest(const Message * message) throw()
868 {
869 PEG_METHOD_ENTER(TRC_PROVIDERMANAGER, "DefaultProviderManager::handleExecuteQueryRequest");
870
871 CIMExecQueryRequestMessage * request =
872 dynamic_cast<CIMExecQueryRequestMessage *>(const_cast<Message *>(message));
873
874 PEGASUS_ASSERT(request != 0);
875
876 //l10n
877 CIMExecQueryResponseMessage * response =
878 new CIMExecQueryResponseMessage(
879 request->messageId,
880 chip 1.1 PEGASUS_CIM_EXCEPTION_L(CIM_ERR_FAILED, MessageLoaderParms(
881 "ProviderManager.DefaultProviderManager.NOT_IMPLEMENTED",
882 "not implemented")),
883 request->queueIds.copyAndPop(),
884 Array<CIMObject>());
885
886 PEGASUS_ASSERT(response != 0);
887
888 // preserve message key
889 response->setKey(request->getKey());
890
891 // Set HTTP method in response from request
892 response->setHttpMethod(request->getHttpMethod());
893
894 // l10n
895 // ATTN: when this is implemented, need to add the language containers to the
896 // OperationContext. See how the other requests do it.
897
898 PEG_METHOD_EXIT();
899
900 return(response);
901 chip 1.1 }
902
903 Message * DefaultProviderManager::handleAssociatorsRequest(const Message * message) throw()
904 {
905 PEG_METHOD_ENTER(TRC_PROVIDERMANAGER, "DefaultProviderManager::handleAssociatorsRequest");
906
907 CIMAssociatorsRequestMessage * request =
908 dynamic_cast<CIMAssociatorsRequestMessage *>(const_cast<Message *>(message));
909
910 PEGASUS_ASSERT(request != 0);
911
912 CIMAssociatorsResponseMessage * response =
913 new CIMAssociatorsResponseMessage(
914 request->messageId,
915 CIMException(),
916 request->queueIds.copyAndPop(),
917 Array<CIMObject>());
918
919 PEGASUS_ASSERT(response != 0);
920
921 // preserve message key
922 chip 1.1 response->setKey(request->getKey());
923
924 // create a handler for this request
925 AssociatorsResponseHandler handler(request, response);
926
927 // process the request
928 try
929 {
930 Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE,
931 "DefaultProviderManager::handleAssociatorsRequest - Host name: $0 Name space: $1 Class name: $2",
932 System::getHostName(),
933 request->nameSpace.getString(),
934 request->objectName.getClassName().getString());
935
936 // make target object path
937 CIMObjectPath objectPath(
938 System::getHostName(),
939 request->nameSpace,
940 request->objectName.getClassName());
941
942 objectPath.setKeyBindings(request->objectName.getKeyBindings());
943 chip 1.1
|
944 chip 1.4 ProviderName name(
945 objectPath.toString(),
|
946 chip 1.2 String::EMPTY,
947 String::EMPTY,
|
948 chip 1.4 String::EMPTY,
949 0);
|
950 chip 1.2
|
951 chip 1.5 // resolve provider name
952 name = _resolveProviderName(name);
|
953 chip 1.2
954 // get cached or load new provider module
955 OpProviderHolder ph =
956 providerManager.getProvider(name.getPhysicalName(), name.getLogicalName(), String::EMPTY);
957
958 // convert arguments
959 OperationContext context;
960
961 context.insert(IdentityContainer(request->userName));
962 context.insert(AcceptLanguageListContainer(request->acceptLanguages));
963 context.insert(ContentLanguageListContainer(request->contentLanguages));
|
964 chip 1.1
|
965 chip 1.2 // ATTN KS STAT_GETSTARTTIME;
966 pm_service_op_lock op_lock(&ph.GetProvider());
|
967 chip 1.1
|
968 chip 1.2 ph.GetProvider().associators(
969 context,
970 objectPath,
971 request->assocClass,
972 request->resultClass,
973 request->role,
974 request->resultRole,
975 request->includeQualifiers,
976 request->includeClassOrigin,
977 request->propertyList.getPropertyNameArray(),
978 handler);
|
979 chip 1.1
|
980 chip 1.2 STAT_PMS_PROVIDEREND;
|
981 chip 1.1 }
982 catch(CIMException & e)
983 {
984 PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
985 "Exception: " + e.getMessage());
|
986 chip 1.2
|
987 chip 1.1 handler.setStatus(e.getCode(), e.getContentLanguages(), e.getMessage()); // l10n
988 }
989 catch(Exception & e)
990 {
991 PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
992 "Exception: " + e.getMessage());
|
993 chip 1.2
|
994 chip 1.1 handler.setStatus(CIM_ERR_FAILED, e.getContentLanguages(), e.getMessage()); // l10n
995 }
996 catch(...)
997 {
998 PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
999 "Exception: Unknown");
|
1000 chip 1.2
|
1001 chip 1.1 handler.setStatus(CIM_ERR_FAILED, "Unknown error.");
1002 }
1003
1004 PEG_METHOD_EXIT();
1005
1006 return(response);
1007 }
1008
1009 Message * DefaultProviderManager::handleAssociatorNamesRequest(const Message * message) throw()
1010 {
1011 PEG_METHOD_ENTER(TRC_PROVIDERMANAGER, "DefaultProviderManager::handleAssociatorNamesRequest");
1012
1013 CIMAssociatorNamesRequestMessage * request =
1014 dynamic_cast<CIMAssociatorNamesRequestMessage *>(const_cast<Message *>(message));
1015
1016 PEGASUS_ASSERT(request != 0);
1017
1018 CIMAssociatorNamesResponseMessage * response =
1019 new CIMAssociatorNamesResponseMessage(
1020 request->messageId,
1021 CIMException(),
1022 chip 1.1 request->queueIds.copyAndPop(),
1023 Array<CIMObjectPath>());
1024
1025 PEGASUS_ASSERT(response != 0);
1026
1027 // preserve message key
1028 response->setKey(request->getKey());
1029
1030 // Set HTTP method in response from request
1031 response->setHttpMethod(request->getHttpMethod());
1032
1033 // create a handler for this request
1034 AssociatorNamesResponseHandler handler(request, response);
1035
1036 // process the request
1037 try
1038 {
1039 Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE,
1040 "DefaultProviderManager::handleAssociationNamesRequest - Host name: $0 Name space: $1 Class name: $2",
1041 System::getHostName(),
1042 request->nameSpace.getString(),
1043 chip 1.1 request->objectName.getClassName().getString());
1044
1045 // make target object path
1046 CIMObjectPath objectPath(
1047 System::getHostName(),
1048 request->nameSpace,
1049 request->objectName.getClassName());
1050
1051 objectPath.setKeyBindings(request->objectName.getKeyBindings());
1052
|
1053 chip 1.4 ProviderName name(
1054 objectPath.toString(),
|
1055 chip 1.2 String::EMPTY,
1056 String::EMPTY,
|
1057 chip 1.4 String::EMPTY,
1058 0);
|
1059 chip 1.2
|
1060 chip 1.5 // resolve provider name
1061 name = _resolveProviderName(name);
|
1062 chip 1.2
1063 // get cached or load new provider module
1064 OpProviderHolder ph =
1065 providerManager.getProvider(name.getPhysicalName(), name.getLogicalName(), String::EMPTY);
1066
1067 // convert arguments
1068 OperationContext context;
|
1069 chip 1.1
|
1070 chip 1.2 context.insert(IdentityContainer(request->userName));
1071 context.insert(AcceptLanguageListContainer(request->acceptLanguages));
1072 context.insert(ContentLanguageListContainer(request->contentLanguages));
|
1073 chip 1.1
|
1074 chip 1.2 pm_service_op_lock op_lock(&ph.GetProvider());
|
1075 chip 1.1
|
1076 chip 1.2 ph.GetProvider().associatorNames(
1077 context,
1078 objectPath,
1079 request->assocClass,
1080 request->resultClass,
1081 request->role,
1082 request->resultRole,
1083 handler);
|
1084 chip 1.1
|
1085 chip 1.2 STAT_PMS_PROVIDEREND;
|
1086 chip 1.1 }
1087 catch(CIMException & e)
1088 {
|
1089 chip 1.2 PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
1090 "Exception: " + e.getMessage());
1091
|
1092 chip 1.1 handler.setStatus(e.getCode(), e.getContentLanguages(), e.getMessage()); // l10n
1093 }
1094 catch(Exception & e)
1095 {
|
1096 chip 1.2 PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
1097 "Exception: " + e.getMessage());
1098
|
1099 chip 1.1 handler.setStatus(CIM_ERR_FAILED, e.getContentLanguages(), e.getMessage()); // l10n
1100 }
1101 catch(...)
1102 {
1103 PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
1104 "Exception: Unknown");
|
1105 chip 1.2
|
1106 chip 1.1 handler.setStatus(CIM_ERR_FAILED, "Unknown error.");
1107 }
1108
1109 PEG_METHOD_EXIT();
1110
1111 return(response);
1112 }
1113
1114 Message * DefaultProviderManager::handleReferencesRequest(const Message * message) throw()
1115 {
1116 PEG_METHOD_ENTER(TRC_PROVIDERMANAGER, "DefaultProviderManager::handleReferencesRequest");
1117
1118 CIMReferencesRequestMessage * request =
1119 dynamic_cast<CIMReferencesRequestMessage *>(const_cast<Message *>(message));
1120
1121 PEGASUS_ASSERT(request != 0);
1122
1123 CIMReferencesResponseMessage * response =
1124 new CIMReferencesResponseMessage(
1125 request->messageId,
1126 CIMException(),
1127 chip 1.1 request->queueIds.copyAndPop(),
1128 Array<CIMObject>());
1129
1130 PEGASUS_ASSERT(response != 0);
1131
1132 // preserve message key
1133 response->setKey(request->getKey());
1134
1135 // Set HTTP method in response from request
1136 response->setHttpMethod (request->getHttpMethod ());
1137
1138 // create a handler for this request
1139 ReferencesResponseHandler handler(request, response);
1140
1141 // process the request
1142 try
1143 {
1144 Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE,
1145 "DefaultProviderManager::handleReferencesRequest - Host name: $0 Name space: $1 Class name: $2",
1146 System::getHostName(),
1147 request->nameSpace.getString(),
1148 chip 1.1 request->objectName.getClassName().getString());
1149
1150 // make target object path
1151 CIMObjectPath objectPath(
1152 System::getHostName(),
1153 request->nameSpace,
1154 request->objectName.getClassName());
1155
1156 objectPath.setKeyBindings(request->objectName.getKeyBindings());
1157
|
1158 chip 1.4 ProviderName name(
1159 objectPath.toString(),
|
1160 chip 1.2 String::EMPTY,
1161 String::EMPTY,
|
1162 chip 1.4 String::EMPTY,
1163 0);
|
1164 chip 1.2
|
1165 chip 1.5 // resolve provider name
1166 name = _resolveProviderName(name);
|
1167 chip 1.2
1168 // get cached or load new provider module
1169 OpProviderHolder ph =
1170 providerManager.getProvider(name.getPhysicalName(), name.getLogicalName(), String::EMPTY);
1171
1172 // convert arguments
1173 OperationContext context;
1174
1175 context.insert(IdentityContainer(request->userName));
1176 context.insert(AcceptLanguageListContainer(request->acceptLanguages));
1177 context.insert(ContentLanguageListContainer(request->contentLanguages));
1178
1179 STAT_GETSTARTTIME;
|
1180 chip 1.1
|
1181 chip 1.2 PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
1182 "Calling provider.references: " +
1183 ph.GetProvider().getName());
|
1184 chip 1.1
|
1185 chip 1.2 pm_service_op_lock op_lock(&ph.GetProvider());
|
1186 chip 1.1
|
1187 chip 1.2 ph.GetProvider().references(
1188 context,
1189 objectPath,
1190 request->resultClass,
1191 request->role,
1192 request->includeQualifiers,
1193 request->includeClassOrigin,
1194 request->propertyList.getPropertyNameArray(),
1195 handler);
|
1196 chip 1.1
|
1197 chip 1.2 STAT_PMS_PROVIDEREND;
|
1198 chip 1.1 }
1199 catch(CIMException & e)
1200 {
1201 PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
1202 "Exception: " + e.getMessage());
|
1203 chip 1.2
|
1204 chip 1.1 handler.setStatus(e.getCode(), e.getContentLanguages(), e.getMessage()); // l10n
1205 }
1206 catch(Exception & e)
1207 {
1208 PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
1209 "Exception: " + e.getMessage());
|
1210 chip 1.2
|
1211 chip 1.1 handler.setStatus(CIM_ERR_FAILED, e.getContentLanguages(), e.getMessage()); // l10n
1212 }
1213 catch(...)
1214 {
1215 PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
1216 "Exception: Unknown");
|
1217 chip 1.2
|
1218 chip 1.1 handler.setStatus(CIM_ERR_FAILED, "Unknown error.");
1219 }
1220
1221 PEG_METHOD_EXIT();
1222
1223 return(response);
1224 }
1225
1226 Message * DefaultProviderManager::handleReferenceNamesRequest(const Message * message) throw()
1227 {
1228 PEG_METHOD_ENTER(TRC_PROVIDERMANAGER, "DefaultProviderManager::handleReferenceNamesRequest");
1229
1230 CIMReferenceNamesRequestMessage * request =
1231 dynamic_cast<CIMReferenceNamesRequestMessage *>(const_cast<Message *>(message));
1232
1233 PEGASUS_ASSERT(request != 0);
1234
1235 CIMReferenceNamesResponseMessage * response =
1236 new CIMReferenceNamesResponseMessage(
1237 request->messageId,
1238 CIMException(),
1239 chip 1.1 request->queueIds.copyAndPop(),
1240 Array<CIMObjectPath>());
1241
1242 // preserve message key
1243 response->setKey(request->getKey());
1244
1245 // Set HTTP method in response from request
1246 response->setHttpMethod (request->getHttpMethod ());
1247
1248 // create a handler for this request
1249 ReferenceNamesResponseHandler handler(request, response);
1250
1251 // process the request
1252 try
1253 {
1254 Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE,
1255 "DefaultProviderManager::handleReferenceNamesRequest - Host name: $0 Name space: $1 Class name: $2",
1256 System::getHostName(),
1257 request->nameSpace.getString(),
1258 request->objectName.getClassName().getString());
1259
1260 chip 1.1 // make target object path
1261 CIMObjectPath objectPath(
1262 System::getHostName(),
1263 request->nameSpace,
1264 request->objectName.getClassName());
1265
1266 objectPath.setKeyBindings(request->objectName.getKeyBindings());
1267
|
1268 chip 1.4 ProviderName name(
1269 objectPath.toString(),
|
1270 chip 1.2 String::EMPTY,
1271 String::EMPTY,
|
1272 chip 1.4 String::EMPTY,
1273 0);
|
1274 chip 1.1
|
1275 chip 1.5 // resolve provider name
1276 name = _resolveProviderName(name);
|
1277 chip 1.1
|
1278 chip 1.2 // get cached or load new provider module
1279 OpProviderHolder ph =
1280 providerManager.getProvider(name.getPhysicalName(), name.getLogicalName(), String::EMPTY);
|
1281 chip 1.1
|
1282 chip 1.2 // convert arguments
1283 OperationContext context;
|
1284 chip 1.1
|
1285 chip 1.2 context.insert(IdentityContainer(request->userName));
1286 context.insert(AcceptLanguageListContainer(request->acceptLanguages));
1287 context.insert(ContentLanguageListContainer(request->contentLanguages));
|
1288 chip 1.1
|
1289 chip 1.2 STAT_GETSTARTTIME;
|
1290 chip 1.1
|
1291 chip 1.2 PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
1292 "Calling provider.referenceNames: " +
1293 ph.GetProvider().getName());
|
1294 chip 1.1
|
1295 chip 1.2 pm_service_op_lock op_lock(&ph.GetProvider());
|
1296 chip 1.1
|
1297 chip 1.2 ph.GetProvider().referenceNames(
1298 context,
1299 objectPath,
1300 request->resultClass,
1301 request->role,
1302 handler);
|
1303 chip 1.1
|
1304 chip 1.2 STAT_PMS_PROVIDEREND;
|
1305 chip 1.1 }
1306 catch(CIMException & e)
1307 {
1308 PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
1309 "Exception: " + e.getMessage());
|
1310 chip 1.2
|
1311 chip 1.1 handler.setStatus(e.getCode(), e.getContentLanguages(), e.getMessage()); // l10n
1312 }
1313 catch(Exception & e)
1314 {
1315 PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
1316 "Exception: " + e.getMessage());
|
1317 chip 1.2
|
1318 chip 1.1 handler.setStatus(CIM_ERR_FAILED, e.getContentLanguages(), e.getMessage()); // l10n
1319 }
1320 catch(...)
1321 {
1322 PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
1323 "Exception: Unknown");
|
1324 chip 1.2
|
1325 chip 1.1 handler.setStatus(CIM_ERR_FAILED, "Unknown error.");
1326 }
1327
1328 PEG_METHOD_EXIT();
1329
1330 return(response);
1331 }
1332
1333 Message * DefaultProviderManager::handleGetPropertyRequest(const Message * message) throw()
1334 {
1335 PEG_METHOD_ENTER(TRC_PROVIDERMANAGER, "DefaultProviderManager::handleGetPropertyRequest");
1336
1337 CIMGetPropertyRequestMessage * request =
1338 dynamic_cast<CIMGetPropertyRequestMessage *>(const_cast<Message *>(message));
1339
1340 PEGASUS_ASSERT(request != 0);
1341
1342 // create response message
1343 CIMGetPropertyResponseMessage * response =
1344 new CIMGetPropertyResponseMessage(
1345 request->messageId,
1346 chip 1.1 CIMException(),
1347 request->queueIds.copyAndPop(),
1348 CIMValue());
1349
1350 PEGASUS_ASSERT(response != 0);
1351
1352 // preserve message key
1353 response->setKey(request->getKey());
1354
1355 // Set HTTP method in response from request
1356 response->setHttpMethod(request->getHttpMethod());
1357
1358 GetPropertyResponseHandler handler(request, response);
1359
1360 try
1361 {
1362 Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE,
1363 "DefaultProviderManager::handleGetPropertyRequest - Host name: $0 Name space: $1 Class name: $2",
1364 System::getHostName(),
1365 request->nameSpace.getString(),
1366 request->instanceName.getClassName().getString());
1367 chip 1.1
1368 // make target object path
1369 CIMObjectPath objectPath(
1370 System::getHostName(),
1371 request->nameSpace,
1372 request->instanceName.getClassName(),
1373 request->instanceName.getKeyBindings());
1374
|
1375 chip 1.4 ProviderName name(
1376 objectPath.toString(),
|
1377 chip 1.1 String::EMPTY,
1378 String::EMPTY,
|
1379 chip 1.4 String::EMPTY,
1380 0);
|
1381 chip 1.1
|
1382 chip 1.5 // resolve provider name
1383 name = _resolveProviderName(name);
|
1384 chip 1.1
1385 // get cached or load new provider module
1386 OpProviderHolder ph =
1387 providerManager.getProvider(name.getPhysicalName(), name.getLogicalName(), String::EMPTY);
1388
1389 // convert arguments
1390 OperationContext context;
1391
1392 context.insert(IdentityContainer(request->userName));
1393 context.insert(AcceptLanguageListContainer(request->acceptLanguages));
1394 context.insert(ContentLanguageListContainer(request->contentLanguages));
1395
1396 CIMName propertyName = request->propertyName;
1397
1398 STAT_GETSTARTTIME;
1399
1400 PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
1401 "Calling provider.getProperty: " +
1402 ph.GetProvider().getName());
1403
1404 // forward request
1405 chip 1.1 pm_service_op_lock op_lock(&ph.GetProvider());
1406
1407 ph.GetProvider().getProperty(
1408 context,
1409 objectPath,
1410 propertyName,
1411 handler);
1412
1413 STAT_PMS_PROVIDEREND;
1414 }
1415 catch(CIMException & e)
1416 {
1417 PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
1418 "Exception: " + e.getMessage());
|
1419 chip 1.2
|
1420 chip 1.1 handler.setStatus(e.getCode(), e.getContentLanguages(), e.getMessage()); // l10n
1421 }
1422 catch(Exception & e)
1423 {
1424 PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
1425 "Exception: " + e.getMessage());
|
1426 chip 1.2
|
1427 chip 1.1 handler.setStatus(CIM_ERR_FAILED, e.getContentLanguages(), e.getMessage()); // l10n
1428 }
1429 catch(...)
1430 {
1431 PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
1432 "Exception: Unknown");
|
1433 chip 1.2
|
1434 chip 1.1 handler.setStatus(CIM_ERR_FAILED, "Unknown error.");
1435 }
1436
1437 PEG_METHOD_EXIT();
1438
1439 return(response);
1440 }
1441
1442 Message * DefaultProviderManager::handleSetPropertyRequest(const Message * message) throw()
1443 {
1444 PEG_METHOD_ENTER(TRC_PROVIDERMANAGER, "DefaultProviderManager::handleSetPropertyRequest");
1445
1446 CIMSetPropertyRequestMessage * request =
1447 dynamic_cast<CIMSetPropertyRequestMessage *>(const_cast<Message *>(message));
1448
1449 PEGASUS_ASSERT(request != 0);
1450
1451 // create response message
1452 //l10n
1453 CIMSetPropertyResponseMessage * response =
1454 new CIMSetPropertyResponseMessage(
1455 chip 1.1 request->messageId,
1456 PEGASUS_CIM_EXCEPTION_L(CIM_ERR_FAILED, MessageLoaderParms(
1457 "ProviderManager.DefaultProviderManager.NOT_IMPLEMENTED",
1458 "not implemented")),
1459 request->queueIds.copyAndPop());
1460
1461 PEGASUS_ASSERT(response != 0);
1462
1463 // preserve message key
1464 response->setKey(request->getKey());
1465
1466 // Set HTTP method in response from request
1467 response->setHttpMethod(request->getHttpMethod());
1468
1469 SetPropertyResponseHandler handler(request, response);
1470
1471 try
1472 {
1473 Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE,
1474 "DefaultProviderManager::handleSetPropertyRequest - Host name: $0 Name space: $1 Class name: $2",
1475 System::getHostName(),
1476 chip 1.1 request->nameSpace.getString(),
1477 request->instanceName.getClassName().getString());
1478
1479 // make target object path
1480 CIMObjectPath objectPath(
1481 System::getHostName(),
1482 request->nameSpace,
1483 request->instanceName.getClassName(),
1484 request->instanceName.getKeyBindings());
1485
|
1486 chip 1.4 ProviderName name(
1487 objectPath.toString(),
|
1488 chip 1.1 String::EMPTY,
1489 String::EMPTY,
|
1490 chip 1.4 String::EMPTY,
1491 0);
|
1492 chip 1.1
|
1493 chip 1.5 // resolve provider name
1494 name = _resolveProviderName(name);
|
1495 chip 1.1
1496 // get cached or load new provider module
1497 OpProviderHolder ph =
1498 providerManager.getProvider(name.getPhysicalName(), name.getLogicalName(), String::EMPTY);
1499
1500 // convert arguments
1501 OperationContext context;
1502
1503 context.insert(IdentityContainer(request->userName));
1504 context.insert(AcceptLanguageListContainer(request->acceptLanguages));
1505 context.insert(ContentLanguageListContainer(request->contentLanguages));
1506
1507 CIMName propertyName = request->propertyName;
1508 CIMValue propertyValue = request->newValue;
1509
1510 STAT_GETSTARTTIME;
1511
1512 PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
1513 "Calling provider.setProperty: " +
1514 ph.GetProvider().getName());
1515
1516 chip 1.1 // forward request
1517 pm_service_op_lock op_lock(&ph.GetProvider());
1518
1519 ph.GetProvider().setProperty(
1520 context,
1521 objectPath,
1522 propertyName,
1523 propertyValue,
1524 handler);
1525
1526 STAT_PMS_PROVIDEREND;
1527 }
1528 catch(CIMException & e)
1529 {
1530 PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
1531 "Exception: " + e.getMessage());
|
1532 chip 1.2
|
1533 chip 1.1 handler.setStatus(e.getCode(), e.getContentLanguages(), e.getMessage()); // l10n
1534 }
1535 catch(Exception & e)
1536 {
1537 PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
1538 "Exception: " + e.getMessage());
|
1539 chip 1.2
|
1540 chip 1.1 handler.setStatus(CIM_ERR_FAILED, e.getContentLanguages(), e.getMessage()); // l10n
1541 }
1542 catch(...)
1543 {
1544 PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
1545 "Exception: Unknown");
|
1546 chip 1.2
|
1547 chip 1.1 handler.setStatus(CIM_ERR_FAILED, "Unknown error.");
1548 }
1549
1550 PEG_METHOD_EXIT();
1551
1552 return(response);
1553 }
1554
1555 Message * DefaultProviderManager::handleInvokeMethodRequest(const Message * message) throw()
1556 {
1557 PEG_METHOD_ENTER(TRC_PROVIDERMANAGER, "DefaultProviderManager::handleInvokeMethodRequest");
1558
1559 CIMInvokeMethodRequestMessage * request =
1560 dynamic_cast<CIMInvokeMethodRequestMessage *>(const_cast<Message *>(message));
1561
1562 PEGASUS_ASSERT(request != 0);
1563
1564 // create response message
1565 CIMInvokeMethodResponseMessage * response =
1566 new CIMInvokeMethodResponseMessage(
1567 request->messageId,
1568 chip 1.1 CIMException(),
1569 request->queueIds.copyAndPop(),
1570 CIMValue(),
1571 Array<CIMParamValue>(),
1572 request->methodName);
1573
1574 PEGASUS_ASSERT(response != 0);
1575
1576 // propagate message key
1577 response->setKey(request->getKey());
1578
1579 // Set HTTP method in response from request
1580 response->setHttpMethod (request->getHttpMethod ());
1581
1582 // create a handler for this request
1583 InvokeMethodResponseHandler handler(request, response);
1584
1585 try
1586 {
1587 Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE,
1588 "DefaultProviderManager::handleInvokeMethodRequest - Host name: $0 Name space: $1 Class name: $2",
1589 chip 1.1 System::getHostName(),
1590 request->nameSpace.getString(),
1591 request->instanceName.getClassName().getString());
1592
1593 // make target object path
1594 CIMObjectPath objectPath(
1595 System::getHostName(),
1596 request->nameSpace,
1597 request->instanceName.getClassName(),
1598 request->instanceName.getKeyBindings());
1599
|
1600 chip 1.4 ProviderName name(
1601 objectPath.toString(),
|
1602 chip 1.1 String::EMPTY,
1603 String::EMPTY,
|
1604 chip 1.4 String::EMPTY,
1605 0);
|
1606 chip 1.1
|
1607 chip 1.5 // resolve provider name
1608 name = _resolveProviderName(name);
|
1609 chip 1.1
1610 // get cached or load new provider module
1611 OpProviderHolder ph =
1612 providerManager.getProvider(name.getPhysicalName(), name.getLogicalName(), String::EMPTY);
1613
1614 // convert arguments
1615 OperationContext context;
1616
1617 context.insert(IdentityContainer(request->userName));
1618 context.insert(AcceptLanguageListContainer(request->acceptLanguages));
1619 context.insert(ContentLanguageListContainer(request->contentLanguages));
1620
1621 CIMObjectPath instanceReference(request->instanceName);
1622
1623 // ATTN: propagate namespace
1624 instanceReference.setNameSpace(request->nameSpace);
1625
1626 // forward request
1627 STAT_GETSTARTTIME;
1628
1629 PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
1630 chip 1.1 "Calling provider.invokeMethod: " +
1631 ph.GetProvider().getName());
1632
1633 pm_service_op_lock op_lock(&ph.GetProvider());
1634
1635 ph.GetProvider().invokeMethod(
1636 context,
1637 instanceReference,
1638 request->methodName,
1639 request->inParameters,
1640 handler);
1641
1642 STAT_PMS_PROVIDEREND;
1643 }
1644 catch(CIMException & e)
1645 {
1646 PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
1647 "Exception: " + e.getMessage());
|
1648 chip 1.2
|
1649 chip 1.1 handler.setStatus(e.getCode(), e.getContentLanguages(), e.getMessage()); // l10n
1650 }
1651 catch(Exception & e)
1652 {
1653 PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
1654 "Exception: " + e.getMessage());
|
1655 chip 1.2
|
1656 chip 1.1 handler.setStatus(CIM_ERR_FAILED, e.getContentLanguages(), e.getMessage()); // l10n
1657 }
1658 catch(...)
1659 {
1660 PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
1661 "Exception: Unknown");
|
1662 chip 1.2
|
1663 chip 1.1 handler.setStatus(CIM_ERR_FAILED, "Unknown error.");
1664 }
1665
1666 PEG_METHOD_EXIT();
1667
1668 return(response);
1669 }
1670
1671 Message * DefaultProviderManager::handleCreateSubscriptionRequest(const Message * message) throw()
1672 {
1673 PEG_METHOD_ENTER(TRC_PROVIDERMANAGER, "DefaultProviderManager::handleCreateSubscriptionRequest");
1674
1675 CIMCreateSubscriptionRequestMessage * request =
1676 dynamic_cast<CIMCreateSubscriptionRequestMessage *>(const_cast<Message *>(message));
1677
1678 PEGASUS_ASSERT(request != 0);
1679
1680 CIMCreateSubscriptionResponseMessage * response =
1681 new CIMCreateSubscriptionResponseMessage(
1682 request->messageId,
1683 CIMException(),
1684 chip 1.1 request->queueIds.copyAndPop());
1685
1686 PEGASUS_ASSERT(response != 0);
1687
1688 // preserve message key
1689 response->setKey(request->getKey());
1690
1691 // Set HTTP method in response from request
1692 response->setHttpMethod (request->getHttpMethod ());
1693
1694 OperationResponseHandler handler(request, response);
1695
1696 try
1697 {
|
1698 chip 1.2 String temp;
1699
1700 for(Uint32 i = 0, n = request->classNames.size(); i < n; i++)
1701 {
1702 temp.append(request->classNames[i].getString());
1703
1704 if(i == (n - 1))
1705 {
1706 temp.append(", ");
1707 }
1708 }
1709
1710 Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE,
1711 "DefaultProviderManager::handleCreateSubscriptionRequest - Host name: $0 Name space: $1 Class name(s): $2",
1712 System::getHostName(),
1713 request->nameSpace.getString(),
1714 temp);
1715
1716 // NOTE: the provider and provider module name are embedded in the request, presumably to reduce
1717 // the number of provider lookups (but this should be trivial if the data is cached and accessed
1718 // from the same source). to keep the lookups consistent, use the first class name, combined
1719 chip 1.2 // with the other information in the request, and create an object path that can be used to
1720 // resolve the provider using the ProviderRegistrar.
1721
1722 // make target object path
1723 CIMObjectPath objectPath(
1724 System::getHostName(),
1725 request->nameSpace,
1726 request->classNames[0].getString());
|
1727 chip 1.1
|
1728 chip 1.4 ProviderName name(
1729 objectPath.toString(),
|
1730 chip 1.1 String::EMPTY,
1731 String::EMPTY,
|
1732 chip 1.4 String::EMPTY,
1733 0);
|
1734 chip 1.1
|
1735 chip 1.5 // resolve provider name
1736 name = _resolveProviderName(name);
|
1737 chip 1.1
1738 // get cached or load new provider module
1739 OpProviderHolder ph =
1740 providerManager.getProvider(name.getPhysicalName(), name.getLogicalName(), String::EMPTY);
1741
1742 // convert arguments
1743 OperationContext context;
1744
1745 context.insert(IdentityContainer(request->userName));
1746 context.insert(SubscriptionInstanceContainer
1747 (request->subscriptionInstance));
1748 context.insert(SubscriptionFilterConditionContainer
1749 (request->condition, request->queryLanguage));
1750 context.insert(SubscriptionLanguageListContainer
1751 (request->acceptLanguages));
1752 context.insert(AcceptLanguageListContainer(request->acceptLanguages));
1753 context.insert(ContentLanguageListContainer(request->contentLanguages));
1754
1755 CIMObjectPath subscriptionName = request->subscriptionInstance.getPath();
1756
1757 Array<CIMObjectPath> classNames;
1758 chip 1.1
1759 for(Uint32 i = 0, n = request->classNames.size(); i < n; i++)
1760 {
1761 CIMObjectPath className(
1762 System::getHostName(),
1763 request->nameSpace,
1764 request->classNames[i]);
1765
1766 classNames.append(className);
1767 }
1768
1769 CIMPropertyList propertyList = request->propertyList;
1770
1771 Uint16 repeatNotificationPolicy = request->repeatNotificationPolicy;
1772
1773 PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
1774 "Calling provider.createSubscription: " +
1775 ph.GetProvider().getName());
1776
1777 pm_service_op_lock op_lock(&ph.GetProvider());
1778
1779 chip 1.1 ph.GetProvider().createSubscription(
1780 context,
1781 subscriptionName,
1782 classNames,
1783 propertyList,
1784 repeatNotificationPolicy);
1785 }
1786 catch(CIMException & e)
1787 {
1788 PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
1789 "Exception: " + e.getMessage());
|
1790 chip 1.2
|
1791 chip 1.1 handler.setStatus(e.getCode(), e.getContentLanguages(), e.getMessage()); // l10n
1792 }
1793 catch(Exception & e)
1794 {
1795 PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
1796 "Exception: " + e.getMessage());
|
1797 chip 1.2
|
1798 chip 1.1 handler.setStatus(CIM_ERR_FAILED, e.getContentLanguages(), e.getMessage()); // l10n
1799 }
1800 catch(...)
1801 {
1802 PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
1803 "Exception: Unknown");
|
1804 chip 1.2
|
1805 chip 1.1 handler.setStatus(CIM_ERR_FAILED, "Unknown Error");
1806 }
1807
1808 PEG_METHOD_EXIT();
1809
1810 return(response);
1811 }
1812
1813 Message * DefaultProviderManager::handleModifySubscriptionRequest( const Message * message) throw()
1814 {
1815 PEG_METHOD_ENTER(TRC_PROVIDERMANAGER, "DefaultProviderManager::handleModifySubscriptionRequest");
1816
1817 CIMModifySubscriptionRequestMessage * request =
1818 dynamic_cast<CIMModifySubscriptionRequestMessage *>(const_cast<Message *>(message));
1819
1820 PEGASUS_ASSERT(request != 0);
1821
1822 CIMModifySubscriptionResponseMessage * response =
1823 new CIMModifySubscriptionResponseMessage(
1824 request->messageId,
1825 CIMException(),
1826 chip 1.1 request->queueIds.copyAndPop());
1827
1828 PEGASUS_ASSERT(response != 0);
1829
1830 // preserve message key
1831 response->setKey(request->getKey());
1832
1833 // Set HTTP method in response from request
1834 response->setHttpMethod (request->getHttpMethod ());
1835
1836 OperationResponseHandler handler(request, response);
1837
1838 try
1839 {
|
1840 chip 1.2 String temp;
1841
1842 for(Uint32 i = 0, n = request->classNames.size(); i < n; i++)
1843 {
1844 temp.append(request->classNames[i].getString());
1845
1846 if(i == (n - 1))
1847 {
1848 temp.append(", ");
1849 }
1850 }
1851
1852 Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE,
1853 "DefaultProviderManager::handleModifySubscriptionRequest - Host name: $0 Name space: $1 Class name(s): $2",
1854 System::getHostName(),
1855 request->nameSpace.getString(),
1856 temp);
1857
1858 // NOTE: the provider and provider module name are embedded in the request, presumably to reduce
1859 // the number of provider lookups (but this should be trivial if the data is cached and accessed
1860 // from the same source). to keep the lookups consistent, use the first class name, combined
1861 chip 1.2 // with the other information in the request, and create an object path that can be used to
1862 // resolve the provider using the ProviderRegistrar.
1863
1864 // make target object path
1865 CIMObjectPath objectPath(
1866 System::getHostName(),
1867 request->nameSpace,
1868 request->classNames[0].getString());
|
1869 chip 1.1
|
1870 chip 1.4 ProviderName name(
1871 objectPath.toString(),
|
1872 chip 1.1 String::EMPTY,
1873 String::EMPTY,
|
1874 chip 1.4 String::EMPTY,
1875 0);
|
1876 chip 1.1
|
1877 chip 1.5 // resolve provider name
1878 name = _resolveProviderName(name);
|
1879 chip 1.1
1880 // get cached or load new provider module
1881 OpProviderHolder ph =
1882 providerManager.getProvider(name.getPhysicalName(), name.getLogicalName(), String::EMPTY);
1883
1884 // convert arguments
1885 OperationContext context;
1886
1887 context.insert(IdentityContainer(request->userName));
1888 context.insert(SubscriptionInstanceContainer
1889 (request->subscriptionInstance));
1890 context.insert(SubscriptionFilterConditionContainer
1891 (request->condition, request->queryLanguage));
1892 context.insert(SubscriptionLanguageListContainer
1893 (request->acceptLanguages));
1894 context.insert(AcceptLanguageListContainer(request->acceptLanguages));
1895 context.insert(ContentLanguageListContainer(request->contentLanguages));
1896
1897 CIMObjectPath subscriptionName = request->subscriptionInstance.getPath();
1898
1899 Array<CIMObjectPath> classNames;
1900 chip 1.1
1901 for(Uint32 i = 0, n = request->classNames.size(); i < n; i++)
1902 {
1903 CIMObjectPath className(
1904 System::getHostName(),
1905 request->nameSpace,
1906 request->classNames[i]);
1907
1908 classNames.append(className);
1909 }
1910
1911 CIMPropertyList propertyList = request->propertyList;
1912
1913 Uint16 repeatNotificationPolicy = request->repeatNotificationPolicy;
1914
1915 PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
1916 "Calling provider.modifySubscription: " +
1917 ph.GetProvider().getName());
1918
1919 pm_service_op_lock op_lock(&ph.GetProvider());
1920
1921 chip 1.1 ph.GetProvider().modifySubscription(
1922 context,
1923 subscriptionName,
1924 classNames,
1925 propertyList,
1926 repeatNotificationPolicy);
1927 }
1928 catch(CIMException & e)
1929 {
1930 PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
1931 "Exception: " + e.getMessage());
|
1932 chip 1.2
|
1933 chip 1.1 handler.setStatus(e.getCode(), e.getContentLanguages(), e.getMessage()); // l10n
1934 }
1935 catch(Exception & e)
1936 {
1937 PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
1938 "Exception: " + e.getMessage());
|
1939 chip 1.2
|
1940 chip 1.1 handler.setStatus(CIM_ERR_FAILED, e.getContentLanguages(), e.getMessage()); // l10n
1941 }
1942 catch(...)
1943 {
1944 PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
1945 "Exception: Unknown");
|
1946 chip 1.2
|
1947 chip 1.1 handler.setStatus(CIM_ERR_FAILED, "Unknown Error");
1948 }
1949
1950 PEG_METHOD_EXIT();
1951
1952 return(response);
1953 }
1954
1955 Message * DefaultProviderManager::handleDeleteSubscriptionRequest(const Message * message) throw()
1956 {
1957 PEG_METHOD_ENTER(TRC_PROVIDERMANAGER, "DefaultProviderManager::handleDeleteSubscriptionRequest");
1958
1959 CIMDeleteSubscriptionRequestMessage * request =
1960 dynamic_cast<CIMDeleteSubscriptionRequestMessage *>(const_cast<Message *>(message));
1961
1962 PEGASUS_ASSERT(request != 0);
1963
1964 CIMDeleteSubscriptionResponseMessage * response =
1965 new CIMDeleteSubscriptionResponseMessage(
1966 request->messageId,
1967 CIMException(),
1968 chip 1.1 request->queueIds.copyAndPop());
1969
1970 PEGASUS_ASSERT(response != 0);
1971
1972 // preserve message key
1973 response->setKey(request->getKey());
1974
1975 // Set HTTP method in response from request
1976 response->setHttpMethod(request->getHttpMethod());
1977
1978 OperationResponseHandler handler(request, response);
1979
1980 try
1981 {
|
1982 chip 1.2 String temp;
1983
1984 for(Uint32 i = 0, n = request->classNames.size(); i < n; i++)
1985 {
1986 temp.append(request->classNames[i].getString());
1987
1988 if(i == (n - 1))
1989 {
1990 temp.append(", ");
1991 }
1992 }
1993
1994 Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE,
1995 "DefaultProviderManager::handleDeleteSubscriptionRequest - Host name: $0 Name space: $1 Class name(s): $2",
1996 System::getHostName(),
1997 request->nameSpace.getString(),
1998 temp);
1999
2000 // NOTE: the provider and provider module name are embedded in the request, presumably to reduce
2001 // the number of provider lookups (but this should be trivial if the data is cached and accessed
2002 // from the same source). to keep the lookups consistent, use the first class name, combined
2003 chip 1.2 // with the other information in the request, and create an object path that can be used to
2004 // resolve the provider using the ProviderRegistrar.
2005
2006 // make target object path
2007 CIMObjectPath objectPath(
2008 System::getHostName(),
2009 request->nameSpace,
2010 request->classNames[0].getString());
|
2011 chip 1.1
|
2012 chip 1.4 ProviderName name(
2013 objectPath.toString(),
|
2014 chip 1.1 String::EMPTY,
2015 String::EMPTY,
|
2016 chip 1.4 String::EMPTY,
2017 0);
|
2018 chip 1.1
|
2019 chip 1.5 // resolve provider name
2020 name = _resolveProviderName(name);
|
2021 chip 1.1
2022 // get cached or load new provider module
2023 OpProviderHolder ph =
2024 providerManager.getProvider(name.getPhysicalName(), name.getLogicalName(), String::EMPTY);
2025
2026 // convert arguments
2027 OperationContext context;
2028
2029 context.insert(IdentityContainer(request->userName));
2030 context.insert(SubscriptionInstanceContainer
2031 (request->subscriptionInstance));
2032 context.insert(SubscriptionLanguageListContainer
2033 (request->acceptLanguages));
2034 context.insert(AcceptLanguageListContainer(request->acceptLanguages));
2035 context.insert(ContentLanguageListContainer(request->contentLanguages));
2036
2037 CIMObjectPath subscriptionName = request->subscriptionInstance.getPath();
2038
2039 Array<CIMObjectPath> classNames;
2040
2041 for(Uint32 i = 0, n = request->classNames.size(); i < n; i++)
2042 chip 1.1 {
2043 CIMObjectPath className(
2044 System::getHostName(),
2045 request->nameSpace,
2046 request->classNames[i]);
2047
2048 classNames.append(className);
2049 }
2050
2051 PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
2052 "Calling provider.deleteSubscription: " +
2053 ph.GetProvider().getName());
2054
2055 pm_service_op_lock op_lock(&ph.GetProvider());
2056
2057 ph.GetProvider().deleteSubscription(
2058 context,
2059 subscriptionName,
2060 classNames);
2061 }
2062 catch(CIMException & e)
2063 chip 1.1 {
2064 PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
2065 "Exception: " + e.getMessage());
|
2066 chip 1.2
|
2067 chip 1.1 handler.setStatus(e.getCode(), e.getContentLanguages(), e.getMessage()); // l10n
2068 }
2069 catch(Exception & e)
2070 {
2071 PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
2072 "Exception: " + e.getMessage());
|
2073 chip 1.2
|
2074 chip 1.1 handler.setStatus(CIM_ERR_FAILED, e.getContentLanguages(), e.getMessage()); // l10n
2075 }
2076 catch(...)
2077 {
2078 PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
2079 "Exception: Unknown");
|
2080 chip 1.2
|
2081 chip 1.1 handler.setStatus(CIM_ERR_FAILED, "Unknown Error");
2082 }
2083
2084 PEG_METHOD_EXIT();
2085
2086 return(response);
2087 }
2088
2089 Message * DefaultProviderManager::handleEnableIndicationsRequest(const Message * message) throw()
2090 {
2091 PEG_METHOD_ENTER(TRC_PROVIDERMANAGER, "DefaultProviderManager:: handleEnableIndicationsRequest");
2092
2093 CIMEnableIndicationsRequestMessage * request =
2094 dynamic_cast<CIMEnableIndicationsRequestMessage *>(const_cast<Message *>(message));
2095
2096 PEGASUS_ASSERT(request != 0);
2097
2098 CIMEnableIndicationsResponseMessage * response =
2099 new CIMEnableIndicationsResponseMessage(
2100 request->messageId,
2101 CIMException(),
2102 chip 1.1 request->queueIds.copyAndPop());
2103
2104 CIMEnableIndicationsResponseMessage * responseforhandler =
2105 new CIMEnableIndicationsResponseMessage(
2106 request->messageId,
2107 CIMException(),
2108 request->queueIds.copyAndPop());
2109
2110 PEGASUS_ASSERT(response != 0);
2111
2112 // preserve message key
2113 response->setKey(request->getKey());
2114
2115 // Set HTTP method in response from request
2116 response->setHttpMethod(request->getHttpMethod());
2117
2118 response->dest = request->queueIds.top();
2119
2120 /*
2121 // ATTN: need pointer to Provider Manager Server!
2122 //EnableIndicationsResponseHandler *handler =
2123 chip 1.1 // new EnableIndicationsResponseHandler(request, response, this);
2124
2125 try
2126 {
2127 // get the provider file name and logical name
2128 Triad<String, String, String> triad =
2129 _getProviderRegPair(request->provider, request->providerModule);
2130
2131 // get cached or load new provider module
2132 //Provider provider =
2133 OpProviderHolder ph =
2134 providerManager.getProvider(triad.first, triad.second, triad.third);
2135
2136 PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
2137 "Calling provider.enableIndications: " +
2138 ph.GetProvider().getName());
2139 ph.GetProvider().protect();
2140 ph.GetProvider().enableIndications(*handler);
2141
2142
2143 // if no exception, store the handler so it is persistent for as
2144 chip 1.1 // long as the provider has indications enabled.
2145 PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
2146 "Storing indication handler for " + ph.GetProvider().getName());
2147
2148 _insertEntry(ph.GetProvider(), handler);
2149 }
2150 catch(CIMException & e)
2151 {
2152 PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
2153 "Exception: " + e.getMessage());
2154 response->cimException = CIMException(e);
2155 }
2156 catch(Exception & e)
2157 {
2158 PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
2159 "Exception: " + e.getMessage());
2160 //l10n
2161 //response->cimException = CIMException(CIM_ERR_FAILED, "Internal Error");
2162 response->cimException = CIMException(CIM_ERR_FAILED, MessageLoaderParms(
2163 "ProviderManager.DefaultProviderManager.INTERNAL_ERROR",
2164 "Internal Error"));
2165 chip 1.1 }
2166 catch(...)
2167 {
2168 PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
2169 "Exception: Unknown");
2170 //l10n
2171 //response->cimException = CIMException(CIM_ERR_FAILED, "Unknown Error");
2172 response->cimException = CIMException(CIM_ERR_FAILED, MessageLoaderParms(
2173 "ProviderManager.DefaultProviderManager.UNKNOWN_ERROR",
2174 "Unknown Error"));
2175 }
2176 */
2177
2178 PEG_METHOD_EXIT();
2179
2180 return(response);
2181 }
2182
2183 Message * DefaultProviderManager::handleDisableIndicationsRequest(const Message * message) throw()
2184 {
2185 PEG_METHOD_ENTER(TRC_PROVIDERMANAGER, "DefaultProviderManager::handleDisableIndicationsRequest");
2186 chip 1.1
2187 CIMDisableIndicationsRequestMessage * request =
2188 dynamic_cast<CIMDisableIndicationsRequestMessage *>(const_cast<Message *>(message));
2189
2190 PEGASUS_ASSERT(request != 0);
2191
2192 CIMDisableIndicationsResponseMessage * response =
2193 new CIMDisableIndicationsResponseMessage(
2194 request->messageId,
2195 CIMException(),
2196 request->queueIds.copyAndPop());
2197
2198 PEGASUS_ASSERT(response != 0);
2199
2200 // preserve message key
2201 response->setKey(request->getKey());
2202
2203 // Set HTTP method in response from request
2204 response->setHttpMethod (request->getHttpMethod ());
2205
2206 OperationResponseHandler handler(request, response);
2207 chip 1.1
2208 try
2209 {
|
2210 chip 1.6 ProviderName name(
2211 String::EMPTY,
2212 String::EMPTY,
2213 String::EMPTY,
2214 String::EMPTY,
2215 0);
|
2216 chip 1.1 /*
|
2217 chip 1.4 ProviderName name(
|
2218 chip 1.1 String::EMPTY,
2219 String::EMPTY,
2220 objectPath.toString());
2221
|
2222 chip 1.5 // resolve provider name
2223 name = _resolveProviderName(name);
|
2224 chip 1.1 */
2225
2226 // get cached or load new provider module
2227 OpProviderHolder ph =
2228 providerManager.getProvider(name.getPhysicalName(), name.getLogicalName(), String::EMPTY);
2229
2230 /*
2231 // get the provider file name and logical name
2232 Triad<String, String, String> triad =
2233 getProviderRegistrar()->_getProviderRegPair(request->provider, request->providerModule);
2234
2235 // get cached or load new provider module
2236 //Provider provider =
2237 OpProviderHolder ph =
2238 providerManager.getProvider(triad.first, triad.second, triad.third);
2239 */
2240
2241 PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
2242 "Calling provider.disableIndications: " +
2243 ph.GetProvider().getName());
2244
2245 chip 1.1 ph.GetProvider().disableIndications();
2246
2247 ph.GetProvider().unprotect();
2248
2249 PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
2250 "Removing and Destroying indication handler for " +
2251 ph.GetProvider().getName());
2252
2253 delete _removeEntry(_generateKey(ph.GetProvider()));
2254 }
2255
2256 catch(CIMException & e)
2257 {
2258 PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
2259 "Exception: " + e.getMessage());
|
2260 chip 1.2
|
2261 chip 1.1 response->cimException = CIMException(e);
2262 }
2263 catch(Exception & e)
2264 {
2265 PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
2266 "Exception: " + e.getMessage());
|
2267 chip 1.2 response->cimException = CIMException(CIM_ERR_FAILED, MessageLoaderParms(
|
2268 chip 1.1 "ProviderManager.DefaultProviderManager.INTERNAL_ERROR",
2269 "Internal Error"));
2270 }
2271 catch(...)
2272 {
2273 PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
2274 "Exception: Unknown");
|
2275 chip 1.2 response->cimException = CIMException(CIM_ERR_FAILED, MessageLoaderParms(
|
2276 chip 1.1 "ProviderManager.DefaultProviderManager.UNKNOWN_ERROR",
2277 "Unknown Error"));
2278 }
2279
2280 PEG_METHOD_EXIT();
2281
2282 return(response);
2283 }
2284
2285 Message * DefaultProviderManager::handleConsumeIndicationRequest(const Message *message) throw()
2286 {
2287 PEG_METHOD_ENTER(TRC_PROVIDERMANAGER, "DefaultProviderManager::handlConsumeIndicationRequest");
2288
2289 CIMConsumeIndicationRequestMessage *request =
2290 dynamic_cast<CIMConsumeIndicationRequestMessage *>(const_cast<Message *>(message));
2291
2292 PEGASUS_ASSERT(request != 0);
2293
2294 CIMResponseMessage * response =
2295 new CIMResponseMessage(
2296 CIM_CONSUME_INDICATION_RESPONSE_MESSAGE,
2297 chip 1.1 request->messageId,
2298 CIMException(),
2299 request->queueIds.copyAndPop());
2300
2301 PEGASUS_ASSERT(response != 0);
2302
2303 response->setKey(request->getKey());
2304
2305 // Set HTTP method in response from request
2306 response->setHttpMethod (request->getHttpMethod ());
2307
2308 Uint32 type = 3;
2309
2310 try
2311 {
|
2312 chip 1.6 ProviderName name(
2313 String::EMPTY,
2314 String::EMPTY,
2315 String::EMPTY,
2316 String::EMPTY,
2317 0);
|
2318 chip 1.1
2319 /*
|
2320 chip 1.4 ProviderName name(
|
2321 chip 1.1 String::EMPTY,
2322 String::EMPTY,
2323 objectPath.toString());
2324
|
2325 chip 1.5 // resolve provider name
2326 name = _resolveProviderName(name);
|
2327 chip 1.1 */
2328
2329 // get cached or load new provider module
2330 OpProviderHolder ph =
2331 providerManager.getProvider(name.getPhysicalName(), name.getLogicalName(), String::EMPTY);
2332
2333 PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
2334 "Calling provider.: " +
2335 ph.GetProvider().getName());
2336
2337 OperationContext context;
2338
2339 //l10n
2340 // ATTN-CEC 06/04/03 NOTE: I can't find where the consume msg is sent. This
2341 // does not appear to be hooked-up. When it is added, need to
2342 // make sure that Content-Language is set in the consume msg.
2343 // NOTE: A-L is not needed to be set in the consume msg.
2344 // add the langs to the context
2345 context.insert(ContentLanguageListContainer(request->contentLanguages));
2346
2347 CIMInstance indication_copy = request->indicationInstance;
2348 chip 1.1
2349 SimpleIndicationResponseHandler handler;
2350
2351 ph.GetProvider().consumeIndication(context,
2352 "",
2353 indication_copy);
2354 }
2355 catch(CIMException & e)
2356 {
2357 PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
2358 "Exception: " + e.getMessage());
|
2359 chip 1.2
|
2360 chip 1.1 response->cimException = CIMException(e);
2361 }
2362 catch(Exception & e)
2363 {
2364 PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
2365 "Exception: " + e.getMessage());
2366 //l10n
2367 //response->cimException = CIMException(CIM_ERR_FAILED, "Internal Error");
2368 response->cimException = CIMException(CIM_ERR_FAILED, MessageLoaderParms(
2369 "ProviderManager.DefaultProviderManager.INTERNAL_ERROR",
2370 "Internal Error"));
2371 }
2372 catch(...)
2373 {
2374 PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
2375 "Exception: Unknown");
2376 //l10n
2377 //response->cimException = CIMException(CIM_ERR_FAILED, "Unknown Error");
2378 response->cimException = CIMException(CIM_ERR_FAILED, MessageLoaderParms(
2379 "ProviderManager.DefaultProviderManager.UNKNOWN_ERROR",
2380 "Unknown Error"));
2381 chip 1.1 }
2382
2383 PEG_METHOD_EXIT();
2384
2385 return(response);
2386 }
2387
2388 //
2389 // This function disables a provider module if disableProviderOnly is not true,
2390 // otherwise, disables a provider. Disable provider module means that
2391 // block all the providers which contain in the module and unload the
2392 // providers.
2393 // Disable provider means unload the provider and the provider is not blocked.
2394 //
2395 // ATTN-YZ-P2-20030519: Provider needs to be blocked when disable a provider.
2396 //
2397 Message * DefaultProviderManager::handleDisableModuleRequest(const Message * message) throw()
2398 {
2399 // HACK
|
2400 chip 1.4 ProviderRegistrationManager * _providerRegistrationManager = GetProviderRegistrationManager();
|
2401 chip 1.1
2402 PEG_METHOD_ENTER(TRC_PROVIDERMANAGER, "DefaultProviderManager::handleDisableModuleRequest");
2403
2404 CIMDisableModuleRequestMessage * request =
2405 dynamic_cast<CIMDisableModuleRequestMessage *>(const_cast<Message *>(message));
2406
2407 PEGASUS_ASSERT(request != 0);
2408
2409 // get provider module name
2410 String moduleName;
2411 CIMInstance mInstance = request->providerModule;
2412 Uint32 pos = mInstance.findProperty(CIMName ("Name"));
2413
2414 if(pos != PEG_NOT_FOUND)
2415 {
2416 mInstance.getProperty(pos).getValue().get(moduleName);
2417 }
2418
2419 Boolean disableProviderOnly = request->disableProviderOnly;
2420
2421 //
2422 chip 1.1 // get operational status
2423 //
2424 Array<Uint16> operationalStatus;
2425
2426 if(!disableProviderOnly)
2427 {
2428 Uint32 pos2 = mInstance.findProperty(CIMName ("OperationalStatus"));
|
2429 chip 1.2
|
2430 chip 1.1 if(pos2 != PEG_NOT_FOUND)
2431 {
2432 //
2433 // ATTN-CAKG-P2-20020821: Check for null status?
2434 //
2435 mInstance.getProperty(pos2).getValue().get(operationalStatus);
2436 }
2437
2438 //
2439 // update module status from OK to Stopping
2440 //
2441 for(Uint32 i=0, n = operationalStatus.size(); i < n; i++)
2442 {
2443 if(operationalStatus[i] == _MODULE_OK)
2444 {
2445 operationalStatus.remove(i);
2446 }
2447 }
2448 operationalStatus.append(_MODULE_STOPPING);
2449
2450 if(_providerRegistrationManager->setProviderModuleStatus
2451 chip 1.1 (moduleName, operationalStatus) == false)
2452 {
2453 //l10n
2454 //throw PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED, "set module status failed.");
2455 throw PEGASUS_CIM_EXCEPTION_L(CIM_ERR_FAILED, MessageLoaderParms(
2456 "ProviderManager.DefaultProviderManager.SET_MODULE_STATUS_FAILED",
2457 "set module status failed."));
2458 }
2459 }
2460
2461 // Unload providers
2462 Array<CIMInstance> _pInstances = request->providers;
2463
2464 for(Uint32 i = 0, n = _pInstances.size(); i < n; i++)
2465 {
2466 /* temp disabled by Chip
2467 // get the provider file name and logical name
2468 Triad<String, String, String> triad =
2469 getProviderRegistrar()->_getProviderRegPair(_pInstances[i], mInstance);
2470
2471 providerManager.unloadProvider(triad.first, triad.second);
2472 chip 1.1 */
2473 }
2474
2475 if(!disableProviderOnly)
2476 {
2477 // update module status from Stopping to Stopped
2478 for(Uint32 i=0, n = operationalStatus.size(); i < n; i++)
2479 {
2480 if(operationalStatus[i] == _MODULE_STOPPING)
2481 {
2482 operationalStatus.remove(i);
2483 }
2484 }
|
2485 chip 1.2
|
2486 chip 1.1 operationalStatus.append(_MODULE_STOPPED);
2487
2488 if(_providerRegistrationManager->setProviderModuleStatus
2489 (moduleName, operationalStatus) == false)
2490 {
2491 //l10n
2492 //throw PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED,
2493 //"set module status failed.");
2494 throw PEGASUS_CIM_EXCEPTION_L(CIM_ERR_FAILED, MessageLoaderParms(
2495 "ProviderManager.DefaultProviderManager.SET_MODULE_STATUS_FAILED",
2496 "set module status failed."));
2497 }
2498 }
2499
2500 CIMDisableModuleResponseMessage * response =
2501 new CIMDisableModuleResponseMessage(
2502 request->messageId,
2503 CIMException(),
2504 request->queueIds.copyAndPop(),
2505 operationalStatus);
2506
2507 chip 1.1 PEGASUS_ASSERT(response != 0);
2508
2509 // preserve message key
2510 response->setKey(request->getKey());
2511
2512 //
2513 // Set HTTP method in response from request
2514 //
2515 response->setHttpMethod (request->getHttpMethod ());
2516
2517 PEG_METHOD_EXIT();
2518
2519 return(response);
2520 }
2521
2522 Message * DefaultProviderManager::handleEnableModuleRequest(const Message * message) throw()
2523 {
2524 // HACK
|
2525 chip 1.4 ProviderRegistrationManager * _providerRegistrationManager = GetProviderRegistrationManager();
|
2526 chip 1.1
2527 PEG_METHOD_ENTER(TRC_PROVIDERMANAGER, "DefaultProviderManager::handleEnableModuleRequest");
2528
2529 CIMEnableModuleRequestMessage * request =
2530 dynamic_cast<CIMEnableModuleRequestMessage *>(const_cast<Message *>(message));
2531
2532 PEGASUS_ASSERT(request != 0);
2533
2534 //
2535 // get module status
2536 //
2537 CIMInstance mInstance = request->providerModule;
2538 Array<Uint16> operationalStatus;
2539 Uint32 pos = mInstance.findProperty(CIMName ("OperationalStatus"));
2540
2541 if(pos != PEG_NOT_FOUND)
2542 {
2543 //
2544 // ATTN-CAKG-P2-20020821: Check for null status?
2545 //
2546 mInstance.getProperty(pos).getValue().get(operationalStatus);
2547 chip 1.1 }
2548
2549 // update module status from Stopped to OK
2550 for(Uint32 i=0, n = operationalStatus.size(); i < n; i++)
2551 {
2552 if(operationalStatus[i] == _MODULE_STOPPED)
2553 {
2554 operationalStatus.remove(i);
2555 }
2556 }
2557
2558 operationalStatus.append(_MODULE_OK);
2559
2560 //
2561 // get module name
2562 //
2563 String moduleName;
2564
2565 Uint32 pos2 = mInstance.findProperty(CIMName ("Name"));
2566
2567 if(pos2 != PEG_NOT_FOUND)
2568 chip 1.1 {
2569 mInstance.getProperty(pos2).getValue().get(moduleName);
2570 }
2571
2572 if(_providerRegistrationManager->setProviderModuleStatus
2573 (moduleName, operationalStatus) == false)
2574 {
2575 //l10n
2576 //throw PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED, "set module status failed.");
2577 throw PEGASUS_CIM_EXCEPTION_L(CIM_ERR_FAILED, MessageLoaderParms(
2578 "ProviderManager.DefaultProviderManager.SET_MODULE_STATUS_FAILED",
2579 "set module status failed."));
2580 }
2581
2582 CIMEnableModuleResponseMessage * response =
2583 new CIMEnableModuleResponseMessage(
2584 request->messageId,
2585 CIMException(),
2586 request->queueIds.copyAndPop(),
2587 operationalStatus);
2588
2589 chip 1.1 PEGASUS_ASSERT(response != 0);
2590
2591 // preserve message key
2592 response->setKey(request->getKey());
2593
2594 // Set HTTP method in response from request
2595 response->setHttpMethod (request->getHttpMethod ());
2596
2597 PEG_METHOD_EXIT();
2598
2599 return(response);
2600 }
2601
2602 Message * DefaultProviderManager::handleStopAllProvidersRequest(const Message * message) throw()
2603 {
2604 PEG_METHOD_ENTER(TRC_PROVIDERMANAGER, "DefaultProviderManager::handleStopAllProvidersRequest");
2605
2606 CIMStopAllProvidersRequestMessage * request =
2607 dynamic_cast<CIMStopAllProvidersRequestMessage *>(const_cast<Message *>(message));
2608
2609 PEGASUS_ASSERT(request != 0);
2610 chip 1.1
2611 CIMStopAllProvidersResponseMessage * response =
2612 new CIMStopAllProvidersResponseMessage(
2613 request->messageId,
2614 CIMException(),
2615 request->queueIds.copyAndPop());
2616
2617 PEGASUS_ASSERT(response != 0);
2618
2619 // preserve message key
2620 response->setKey(request->getKey());
2621
2622 // Set HTTP method in response from request
2623 response->setHttpMethod (request->getHttpMethod ());
2624
2625 // tell the provider manager to shutdown all the providers
2626 providerManager.shutdownAllProviders();
2627
2628 PEG_METHOD_EXIT();
2629
2630 return(response);
2631 chip 1.1 }
2632
2633 void DefaultProviderManager::_insertEntry (
2634 const Provider & provider,
2635 const EnableIndicationsResponseHandler *handler)
2636 {
2637 PEG_METHOD_ENTER (TRC_INDICATION_SERVICE,
2638 "DefaultProviderManager::_insertEntry");
2639
2640 String tableKey = _generateKey
2641 (provider);
2642
2643 _responseTable.insert (tableKey, const_cast<EnableIndicationsResponseHandler *>(handler));
2644
2645 PEG_METHOD_EXIT();
2646 }
2647
2648 EnableIndicationsResponseHandler * DefaultProviderManager::_removeEntry(
2649 const String & key)
2650 {
2651 PEG_METHOD_ENTER (TRC_INDICATION_SERVICE,
2652 chip 1.1 "DefaultProviderManager::_removeEntry");
2653 EnableIndicationsResponseHandler *ret = 0;
2654
2655 _responseTable.lookup(key, ret);
2656
2657 PEG_METHOD_EXIT();
2658
2659 return(ret);
2660 }
2661
2662 String DefaultProviderManager::_generateKey (
2663 const Provider & provider)
2664 {
2665 String tableKey;
2666
2667 PEG_METHOD_ENTER (TRC_INDICATION_SERVICE,
2668 "DefaultProviderManager::_generateKey");
2669
2670 //
2671 // Append provider key values to key
2672 //
2673 chip 1.1 String providerName = provider.getName();
2674 String providerFileName = provider.getModule()->getFileName();
2675 tableKey.append (providerName);
2676 tableKey.append (providerFileName);
2677
2678 PEG_METHOD_EXIT();
2679
2680 return(tableKey);
|
2681 chip 1.5 }
2682
2683 ProviderName DefaultProviderManager::_resolveProviderName(const ProviderName & providerName)
2684 {
2685 ProviderName temp = findProvider(providerName);
2686
2687 String physicalName = temp.getPhysicalName();
2688
2689 // fully qualify physical provider name (module), if not already done so.
2690 #if defined(PEGASUS_PLATFORM_WIN32_IX86_MSVC)
2691 physicalName = physicalName + String(".dll");
2692 #elif defined(PEGASUS_PLATFORM_LINUX_IX86_GNU) || defined(PEGASUS_PLATFORM_LINUX_IA86_GNU)
2693 String root = ConfigManager::getHomedPath(ConfigManager::getInstance()->getCurrentValue("providerDir"));
2694 physicalName = root + String("/lib") + physicalName + String(".so"));
2695 #elif defined(PEGASUS_OS_HPUX)
2696 String root = ConfigManager::getHomedPath(ConfigManager::getInstance()->getCurrentValue("providerDir"));
2697 physicalName = root + String("/lib") + moduleLocation + String(".sl"));
2698 #elif defined(PEGASUS_OS_OS400)
2699 // do nothing
2700 #else
2701 foo // needs code
2702 chip 1.5 #endif
2703
2704 temp.setPhysicalName(physicalName);
2705
2706 return(temp);
|
2707 chip 1.1 }
2708
2709 PEGASUS_NAMESPACE_END
|