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