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