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