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 schuur 1.19 //
|
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 schuur 1.19 CIMObjectPath assocPath(
1037 System::getHostName(),
1038 request->nameSpace,
1039 request->assocClass.getString());
1040
|
1041 chip 1.4 ProviderName name(
|
1042 schuur 1.19 assocPath.toString(),
|
1043 chip 1.2 String::EMPTY,
1044 String::EMPTY,
|
1045 chip 1.4 String::EMPTY,
|
1046 schuur 1.11 ProviderType::ASSOCIATION);
|
1047 chip 1.2
|
1048 chip 1.5 // resolve provider name
1049 name = _resolveProviderName(name);
|
1050 chip 1.2
1051 // get cached or load new provider module
1052 OpProviderHolder ph =
|
1053 schuur 1.10 providerManager.getProvider(name.getPhysicalName(), name.getLogicalName(), String::EMPTY);
|
1054 chip 1.2
1055 // convert arguments
1056 OperationContext context;
1057
1058 context.insert(IdentityContainer(request->userName));
1059 context.insert(AcceptLanguageListContainer(request->acceptLanguages));
1060 context.insert(ContentLanguageListContainer(request->contentLanguages));
|
1061 chip 1.1
|
1062 chip 1.2 // ATTN KS STAT_GETSTARTTIME;
1063 pm_service_op_lock op_lock(&ph.GetProvider());
|
1064 chip 1.1
|
1065 chip 1.2 ph.GetProvider().associators(
1066 context,
1067 objectPath,
1068 request->assocClass,
1069 request->resultClass,
1070 request->role,
1071 request->resultRole,
1072 request->includeQualifiers,
1073 request->includeClassOrigin,
1074 request->propertyList.getPropertyNameArray(),
1075 handler);
|
1076 chip 1.1
|
1077 chip 1.2 STAT_PMS_PROVIDEREND;
|
1078 chip 1.1 }
1079 catch(CIMException & e)
1080 {
1081 PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
1082 "Exception: " + e.getMessage());
|
1083 chip 1.2
|
1084 chip 1.1 handler.setStatus(e.getCode(), e.getContentLanguages(), e.getMessage()); // l10n
1085 }
1086 catch(Exception & e)
1087 {
1088 PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
1089 "Exception: " + e.getMessage());
|
1090 chip 1.2
|
1091 chip 1.1 handler.setStatus(CIM_ERR_FAILED, e.getContentLanguages(), e.getMessage()); // l10n
1092 }
1093 catch(...)
1094 {
1095 PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
1096 "Exception: Unknown");
|
1097 chip 1.2
|
1098 chip 1.1 handler.setStatus(CIM_ERR_FAILED, "Unknown error.");
1099 }
1100
1101 PEG_METHOD_EXIT();
1102
1103 return(response);
1104 }
1105
1106 Message * DefaultProviderManager::handleAssociatorNamesRequest(const Message * message) throw()
1107 {
1108 PEG_METHOD_ENTER(TRC_PROVIDERMANAGER, "DefaultProviderManager::handleAssociatorNamesRequest");
1109
1110 CIMAssociatorNamesRequestMessage * request =
1111 dynamic_cast<CIMAssociatorNamesRequestMessage *>(const_cast<Message *>(message));
1112
1113 PEGASUS_ASSERT(request != 0);
1114
1115 CIMAssociatorNamesResponseMessage * response =
1116 new CIMAssociatorNamesResponseMessage(
1117 request->messageId,
1118 CIMException(),
1119 chip 1.1 request->queueIds.copyAndPop(),
1120 Array<CIMObjectPath>());
1121
1122 PEGASUS_ASSERT(response != 0);
1123
1124 // preserve message key
1125 response->setKey(request->getKey());
1126
1127 // Set HTTP method in response from request
1128 response->setHttpMethod(request->getHttpMethod());
1129
1130 // create a handler for this request
1131 AssociatorNamesResponseHandler handler(request, response);
1132
1133 // process the request
1134 try
1135 {
1136 Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE,
1137 "DefaultProviderManager::handleAssociationNamesRequest - Host name: $0 Name space: $1 Class name: $2",
1138 System::getHostName(),
1139 request->nameSpace.getString(),
1140 chip 1.1 request->objectName.getClassName().getString());
1141
1142 // make target object path
1143 CIMObjectPath objectPath(
1144 System::getHostName(),
1145 request->nameSpace,
1146 request->objectName.getClassName());
1147
1148 objectPath.setKeyBindings(request->objectName.getKeyBindings());
1149
|
1150 schuur 1.19 CIMObjectPath assocPath(
1151 System::getHostName(),
1152 request->nameSpace,
1153 request->assocClass.getString());
1154
|
1155 chip 1.4 ProviderName name(
|
1156 schuur 1.19 assocPath.toString(),
|
1157 chip 1.2 String::EMPTY,
1158 String::EMPTY,
|
1159 chip 1.4 String::EMPTY,
|
1160 schuur 1.11 ProviderType::ASSOCIATION);
|
1161 chip 1.2
|
1162 chip 1.5 // resolve provider name
1163 name = _resolveProviderName(name);
|
1164 chip 1.2
1165 // get cached or load new provider module
1166 OpProviderHolder ph =
|
1167 schuur 1.10 providerManager.getProvider(name.getPhysicalName(), name.getLogicalName(), String::EMPTY);
|
1168 chip 1.2
1169 // convert arguments
1170 OperationContext context;
|
1171 chip 1.1
|
1172 chip 1.2 context.insert(IdentityContainer(request->userName));
1173 context.insert(AcceptLanguageListContainer(request->acceptLanguages));
1174 context.insert(ContentLanguageListContainer(request->contentLanguages));
|
1175 chip 1.1
|
1176 chip 1.2 pm_service_op_lock op_lock(&ph.GetProvider());
|
1177 chip 1.1
|
1178 chip 1.2 ph.GetProvider().associatorNames(
1179 context,
1180 objectPath,
1181 request->assocClass,
1182 request->resultClass,
1183 request->role,
1184 request->resultRole,
1185 handler);
|
1186 chip 1.1
|
1187 chip 1.2 STAT_PMS_PROVIDEREND;
|
1188 chip 1.1 }
1189 catch(CIMException & e)
1190 {
|
1191 chip 1.2 PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
1192 "Exception: " + e.getMessage());
1193
|
1194 chip 1.1 handler.setStatus(e.getCode(), e.getContentLanguages(), e.getMessage()); // l10n
1195 }
1196 catch(Exception & e)
1197 {
|
1198 chip 1.2 PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
1199 "Exception: " + e.getMessage());
1200
|
1201 chip 1.1 handler.setStatus(CIM_ERR_FAILED, e.getContentLanguages(), e.getMessage()); // l10n
1202 }
1203 catch(...)
1204 {
1205 PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
1206 "Exception: Unknown");
|
1207 chip 1.2
|
1208 chip 1.1 handler.setStatus(CIM_ERR_FAILED, "Unknown error.");
1209 }
1210
1211 PEG_METHOD_EXIT();
1212
1213 return(response);
1214 }
1215
1216 Message * DefaultProviderManager::handleReferencesRequest(const Message * message) throw()
1217 {
1218 PEG_METHOD_ENTER(TRC_PROVIDERMANAGER, "DefaultProviderManager::handleReferencesRequest");
1219
1220 CIMReferencesRequestMessage * request =
1221 dynamic_cast<CIMReferencesRequestMessage *>(const_cast<Message *>(message));
1222
1223 PEGASUS_ASSERT(request != 0);
1224
1225 CIMReferencesResponseMessage * response =
1226 new CIMReferencesResponseMessage(
1227 request->messageId,
1228 CIMException(),
1229 chip 1.1 request->queueIds.copyAndPop(),
1230 Array<CIMObject>());
1231
1232 PEGASUS_ASSERT(response != 0);
1233
1234 // preserve message key
1235 response->setKey(request->getKey());
1236
1237 // Set HTTP method in response from request
1238 response->setHttpMethod (request->getHttpMethod ());
1239
1240 // create a handler for this request
1241 ReferencesResponseHandler handler(request, response);
1242
1243 // process the request
1244 try
1245 {
1246 Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE,
1247 "DefaultProviderManager::handleReferencesRequest - Host name: $0 Name space: $1 Class name: $2",
1248 System::getHostName(),
1249 request->nameSpace.getString(),
1250 chip 1.1 request->objectName.getClassName().getString());
1251
1252 // make target object path
1253 CIMObjectPath objectPath(
1254 System::getHostName(),
1255 request->nameSpace,
1256 request->objectName.getClassName());
1257
1258 objectPath.setKeyBindings(request->objectName.getKeyBindings());
1259
|
1260 schuur 1.19 CIMObjectPath resultPath(
1261 System::getHostName(),
1262 request->nameSpace,
1263 request->resultClass.getString());
1264
|
1265 chip 1.4 ProviderName name(
|
1266 schuur 1.19 resultPath.toString(),
|
1267 chip 1.2 String::EMPTY,
1268 String::EMPTY,
|
1269 chip 1.4 String::EMPTY,
|
1270 schuur 1.11 ProviderType::ASSOCIATION);
|
1271 chip 1.2
|
1272 chip 1.5 // resolve provider name
1273 name = _resolveProviderName(name);
|
1274 chip 1.2
1275 // get cached or load new provider module
1276 OpProviderHolder ph =
|
1277 schuur 1.10 providerManager.getProvider(name.getPhysicalName(), name.getLogicalName(), String::EMPTY);
|
1278 chip 1.2
1279 // convert arguments
1280 OperationContext context;
1281
1282 context.insert(IdentityContainer(request->userName));
1283 context.insert(AcceptLanguageListContainer(request->acceptLanguages));
1284 context.insert(ContentLanguageListContainer(request->contentLanguages));
1285
1286 STAT_GETSTARTTIME;
|
1287 chip 1.1
|
1288 chip 1.2 PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
1289 "Calling provider.references: " +
1290 ph.GetProvider().getName());
|
1291 chip 1.1
|
1292 chip 1.2 pm_service_op_lock op_lock(&ph.GetProvider());
|
1293 chip 1.1
|
1294 chip 1.2 ph.GetProvider().references(
1295 context,
1296 objectPath,
1297 request->resultClass,
1298 request->role,
1299 request->includeQualifiers,
1300 request->includeClassOrigin,
1301 request->propertyList.getPropertyNameArray(),
1302 handler);
|
1303 chip 1.1
|
1304 chip 1.2 STAT_PMS_PROVIDEREND;
|
1305 chip 1.1 }
1306 catch(CIMException & e)
1307 {
1308 PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
1309 "Exception: " + e.getMessage());
|
1310 chip 1.2
|
1311 chip 1.1 handler.setStatus(e.getCode(), e.getContentLanguages(), e.getMessage()); // l10n
1312 }
1313 catch(Exception & e)
1314 {
1315 PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
1316 "Exception: " + e.getMessage());
|
1317 chip 1.2
|
1318 chip 1.1 handler.setStatus(CIM_ERR_FAILED, e.getContentLanguages(), e.getMessage()); // l10n
1319 }
1320 catch(...)
1321 {
1322 PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
1323 "Exception: Unknown");
|
1324 chip 1.2
|
1325 chip 1.1 handler.setStatus(CIM_ERR_FAILED, "Unknown error.");
1326 }
1327
1328 PEG_METHOD_EXIT();
1329
1330 return(response);
1331 }
1332
1333 Message * DefaultProviderManager::handleReferenceNamesRequest(const Message * message) throw()
1334 {
1335 PEG_METHOD_ENTER(TRC_PROVIDERMANAGER, "DefaultProviderManager::handleReferenceNamesRequest");
1336
1337 CIMReferenceNamesRequestMessage * request =
1338 dynamic_cast<CIMReferenceNamesRequestMessage *>(const_cast<Message *>(message));
1339
1340 PEGASUS_ASSERT(request != 0);
1341
1342 CIMReferenceNamesResponseMessage * response =
1343 new CIMReferenceNamesResponseMessage(
1344 request->messageId,
1345 CIMException(),
1346 chip 1.1 request->queueIds.copyAndPop(),
1347 Array<CIMObjectPath>());
1348
1349 // preserve message key
1350 response->setKey(request->getKey());
1351
1352 // Set HTTP method in response from request
1353 response->setHttpMethod (request->getHttpMethod ());
1354
1355 // create a handler for this request
1356 ReferenceNamesResponseHandler handler(request, response);
1357
1358 // process the request
1359 try
1360 {
1361 Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE,
1362 "DefaultProviderManager::handleReferenceNamesRequest - Host name: $0 Name space: $1 Class name: $2",
1363 System::getHostName(),
1364 request->nameSpace.getString(),
1365 request->objectName.getClassName().getString());
1366
1367 chip 1.1 // make target object path
1368 CIMObjectPath objectPath(
1369 System::getHostName(),
1370 request->nameSpace,
1371 request->objectName.getClassName());
1372
1373 objectPath.setKeyBindings(request->objectName.getKeyBindings());
1374
|
1375 schuur 1.19 CIMObjectPath resultPath(
1376 System::getHostName(),
1377 request->nameSpace,
1378 request->resultClass.getString());
1379
|
1380 chip 1.4 ProviderName name(
|
1381 schuur 1.19 resultPath.toString(),
|
1382 chip 1.2 String::EMPTY,
1383 String::EMPTY,
|
1384 chip 1.4 String::EMPTY,
|
1385 schuur 1.11 ProviderType::ASSOCIATION);
|
1386 chip 1.1
|
1387 chip 1.5 // resolve provider name
1388 name = _resolveProviderName(name);
|
1389 chip 1.1
|
1390 chip 1.2 // get cached or load new provider module
1391 OpProviderHolder ph =
|
1392 schuur 1.10 providerManager.getProvider(name.getPhysicalName(), name.getLogicalName(), String::EMPTY);
|
1393 chip 1.1
|
1394 chip 1.2 // convert arguments
1395 OperationContext context;
|
1396 chip 1.1
|
1397 chip 1.2 context.insert(IdentityContainer(request->userName));
1398 context.insert(AcceptLanguageListContainer(request->acceptLanguages));
1399 context.insert(ContentLanguageListContainer(request->contentLanguages));
|
1400 chip 1.1
|
1401 chip 1.2 STAT_GETSTARTTIME;
|
1402 chip 1.1
|
1403 chip 1.2 PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
1404 "Calling provider.referenceNames: " +
1405 ph.GetProvider().getName());
|
1406 chip 1.1
|
1407 chip 1.2 pm_service_op_lock op_lock(&ph.GetProvider());
|
1408 chip 1.1
|
1409 chip 1.2 ph.GetProvider().referenceNames(
1410 context,
1411 objectPath,
1412 request->resultClass,
1413 request->role,
1414 handler);
|
1415 chip 1.1
|
1416 chip 1.2 STAT_PMS_PROVIDEREND;
|
1417 chip 1.1 }
1418 catch(CIMException & e)
1419 {
1420 PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
1421 "Exception: " + e.getMessage());
|
1422 chip 1.2
|
1423 chip 1.1 handler.setStatus(e.getCode(), e.getContentLanguages(), e.getMessage()); // l10n
1424 }
1425 catch(Exception & e)
1426 {
1427 PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
1428 "Exception: " + e.getMessage());
|
1429 chip 1.2
|
1430 chip 1.1 handler.setStatus(CIM_ERR_FAILED, e.getContentLanguages(), e.getMessage()); // l10n
1431 }
1432 catch(...)
1433 {
1434 PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
1435 "Exception: Unknown");
|
1436 chip 1.2
|
1437 chip 1.1 handler.setStatus(CIM_ERR_FAILED, "Unknown error.");
1438 }
1439
1440 PEG_METHOD_EXIT();
1441
1442 return(response);
1443 }
1444
1445 Message * DefaultProviderManager::handleGetPropertyRequest(const Message * message) throw()
1446 {
1447 PEG_METHOD_ENTER(TRC_PROVIDERMANAGER, "DefaultProviderManager::handleGetPropertyRequest");
1448
1449 CIMGetPropertyRequestMessage * request =
1450 dynamic_cast<CIMGetPropertyRequestMessage *>(const_cast<Message *>(message));
1451
1452 PEGASUS_ASSERT(request != 0);
1453
1454 // create response message
1455 CIMGetPropertyResponseMessage * response =
1456 new CIMGetPropertyResponseMessage(
1457 request->messageId,
1458 chip 1.1 CIMException(),
1459 request->queueIds.copyAndPop(),
1460 CIMValue());
1461
1462 PEGASUS_ASSERT(response != 0);
1463
1464 // preserve message key
1465 response->setKey(request->getKey());
1466
1467 // Set HTTP method in response from request
1468 response->setHttpMethod(request->getHttpMethod());
1469
1470 GetPropertyResponseHandler handler(request, response);
1471
1472 try
1473 {
1474 Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE,
1475 "DefaultProviderManager::handleGetPropertyRequest - Host name: $0 Name space: $1 Class name: $2",
1476 System::getHostName(),
1477 request->nameSpace.getString(),
1478 request->instanceName.getClassName().getString());
1479 chip 1.1
1480 // make target object path
1481 CIMObjectPath objectPath(
1482 System::getHostName(),
1483 request->nameSpace,
1484 request->instanceName.getClassName(),
1485 request->instanceName.getKeyBindings());
1486
|
1487 chip 1.4 ProviderName name(
1488 objectPath.toString(),
|
1489 chip 1.1 String::EMPTY,
1490 String::EMPTY,
|
1491 chip 1.4 String::EMPTY,
1492 0);
|
1493 chip 1.1
|
1494 chip 1.5 // resolve provider name
1495 name = _resolveProviderName(name);
|
1496 chip 1.1
1497 // get cached or load new provider module
1498 OpProviderHolder ph =
|
1499 schuur 1.10 providerManager.getProvider(name.getPhysicalName(), name.getLogicalName(), String::EMPTY);
|
1500 chip 1.1
1501 // convert arguments
1502 OperationContext context;
1503
1504 context.insert(IdentityContainer(request->userName));
1505 context.insert(AcceptLanguageListContainer(request->acceptLanguages));
1506 context.insert(ContentLanguageListContainer(request->contentLanguages));
1507
1508 CIMName propertyName = request->propertyName;
1509
1510 STAT_GETSTARTTIME;
1511
1512 PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
1513 "Calling provider.getProperty: " +
1514 ph.GetProvider().getName());
1515
1516 // forward request
1517 pm_service_op_lock op_lock(&ph.GetProvider());
1518
1519 ph.GetProvider().getProperty(
1520 context,
1521 chip 1.1 objectPath,
1522 propertyName,
1523 handler);
1524
1525 STAT_PMS_PROVIDEREND;
1526 }
1527 catch(CIMException & e)
1528 {
1529 PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
1530 "Exception: " + e.getMessage());
|
1531 chip 1.2
|
1532 chip 1.1 handler.setStatus(e.getCode(), e.getContentLanguages(), e.getMessage()); // l10n
1533 }
1534 catch(Exception & e)
1535 {
1536 PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
1537 "Exception: " + e.getMessage());
|
1538 chip 1.2
|
1539 chip 1.1 handler.setStatus(CIM_ERR_FAILED, e.getContentLanguages(), e.getMessage()); // l10n
1540 }
1541 catch(...)
1542 {
1543 PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
1544 "Exception: Unknown");
|
1545 chip 1.2
|
1546 chip 1.1 handler.setStatus(CIM_ERR_FAILED, "Unknown error.");
1547 }
1548
1549 PEG_METHOD_EXIT();
1550
1551 return(response);
1552 }
1553
1554 Message * DefaultProviderManager::handleSetPropertyRequest(const Message * message) throw()
1555 {
1556 PEG_METHOD_ENTER(TRC_PROVIDERMANAGER, "DefaultProviderManager::handleSetPropertyRequest");
1557
1558 CIMSetPropertyRequestMessage * request =
1559 dynamic_cast<CIMSetPropertyRequestMessage *>(const_cast<Message *>(message));
1560
1561 PEGASUS_ASSERT(request != 0);
1562
1563 // create response message
1564 //l10n
1565 CIMSetPropertyResponseMessage * response =
1566 new CIMSetPropertyResponseMessage(
1567 chip 1.1 request->messageId,
1568 PEGASUS_CIM_EXCEPTION_L(CIM_ERR_FAILED, MessageLoaderParms(
1569 "ProviderManager.DefaultProviderManager.NOT_IMPLEMENTED",
1570 "not implemented")),
1571 request->queueIds.copyAndPop());
1572
1573 PEGASUS_ASSERT(response != 0);
1574
1575 // preserve message key
1576 response->setKey(request->getKey());
1577
1578 // Set HTTP method in response from request
1579 response->setHttpMethod(request->getHttpMethod());
1580
1581 SetPropertyResponseHandler handler(request, response);
1582
1583 try
1584 {
1585 Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE,
1586 "DefaultProviderManager::handleSetPropertyRequest - Host name: $0 Name space: $1 Class name: $2",
1587 System::getHostName(),
1588 chip 1.1 request->nameSpace.getString(),
1589 request->instanceName.getClassName().getString());
1590
1591 // make target object path
1592 CIMObjectPath objectPath(
1593 System::getHostName(),
1594 request->nameSpace,
1595 request->instanceName.getClassName(),
1596 request->instanceName.getKeyBindings());
1597
|
1598 chip 1.4 ProviderName name(
1599 objectPath.toString(),
|
1600 chip 1.1 String::EMPTY,
1601 String::EMPTY,
|
1602 chip 1.4 String::EMPTY,
1603 0);
|
1604 chip 1.1
|
1605 chip 1.5 // resolve provider name
1606 name = _resolveProviderName(name);
|
1607 chip 1.1
1608 // get cached or load new provider module
1609 OpProviderHolder ph =
|
1610 schuur 1.10 providerManager.getProvider(name.getPhysicalName(), name.getLogicalName(), String::EMPTY);
|
1611 chip 1.1
1612 // convert arguments
1613 OperationContext context;
1614
1615 context.insert(IdentityContainer(request->userName));
1616 context.insert(AcceptLanguageListContainer(request->acceptLanguages));
1617 context.insert(ContentLanguageListContainer(request->contentLanguages));
1618
1619 CIMName propertyName = request->propertyName;
1620 CIMValue propertyValue = request->newValue;
1621
1622 STAT_GETSTARTTIME;
1623
1624 PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
1625 "Calling provider.setProperty: " +
1626 ph.GetProvider().getName());
1627
1628 // forward request
1629 pm_service_op_lock op_lock(&ph.GetProvider());
1630
1631 ph.GetProvider().setProperty(
1632 chip 1.1 context,
1633 objectPath,
1634 propertyName,
1635 propertyValue,
1636 handler);
1637
1638 STAT_PMS_PROVIDEREND;
1639 }
1640 catch(CIMException & e)
1641 {
1642 PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
1643 "Exception: " + e.getMessage());
|
1644 chip 1.2
|
1645 chip 1.1 handler.setStatus(e.getCode(), e.getContentLanguages(), e.getMessage()); // l10n
1646 }
1647 catch(Exception & e)
1648 {
1649 PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
1650 "Exception: " + e.getMessage());
|
1651 chip 1.2
|
1652 chip 1.1 handler.setStatus(CIM_ERR_FAILED, e.getContentLanguages(), e.getMessage()); // l10n
1653 }
1654 catch(...)
1655 {
1656 PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
1657 "Exception: Unknown");
|
1658 chip 1.2
|
1659 chip 1.1 handler.setStatus(CIM_ERR_FAILED, "Unknown error.");
1660 }
1661
1662 PEG_METHOD_EXIT();
1663
1664 return(response);
1665 }
1666
1667 Message * DefaultProviderManager::handleInvokeMethodRequest(const Message * message) throw()
1668 {
1669 PEG_METHOD_ENTER(TRC_PROVIDERMANAGER, "DefaultProviderManager::handleInvokeMethodRequest");
1670
1671 CIMInvokeMethodRequestMessage * request =
1672 dynamic_cast<CIMInvokeMethodRequestMessage *>(const_cast<Message *>(message));
1673
1674 PEGASUS_ASSERT(request != 0);
1675
1676 // create response message
1677 CIMInvokeMethodResponseMessage * response =
1678 new CIMInvokeMethodResponseMessage(
1679 request->messageId,
1680 chip 1.1 CIMException(),
1681 request->queueIds.copyAndPop(),
1682 CIMValue(),
1683 Array<CIMParamValue>(),
1684 request->methodName);
1685
1686 PEGASUS_ASSERT(response != 0);
1687
1688 // propagate message key
1689 response->setKey(request->getKey());
1690
1691 // Set HTTP method in response from request
1692 response->setHttpMethod (request->getHttpMethod ());
1693
1694 // create a handler for this request
1695 InvokeMethodResponseHandler handler(request, response);
1696
1697 try
1698 {
1699 Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE,
1700 "DefaultProviderManager::handleInvokeMethodRequest - Host name: $0 Name space: $1 Class name: $2",
1701 chip 1.1 System::getHostName(),
1702 request->nameSpace.getString(),
1703 request->instanceName.getClassName().getString());
1704
1705 // make target object path
1706 CIMObjectPath objectPath(
1707 System::getHostName(),
1708 request->nameSpace,
1709 request->instanceName.getClassName(),
1710 request->instanceName.getKeyBindings());
1711
|
1712 chip 1.4 ProviderName name(
1713 objectPath.toString(),
|
1714 chip 1.1 String::EMPTY,
1715 String::EMPTY,
|
1716 chip 1.4 String::EMPTY,
|
1717 schuur 1.16 ProviderType::METHOD,
1718 request->methodName);
|
1719 chip 1.1
|
1720 chip 1.5 // resolve provider name
1721 name = _resolveProviderName(name);
|
1722 chip 1.1
1723 // get cached or load new provider module
1724 OpProviderHolder ph =
|
1725 schuur 1.10 providerManager.getProvider(name.getPhysicalName(), name.getLogicalName(), String::EMPTY);
|
1726 chip 1.1
1727 // convert arguments
1728 OperationContext context;
1729
1730 context.insert(IdentityContainer(request->userName));
1731 context.insert(AcceptLanguageListContainer(request->acceptLanguages));
1732 context.insert(ContentLanguageListContainer(request->contentLanguages));
1733
1734 CIMObjectPath instanceReference(request->instanceName);
1735
1736 // ATTN: propagate namespace
1737 instanceReference.setNameSpace(request->nameSpace);
1738
1739 // forward request
1740 STAT_GETSTARTTIME;
1741
1742 PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
1743 "Calling provider.invokeMethod: " +
1744 ph.GetProvider().getName());
1745
1746 pm_service_op_lock op_lock(&ph.GetProvider());
1747 chip 1.1
1748 ph.GetProvider().invokeMethod(
1749 context,
1750 instanceReference,
1751 request->methodName,
1752 request->inParameters,
1753 handler);
1754
1755 STAT_PMS_PROVIDEREND;
1756 }
1757 catch(CIMException & e)
1758 {
1759 PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
1760 "Exception: " + e.getMessage());
|
1761 chip 1.2
|
1762 chip 1.1 handler.setStatus(e.getCode(), e.getContentLanguages(), e.getMessage()); // l10n
1763 }
1764 catch(Exception & e)
1765 {
1766 PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
1767 "Exception: " + e.getMessage());
|
1768 chip 1.2
|
1769 chip 1.1 handler.setStatus(CIM_ERR_FAILED, e.getContentLanguages(), e.getMessage()); // l10n
1770 }
1771 catch(...)
1772 {
1773 PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
1774 "Exception: Unknown");
|
1775 chip 1.2
|
1776 chip 1.1 handler.setStatus(CIM_ERR_FAILED, "Unknown error.");
1777 }
1778
1779 PEG_METHOD_EXIT();
1780
1781 return(response);
1782 }
1783
1784 Message * DefaultProviderManager::handleCreateSubscriptionRequest(const Message * message) throw()
1785 {
1786 PEG_METHOD_ENTER(TRC_PROVIDERMANAGER, "DefaultProviderManager::handleCreateSubscriptionRequest");
1787
1788 CIMCreateSubscriptionRequestMessage * request =
1789 dynamic_cast<CIMCreateSubscriptionRequestMessage *>(const_cast<Message *>(message));
1790
1791 PEGASUS_ASSERT(request != 0);
1792
1793 CIMCreateSubscriptionResponseMessage * response =
1794 new CIMCreateSubscriptionResponseMessage(
1795 request->messageId,
1796 CIMException(),
1797 chip 1.1 request->queueIds.copyAndPop());
1798
1799 PEGASUS_ASSERT(response != 0);
1800
1801 // preserve message key
1802 response->setKey(request->getKey());
1803
1804 // Set HTTP method in response from request
1805 response->setHttpMethod (request->getHttpMethod ());
1806
1807 OperationResponseHandler handler(request, response);
1808
1809 try
1810 {
|
1811 chip 1.2 String temp;
1812
1813 for(Uint32 i = 0, n = request->classNames.size(); i < n; i++)
1814 {
1815 temp.append(request->classNames[i].getString());
1816
1817 if(i == (n - 1))
1818 {
1819 temp.append(", ");
1820 }
1821 }
1822
1823 Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE,
1824 "DefaultProviderManager::handleCreateSubscriptionRequest - Host name: $0 Name space: $1 Class name(s): $2",
1825 System::getHostName(),
1826 request->nameSpace.getString(),
1827 temp);
1828
|
1829 schuur 1.18 String physicalName=_resolvePhysicalName(
1830 request->providerModule.getProperty(
1831 request->providerModule.findProperty("Location")).getValue().toString());
1832
1833 ProviderName name(String::EMPTY,
1834 request->provider.getProperty(request->provider.findProperty
1835 ("Name")).getValue ().toString (),
1836 physicalName,
1837 request->providerModule.getProperty(request->providerModule.findProperty
1838 ("InterfaceType")).getValue().toString(),
1839 0);
|
1840 chip 1.1
1841 // get cached or load new provider module
1842 OpProviderHolder ph =
|
1843 schuur 1.10 providerManager.getProvider(name.getPhysicalName(), name.getLogicalName(), String::EMPTY);
|
1844 schuur 1.18
|
1845 chip 1.1 // convert arguments
1846 OperationContext context;
1847
1848 context.insert(IdentityContainer(request->userName));
1849 context.insert(SubscriptionInstanceContainer
1850 (request->subscriptionInstance));
1851 context.insert(SubscriptionFilterConditionContainer
1852 (request->condition, request->queryLanguage));
1853 context.insert(SubscriptionLanguageListContainer
1854 (request->acceptLanguages));
1855 context.insert(AcceptLanguageListContainer(request->acceptLanguages));
1856 context.insert(ContentLanguageListContainer(request->contentLanguages));
1857
1858 CIMObjectPath subscriptionName = request->subscriptionInstance.getPath();
1859
1860 Array<CIMObjectPath> classNames;
1861
1862 for(Uint32 i = 0, n = request->classNames.size(); i < n; i++)
1863 {
1864 CIMObjectPath className(
1865 System::getHostName(),
1866 chip 1.1 request->nameSpace,
1867 request->classNames[i]);
1868
1869 classNames.append(className);
1870 }
1871
1872 CIMPropertyList propertyList = request->propertyList;
1873
1874 Uint16 repeatNotificationPolicy = request->repeatNotificationPolicy;
1875
1876 PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
1877 "Calling provider.createSubscription: " +
1878 ph.GetProvider().getName());
1879
1880 pm_service_op_lock op_lock(&ph.GetProvider());
1881
1882 ph.GetProvider().createSubscription(
1883 context,
1884 subscriptionName,
1885 classNames,
1886 propertyList,
1887 chip 1.1 repeatNotificationPolicy);
1888 }
1889 catch(CIMException & e)
1890 {
1891 PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
1892 "Exception: " + e.getMessage());
|
1893 chip 1.2
|
1894 chip 1.1 handler.setStatus(e.getCode(), e.getContentLanguages(), e.getMessage()); // l10n
1895 }
1896 catch(Exception & e)
1897 {
1898 PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
1899 "Exception: " + e.getMessage());
|
1900 chip 1.2
|
1901 chip 1.1 handler.setStatus(CIM_ERR_FAILED, e.getContentLanguages(), e.getMessage()); // l10n
1902 }
1903 catch(...)
1904 {
1905 PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
1906 "Exception: Unknown");
|
1907 chip 1.2
|
1908 chip 1.1 handler.setStatus(CIM_ERR_FAILED, "Unknown Error");
1909 }
1910
1911 PEG_METHOD_EXIT();
1912
1913 return(response);
1914 }
1915
1916 Message * DefaultProviderManager::handleModifySubscriptionRequest( const Message * message) throw()
1917 {
1918 PEG_METHOD_ENTER(TRC_PROVIDERMANAGER, "DefaultProviderManager::handleModifySubscriptionRequest");
1919
1920 CIMModifySubscriptionRequestMessage * request =
1921 dynamic_cast<CIMModifySubscriptionRequestMessage *>(const_cast<Message *>(message));
1922
1923 PEGASUS_ASSERT(request != 0);
1924
1925 CIMModifySubscriptionResponseMessage * response =
1926 new CIMModifySubscriptionResponseMessage(
1927 request->messageId,
1928 CIMException(),
1929 chip 1.1 request->queueIds.copyAndPop());
1930
1931 PEGASUS_ASSERT(response != 0);
1932
1933 // preserve message key
1934 response->setKey(request->getKey());
1935
1936 // Set HTTP method in response from request
1937 response->setHttpMethod (request->getHttpMethod ());
1938
1939 OperationResponseHandler handler(request, response);
1940
1941 try
1942 {
|
1943 chip 1.2 String temp;
1944
1945 for(Uint32 i = 0, n = request->classNames.size(); i < n; i++)
1946 {
1947 temp.append(request->classNames[i].getString());
1948
1949 if(i == (n - 1))
1950 {
1951 temp.append(", ");
1952 }
1953 }
1954
1955 Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE,
|
1956 schuur 1.18 "DefaultProviderManager::handleCreateSubscriptionRequest - Host name: $0 Name space: $1 Class name(s): $2",
|
1957 chip 1.2 System::getHostName(),
1958 request->nameSpace.getString(),
1959 temp);
1960
|
1961 schuur 1.18 String physicalName=_resolvePhysicalName(
1962 request->providerModule.getProperty(
1963 request->providerModule.findProperty("Location")).getValue().toString());
1964
1965 ProviderName name(String::EMPTY,
1966 request->provider.getProperty(request->provider.findProperty
1967 ("Name")).getValue ().toString (),
1968 physicalName,
1969 request->providerModule.getProperty(request->providerModule.findProperty
1970 ("InterfaceType")).getValue().toString(),
1971 0);
|
1972 chip 1.1
1973 // get cached or load new provider module
1974 OpProviderHolder ph =
|
1975 schuur 1.10 providerManager.getProvider(name.getPhysicalName(), name.getLogicalName(), String::EMPTY);
|
1976 schuur 1.18
|
1977 chip 1.1 // convert arguments
1978 OperationContext context;
1979
1980 context.insert(IdentityContainer(request->userName));
1981 context.insert(SubscriptionInstanceContainer
1982 (request->subscriptionInstance));
1983 context.insert(SubscriptionFilterConditionContainer
1984 (request->condition, request->queryLanguage));
1985 context.insert(SubscriptionLanguageListContainer
1986 (request->acceptLanguages));
1987 context.insert(AcceptLanguageListContainer(request->acceptLanguages));
1988 context.insert(ContentLanguageListContainer(request->contentLanguages));
1989
1990 CIMObjectPath subscriptionName = request->subscriptionInstance.getPath();
1991
1992 Array<CIMObjectPath> classNames;
1993
1994 for(Uint32 i = 0, n = request->classNames.size(); i < n; i++)
1995 {
1996 CIMObjectPath className(
1997 System::getHostName(),
1998 chip 1.1 request->nameSpace,
1999 request->classNames[i]);
2000
2001 classNames.append(className);
2002 }
2003
2004 CIMPropertyList propertyList = request->propertyList;
2005
2006 Uint16 repeatNotificationPolicy = request->repeatNotificationPolicy;
2007
2008 PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
2009 "Calling provider.modifySubscription: " +
2010 ph.GetProvider().getName());
2011
2012 pm_service_op_lock op_lock(&ph.GetProvider());
2013
2014 ph.GetProvider().modifySubscription(
2015 context,
2016 subscriptionName,
2017 classNames,
2018 propertyList,
2019 chip 1.1 repeatNotificationPolicy);
2020 }
2021 catch(CIMException & e)
2022 {
2023 PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
2024 "Exception: " + e.getMessage());
|
2025 chip 1.2
|
2026 chip 1.1 handler.setStatus(e.getCode(), e.getContentLanguages(), e.getMessage()); // l10n
2027 }
2028 catch(Exception & e)
2029 {
2030 PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
2031 "Exception: " + e.getMessage());
|
2032 chip 1.2
|
2033 chip 1.1 handler.setStatus(CIM_ERR_FAILED, e.getContentLanguages(), e.getMessage()); // l10n
2034 }
2035 catch(...)
2036 {
2037 PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
2038 "Exception: Unknown");
|
2039 chip 1.2
|
2040 chip 1.1 handler.setStatus(CIM_ERR_FAILED, "Unknown Error");
2041 }
2042
2043 PEG_METHOD_EXIT();
2044
2045 return(response);
2046 }
2047
2048 Message * DefaultProviderManager::handleDeleteSubscriptionRequest(const Message * message) throw()
2049 {
2050 PEG_METHOD_ENTER(TRC_PROVIDERMANAGER, "DefaultProviderManager::handleDeleteSubscriptionRequest");
2051
2052 CIMDeleteSubscriptionRequestMessage * request =
2053 dynamic_cast<CIMDeleteSubscriptionRequestMessage *>(const_cast<Message *>(message));
2054
2055 PEGASUS_ASSERT(request != 0);
2056
2057 CIMDeleteSubscriptionResponseMessage * response =
2058 new CIMDeleteSubscriptionResponseMessage(
2059 request->messageId,
2060 CIMException(),
2061 chip 1.1 request->queueIds.copyAndPop());
2062
2063 PEGASUS_ASSERT(response != 0);
2064
2065 // preserve message key
2066 response->setKey(request->getKey());
2067
2068 // Set HTTP method in response from request
2069 response->setHttpMethod(request->getHttpMethod());
2070
2071 OperationResponseHandler handler(request, response);
2072
2073 try
2074 {
|
2075 chip 1.2 String temp;
2076
2077 for(Uint32 i = 0, n = request->classNames.size(); i < n; i++)
2078 {
2079 temp.append(request->classNames[i].getString());
2080
2081 if(i == (n - 1))
2082 {
2083 temp.append(", ");
2084 }
2085 }
2086
2087 Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE,
2088 "DefaultProviderManager::handleDeleteSubscriptionRequest - Host name: $0 Name space: $1 Class name(s): $2",
2089 System::getHostName(),
2090 request->nameSpace.getString(),
2091 temp);
2092
|
2093 schuur 1.18 String physicalName=_resolvePhysicalName(
2094 request->providerModule.getProperty(
2095 request->providerModule.findProperty("Location")).getValue().toString());
2096
2097 ProviderName name(String::EMPTY,
2098 request->provider.getProperty(request->provider.findProperty
2099 ("Name")).getValue ().toString (),
2100 physicalName,
2101 request->providerModule.getProperty(request->providerModule.findProperty
2102 ("InterfaceType")).getValue().toString(),
2103 0);
|
2104 chip 1.1
2105 // get cached or load new provider module
2106 OpProviderHolder ph =
|
2107 schuur 1.10 providerManager.getProvider(name.getPhysicalName(), name.getLogicalName(), String::EMPTY);
|
2108 schuur 1.18
|
2109 chip 1.1 // convert arguments
2110 OperationContext context;
2111
2112 context.insert(IdentityContainer(request->userName));
2113 context.insert(SubscriptionInstanceContainer
2114 (request->subscriptionInstance));
2115 context.insert(SubscriptionLanguageListContainer
2116 (request->acceptLanguages));
2117 context.insert(AcceptLanguageListContainer(request->acceptLanguages));
2118 context.insert(ContentLanguageListContainer(request->contentLanguages));
2119
2120 CIMObjectPath subscriptionName = request->subscriptionInstance.getPath();
2121
2122 Array<CIMObjectPath> classNames;
2123
2124 for(Uint32 i = 0, n = request->classNames.size(); i < n; i++)
2125 {
2126 CIMObjectPath className(
2127 System::getHostName(),
2128 request->nameSpace,
2129 request->classNames[i]);
2130 chip 1.1
2131 classNames.append(className);
2132 }
2133
2134 PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
2135 "Calling provider.deleteSubscription: " +
2136 ph.GetProvider().getName());
2137
2138 pm_service_op_lock op_lock(&ph.GetProvider());
2139
2140 ph.GetProvider().deleteSubscription(
2141 context,
2142 subscriptionName,
2143 classNames);
2144 }
2145 catch(CIMException & e)
2146 {
2147 PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
2148 "Exception: " + e.getMessage());
|
2149 chip 1.2
|
2150 chip 1.1 handler.setStatus(e.getCode(), e.getContentLanguages(), e.getMessage()); // l10n
2151 }
2152 catch(Exception & e)
2153 {
2154 PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
2155 "Exception: " + e.getMessage());
|
2156 chip 1.2
|
2157 chip 1.1 handler.setStatus(CIM_ERR_FAILED, e.getContentLanguages(), e.getMessage()); // l10n
2158 }
2159 catch(...)
2160 {
2161 PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
2162 "Exception: Unknown");
|
2163 chip 1.2
|
2164 chip 1.1 handler.setStatus(CIM_ERR_FAILED, "Unknown Error");
2165 }
2166
2167 PEG_METHOD_EXIT();
2168
2169 return(response);
2170 }
2171
2172 Message * DefaultProviderManager::handleEnableIndicationsRequest(const Message * message) throw()
2173 {
2174 PEG_METHOD_ENTER(TRC_PROVIDERMANAGER, "DefaultProviderManager:: handleEnableIndicationsRequest");
2175
2176 CIMEnableIndicationsRequestMessage * request =
2177 dynamic_cast<CIMEnableIndicationsRequestMessage *>(const_cast<Message *>(message));
2178
2179 PEGASUS_ASSERT(request != 0);
2180
2181 CIMEnableIndicationsResponseMessage * response =
2182 new CIMEnableIndicationsResponseMessage(
2183 request->messageId,
2184 CIMException(),
2185 chip 1.1 request->queueIds.copyAndPop());
2186
2187 CIMEnableIndicationsResponseMessage * responseforhandler =
2188 new CIMEnableIndicationsResponseMessage(
2189 request->messageId,
2190 CIMException(),
2191 request->queueIds.copyAndPop());
2192
2193 PEGASUS_ASSERT(response != 0);
2194
2195 // preserve message key
2196 response->setKey(request->getKey());
2197
2198 // Set HTTP method in response from request
2199 response->setHttpMethod(request->getHttpMethod());
2200
2201 response->dest = request->queueIds.top();
2202
2203 // ATTN: need pointer to Provider Manager Server!
|
2204 schuur 1.14 EnableIndicationsResponseHandler *handler =
2205 new EnableIndicationsResponseHandler(request, response,
2206 request->provider, ProviderManagerService::providerManagerService);
|
2207 chip 1.1
2208 try
2209 {
|
2210 schuur 1.14 String physicalName=_resolvePhysicalName(
2211 request->providerModule.getProperty(
2212 request->providerModule.findProperty("Location")).getValue().toString());
2213
2214 ProviderName name(String::EMPTY,
|
2215 schuur 1.16 request->provider.getProperty(request->provider.findProperty
|
2216 schuur 1.14 ("Name")).getValue ().toString (),
2217 physicalName,
2218 request->providerModule.getProperty(request->providerModule.findProperty
2219 ("InterfaceType")).getValue().toString(),
2220 0);
|
2221 chip 1.1
2222 // get cached or load new provider module
2223 OpProviderHolder ph =
|
2224 schuur 1.14 providerManager.getProvider(name.getPhysicalName(), name.getLogicalName(), String::EMPTY);
|
2225 chip 1.1
2226 PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
2227 "Calling provider.enableIndications: " +
2228 ph.GetProvider().getName());
|
2229 schuur 1.14
2230 pm_service_op_lock op_lock(&ph.GetProvider());
2231
|
2232 chip 1.1 ph.GetProvider().enableIndications(*handler);
2233
2234
2235 // if no exception, store the handler so it is persistent for as
2236 // long as the provider has indications enabled.
2237 PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
2238 "Storing indication handler for " + ph.GetProvider().getName());
2239
2240 _insertEntry(ph.GetProvider(), handler);
2241 }
2242 catch(CIMException & e)
2243 {
2244 PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
2245 "Exception: " + e.getMessage());
|
2246 schuur 1.14
|
2247 chip 1.1 response->cimException = CIMException(e);
2248 }
2249 catch(Exception & e)
2250 {
2251 PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
2252 "Exception: " + e.getMessage());
2253 response->cimException = CIMException(CIM_ERR_FAILED, MessageLoaderParms(
2254 "ProviderManager.DefaultProviderManager.INTERNAL_ERROR",
2255 "Internal Error"));
2256 }
2257 catch(...)
2258 {
2259 PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
2260 "Exception: Unknown");
2261 response->cimException = CIMException(CIM_ERR_FAILED, MessageLoaderParms(
2262 "ProviderManager.DefaultProviderManager.UNKNOWN_ERROR",
2263 "Unknown Error"));
2264 }
2265
2266 PEG_METHOD_EXIT();
2267
2268 chip 1.1 return(response);
2269 }
2270
2271 Message * DefaultProviderManager::handleDisableIndicationsRequest(const Message * message) throw()
2272 {
2273 PEG_METHOD_ENTER(TRC_PROVIDERMANAGER, "DefaultProviderManager::handleDisableIndicationsRequest");
2274
2275 CIMDisableIndicationsRequestMessage * request =
2276 dynamic_cast<CIMDisableIndicationsRequestMessage *>(const_cast<Message *>(message));
2277
2278 PEGASUS_ASSERT(request != 0);
2279
2280 CIMDisableIndicationsResponseMessage * response =
2281 new CIMDisableIndicationsResponseMessage(
2282 request->messageId,
2283 CIMException(),
2284 request->queueIds.copyAndPop());
2285
2286 // preserve message key
2287 response->setKey(request->getKey());
2288
2289 chip 1.1 // Set HTTP method in response from request
2290 response->setHttpMethod (request->getHttpMethod ());
2291
2292 OperationResponseHandler handler(request, response);
2293
2294 try
2295 {
|
2296 schuur 1.14 String physicalName=_resolvePhysicalName(
2297 request->providerModule.getProperty(
2298 request->providerModule.findProperty("Location")).getValue().toString());
2299
2300 ProviderName name(String::EMPTY,
|
2301 schuur 1.16 request->provider.getProperty(request->provider.findProperty
|
2302 schuur 1.14 ("Name")).getValue ().toString (),
2303 physicalName,
2304 request->providerModule.getProperty(request->providerModule.findProperty
2305 ("InterfaceType")).getValue().toString(),
|
2306 chip 1.6 0);
|
2307 chip 1.1
2308 // get cached or load new provider module
2309 OpProviderHolder ph =
|
2310 schuur 1.10 providerManager.getProvider(name.getPhysicalName(), name.getLogicalName(), String::EMPTY);
|
2311 chip 1.1
2312 PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
2313 "Calling provider.disableIndications: " +
2314 ph.GetProvider().getName());
2315
2316 ph.GetProvider().disableIndications();
2317
2318 ph.GetProvider().unprotect();
2319
2320 PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
2321 "Removing and Destroying indication handler for " +
2322 ph.GetProvider().getName());
2323
2324 delete _removeEntry(_generateKey(ph.GetProvider()));
2325 }
2326
2327 catch(CIMException & e)
2328 {
2329 PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
2330 "Exception: " + e.getMessage());
|
2331 chip 1.2
|
2332 chip 1.1 response->cimException = CIMException(e);
2333 }
2334 catch(Exception & e)
2335 {
2336 PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
2337 "Exception: " + e.getMessage());
|
2338 chip 1.2 response->cimException = CIMException(CIM_ERR_FAILED, MessageLoaderParms(
|
2339 chip 1.1 "ProviderManager.DefaultProviderManager.INTERNAL_ERROR",
2340 "Internal Error"));
2341 }
2342 catch(...)
2343 {
2344 PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
2345 "Exception: Unknown");
|
2346 chip 1.2 response->cimException = CIMException(CIM_ERR_FAILED, MessageLoaderParms(
|
2347 chip 1.1 "ProviderManager.DefaultProviderManager.UNKNOWN_ERROR",
2348 "Unknown Error"));
2349 }
2350
2351 PEG_METHOD_EXIT();
2352
2353 return(response);
2354 }
2355
2356 Message * DefaultProviderManager::handleConsumeIndicationRequest(const Message *message) throw()
2357 {
2358 PEG_METHOD_ENTER(TRC_PROVIDERMANAGER, "DefaultProviderManager::handlConsumeIndicationRequest");
2359
2360 CIMConsumeIndicationRequestMessage *request =
2361 dynamic_cast<CIMConsumeIndicationRequestMessage *>(const_cast<Message *>(message));
2362
2363 PEGASUS_ASSERT(request != 0);
2364
2365 CIMResponseMessage * response =
2366 new CIMResponseMessage(
2367 CIM_CONSUME_INDICATION_RESPONSE_MESSAGE,
2368 chip 1.1 request->messageId,
2369 CIMException(),
2370 request->queueIds.copyAndPop());
2371
2372 PEGASUS_ASSERT(response != 0);
2373
2374 response->setKey(request->getKey());
2375
2376 // Set HTTP method in response from request
2377 response->setHttpMethod (request->getHttpMethod ());
2378
2379 Uint32 type = 3;
2380
2381 try
2382 {
|
2383 chip 1.6 ProviderName name(
2384 String::EMPTY,
2385 String::EMPTY,
2386 String::EMPTY,
2387 String::EMPTY,
2388 0);
|
2389 chip 1.1
2390 /*
|
2391 chip 1.4 ProviderName name(
|
2392 chip 1.1 String::EMPTY,
2393 String::EMPTY,
2394 objectPath.toString());
2395
|
2396 chip 1.5 // resolve provider name
2397 name = _resolveProviderName(name);
|
2398 chip 1.1 */
2399
2400 // get cached or load new provider module
2401 OpProviderHolder ph =
|
2402 schuur 1.10 providerManager.getProvider(name.getPhysicalName(), name.getLogicalName(), String::EMPTY);
|
2403 chip 1.1
2404 PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
2405 "Calling provider.: " +
2406 ph.GetProvider().getName());
2407
2408 OperationContext context;
2409
2410 //l10n
2411 // ATTN-CEC 06/04/03 NOTE: I can't find where the consume msg is sent. This
2412 // does not appear to be hooked-up. When it is added, need to
2413 // make sure that Content-Language is set in the consume msg.
2414 // NOTE: A-L is not needed to be set in the consume msg.
2415 // add the langs to the context
2416 context.insert(ContentLanguageListContainer(request->contentLanguages));
2417
2418 CIMInstance indication_copy = request->indicationInstance;
2419
2420 SimpleIndicationResponseHandler handler;
2421
2422 ph.GetProvider().consumeIndication(context,
2423 "",
2424 chip 1.1 indication_copy);
2425 }
2426 catch(CIMException & e)
2427 {
2428 PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
2429 "Exception: " + e.getMessage());
|
2430 chip 1.2
|
2431 chip 1.1 response->cimException = CIMException(e);
2432 }
2433 catch(Exception & e)
2434 {
2435 PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
2436 "Exception: " + e.getMessage());
2437 //l10n
2438 //response->cimException = CIMException(CIM_ERR_FAILED, "Internal Error");
2439 response->cimException = CIMException(CIM_ERR_FAILED, MessageLoaderParms(
2440 "ProviderManager.DefaultProviderManager.INTERNAL_ERROR",
2441 "Internal Error"));
2442 }
2443 catch(...)
2444 {
2445 PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
2446 "Exception: Unknown");
2447 //l10n
2448 //response->cimException = CIMException(CIM_ERR_FAILED, "Unknown Error");
2449 response->cimException = CIMException(CIM_ERR_FAILED, MessageLoaderParms(
2450 "ProviderManager.DefaultProviderManager.UNKNOWN_ERROR",
2451 "Unknown Error"));
2452 chip 1.1 }
2453
2454 PEG_METHOD_EXIT();
2455
2456 return(response);
2457 }
2458
|
2459 schuur 1.14
2460 Message *DefaultProviderManager::handleExportIndicationRequest(const Message *message) throw()
2461 {
2462 PEG_METHOD_ENTER(TRC_PROVIDERMANAGER, "DefaultProviderManagerService::handlExportIndicationRequest");
2463
2464 CIMExportIndicationRequestMessage * request =
2465 dynamic_cast<CIMExportIndicationRequestMessage *>(const_cast<Message *>(message));
2466
2467 PEGASUS_ASSERT(request != 0);
2468
2469 CIMExportIndicationResponseMessage * response =
2470 new CIMExportIndicationResponseMessage(
2471 request->messageId,
2472 CIMException(),
2473 request->queueIds.copyAndPop());
2474
2475 PEGASUS_ASSERT(response != 0);
2476
2477 // preserve message key
2478 response->setKey(request->getKey());
2479
2480 schuur 1.14 // Set HTTP method in response from request
2481 response->setHttpMethod (request->getHttpMethod ());
2482
2483 OperationResponseHandler handler(request, response);
2484
2485 try
2486 {
2487 ProviderName name(
2488 String::EMPTY,
2489 String::EMPTY,
2490 String::EMPTY,
2491 String::EMPTY,
2492 0);
2493
2494 // resolve provider name
2495 name = _resolveProviderName(request->destinationPath);
2496
2497 // get cached or load new provider module
2498 OpProviderHolder ph =
2499 providerManager.getProvider(name.getPhysicalName(), name.getLogicalName(), String::EMPTY);
2500
2501 schuur 1.14 PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
2502 "Calling provider.: " +
2503 ph.GetProvider().getName());
2504
2505 OperationContext context;
2506
2507 //L10N_TODO
2508 //l10n
2509 // ATTN-CEC 06/04/03 NOTE: I can't find where the consume msg is sent. This
2510 // does not appear to be hooked-up. When it is added, need to
2511 // make sure that Content-Language is set in the consume msg.
2512 // NOTE: A-L is not needed to be set in the consume msg.
2513 // add the langs to the context
2514 context.insert(ContentLanguageListContainer(request->contentLanguages));
2515
2516 CIMInstance indication_copy = request->indicationInstance;
2517 pm_service_op_lock op_lock(&ph.GetProvider());
2518
2519 ph.GetProvider().consumeIndication(context,
2520 request->destinationPath,
2521 indication_copy);
2522 schuur 1.14
2523 }
2524
2525 catch(CIMException & e)
2526 {
2527 PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
2528 "Exception: " + e.getMessage());
2529
2530 handler.setStatus(e.getCode(), e.getContentLanguages(), e.getMessage()); // l10n
2531 }
2532 catch(Exception & e)
2533 {
2534 PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
2535 "Exception: " + e.getMessage());
2536
2537 handler.setStatus(CIM_ERR_FAILED, e.getContentLanguages(), e.getMessage()); // l10n
2538 }
2539 catch(...)
2540 {
2541 PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
2542 "Exception: Unknown");
2543 schuur 1.14
2544 handler.setStatus(CIM_ERR_FAILED, "Unknown Error");
2545 }
2546
2547 PEG_METHOD_EXIT();
2548
2549 return(response);
2550 }
2551
2552
2553
2554
|
2555 chip 1.1 //
2556 // This function disables a provider module if disableProviderOnly is not true,
2557 // otherwise, disables a provider. Disable provider module means that
2558 // block all the providers which contain in the module and unload the
2559 // providers.
2560 // Disable provider means unload the provider and the provider is not blocked.
2561 //
2562 // ATTN-YZ-P2-20030519: Provider needs to be blocked when disable a provider.
2563 //
2564 Message * DefaultProviderManager::handleDisableModuleRequest(const Message * message) throw()
2565 {
2566 PEG_METHOD_ENTER(TRC_PROVIDERMANAGER, "DefaultProviderManager::handleDisableModuleRequest");
|
2567 schuur 1.19
|
2568 chip 1.1 CIMDisableModuleRequestMessage * request =
2569 dynamic_cast<CIMDisableModuleRequestMessage *>(const_cast<Message *>(message));
2570
2571 PEGASUS_ASSERT(request != 0);
|
2572 schuur 1.18
2573 Array<Uint16> operationalStatus;
|
2574 chip 1.1 Boolean disableProviderOnly = request->disableProviderOnly;
|
2575 schuur 1.18 CIMException cimException;
|
2576 chip 1.1
|
2577 schuur 1.18 ProviderRegistrationManager * _providerRegistrationManager = GetProviderRegistrationManager();
2578
2579 try
|
2580 chip 1.1 {
|
2581 schuur 1.18 // get provider module name
2582 String moduleName;
2583 CIMInstance mInstance = request->providerModule;
2584 Uint32 pos = mInstance.findProperty(CIMName ("Name"));
|
2585 chip 1.2
|
2586 schuur 1.18 if(pos != PEG_NOT_FOUND)
|
2587 chip 1.1 {
|
2588 schuur 1.18 mInstance.getProperty(pos).getValue().get(moduleName);
|
2589 chip 1.1 }
2590
|
2591 schuur 1.18 Boolean disableProviderOnly = request->disableProviderOnly;
2592
|
2593 chip 1.1 //
|
2594 schuur 1.18 // get operational status
|
2595 chip 1.1 //
|
2596 schuur 1.18 if (!disableProviderOnly)
|
2597 chip 1.1 {
|
2598 schuur 1.18 Uint32 pos2 = mInstance.findProperty(CIMName ("OperationalStatus"));
2599 if (pos2 != PEG_NOT_FOUND)
2600 {
2601 //
2602 // ATTN-CAKG-P2-20020821: Check for null status?
2603 //
2604 mInstance.getProperty(pos2).getValue().get(operationalStatus);
2605 }
2606
2607 //
2608 // update module status from OK to Stopping
2609 //
2610 for (Uint32 i=0, n = operationalStatus.size(); i < n; i++)
|
2611 chip 1.1 {
|
2612 schuur 1.18 if (operationalStatus[i] == _MODULE_OK)
2613 {
2614 operationalStatus.remove(i);
2615 }
2616 }
2617
2618 operationalStatus.append(_MODULE_STOPPING);
2619
2620 if(_providerRegistrationManager->setProviderModuleStatus
2621 (moduleName, operationalStatus) == false)
2622 {
2623 //l10n
2624 //throw PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED, "set module status failed.");
2625 throw PEGASUS_CIM_EXCEPTION_L(
2626 CIM_ERR_FAILED,
2627 MessageLoaderParms(
2628 "ProviderManager.ProviderManagerService."
2629 "SET_MODULE_STATUS_FAILED",
2630 "set module status failed."));
|
2631 chip 1.1 }
2632 }
2633
|
2634 schuur 1.18 // Unload providers
2635 Array<CIMInstance> _pInstances = request->providers;
2636 Array<Boolean> _indicationProviders = request->indicationProviders;
2637
2638 String physicalName=_resolvePhysicalName(
2639 mInstance.getProperty(
2640 mInstance.findProperty("Location")).getValue().toString());
2641
2642 for(Uint32 i = 0, n = _pInstances.size(); i < n; i++)
|
2643 chip 1.1 {
|
2644 schuur 1.18 String pName(_pInstances[i].getProperty(
2645 _pInstances[i].findProperty("Name")).getValue().toString());
|
2646 chip 1.1
|
2647 schuur 1.18 Sint16 ret_value = providerManager.disableProvider(physicalName,pName);
|
2648 chip 1.1
|
2649 schuur 1.18 if (ret_value == 0)
2650 {
2651 // disable failed since there are pending requests,
2652 // update module status from Stopping to OK if
2653 // disableProviderOnly is not true
2654 if (!disableProviderOnly)
2655 {
2656 for(Uint32 j=0, m = operationalStatus.size(); j < m; j++)
2657 {
2658 if (operationalStatus[j] == _MODULE_STOPPING)
2659 {
2660 operationalStatus.remove(j);
2661 }
2662 }
2663
2664 operationalStatus.append(_MODULE_OK);
2665
2666 if(_providerRegistrationManager->setProviderModuleStatus
2667 (moduleName, operationalStatus) == false)
2668 {
2669 throw PEGASUS_CIM_EXCEPTION_L(
2670 schuur 1.18 CIM_ERR_FAILED,
2671 MessageLoaderParms(
2672 "ProviderManager.ProviderManagerService."
2673 "SET_MODULE_STATUS_FAILED",
2674 "set module status failed."));
2675 }
2676 }
2677 }
2678 else if (ret_value == 1)
2679 {
2680 // if It is an indication provider
2681 // remove the entry from the table since the
2682 // provider has been disabled
2683 if (_indicationProviders[i])
2684 {
2685 _removeEntry(_generateKey(pName,physicalName));
2686 }
2687 }
2688 else
2689 {
2690 // disable failed for other reason, throw exception
2691 schuur 1.18 // update module status from Stopping to OK if
2692 // disableProviderOnly is not true
2693 if (!disableProviderOnly)
2694 {
2695 for(Uint32 j=0, m = operationalStatus.size(); j < m; j++)
2696 {
2697 if (operationalStatus[j] == _MODULE_STOPPING)
2698 {
2699 operationalStatus.remove(j);
2700 }
2701 }
2702
2703 operationalStatus.append(_MODULE_OK);
2704
2705 if(_providerRegistrationManager->setProviderModuleStatus
2706 (moduleName, operationalStatus) == false)
2707 {
2708 throw PEGASUS_CIM_EXCEPTION_L(
2709 CIM_ERR_FAILED,
2710 MessageLoaderParms(
2711 "ProviderManager.ProviderManagerService."
2712 schuur 1.18 "SET_MODULE_STATUS_FAILED",
2713 "set module status failed."));
2714 }
2715 }
2716
2717 throw PEGASUS_CIM_EXCEPTION_L(
2718 CIM_ERR_FAILED,
2719 MessageLoaderParms(
2720 "ProviderManager.ProviderManagerService."
2721 "DISABLE_PROVIDER_FAILED",
2722 "Failed to disable the provider."));
2723 }
2724 }
2725 // disable succeed
2726 // update module status from Stopping to Stopped if
2727 // disableProviderOnly is not true
2728 if (!disableProviderOnly)
|
2729 chip 1.1 {
|
2730 schuur 1.18 // update module status from Stopping to Stopped
2731 for(Uint32 j=0, m = operationalStatus.size(); j < m; j++)
|
2732 chip 1.1 {
|
2733 schuur 1.18 if (operationalStatus[j] == _MODULE_STOPPING)
2734 {
2735 operationalStatus.remove(j);
2736 operationalStatus.append(_MODULE_STOPPED);
2737 }
|
2738 chip 1.1 }
|
2739 chip 1.2
|
2740 schuur 1.18 if(_providerRegistrationManager->setProviderModuleStatus
2741 (moduleName, operationalStatus) == false)
2742 {
2743 //l10n
2744 //throw PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED,
2745 //"set module status failed.");
2746 throw PEGASUS_CIM_EXCEPTION_L(
2747 CIM_ERR_FAILED,
2748 MessageLoaderParms(
2749 "ProviderManager.ProviderManagerService."
2750 "SET_MODULE_STATUS_FAILED",
2751 "set module status failed."));
2752 }
2753 }
2754 }
2755 catch(CIMException & e)
2756 {
2757 PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
2758 "Exception: " + e.getMessage());
2759 cimException = e;
2760 }
2761 schuur 1.18 catch(Exception & e)
2762 {
2763 PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
2764 "Exception: " + e.getMessage());
2765 cimException = CIMException(CIM_ERR_FAILED, e.getMessage());
2766 }
2767 catch(...)
2768 {
2769 PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
2770 "Exception: Unknown");
2771 //l10n
2772 //response->cimException = CIMException(CIM_ERR_FAILED, "Unknown Error");
2773 cimException = PEGASUS_CIM_EXCEPTION_L(
2774 CIM_ERR_FAILED,
2775 MessageLoaderParms(
2776 "ProviderManager.ProviderManagerService.UNKNOWN_ERROR",
2777 "Unknown Error"));
|
2778 chip 1.1 }
2779
2780 CIMDisableModuleResponseMessage * response =
2781 new CIMDisableModuleResponseMessage(
2782 request->messageId,
2783 CIMException(),
2784 request->queueIds.copyAndPop(),
2785 operationalStatus);
2786
2787 // preserve message key
2788 response->setKey(request->getKey());
2789
2790 // Set HTTP method in response from request
2791 response->setHttpMethod (request->getHttpMethod ());
2792
2793 PEG_METHOD_EXIT();
2794
2795 return(response);
2796 }
2797
2798 Message * DefaultProviderManager::handleEnableModuleRequest(const Message * message) throw()
2799 chip 1.1 {
2800 // HACK
|
2801 chip 1.4 ProviderRegistrationManager * _providerRegistrationManager = GetProviderRegistrationManager();
|
2802 chip 1.1
2803 PEG_METHOD_ENTER(TRC_PROVIDERMANAGER, "DefaultProviderManager::handleEnableModuleRequest");
2804
2805 CIMEnableModuleRequestMessage * request =
2806 dynamic_cast<CIMEnableModuleRequestMessage *>(const_cast<Message *>(message));
2807
2808 PEGASUS_ASSERT(request != 0);
2809
2810 //
2811 // get module status
2812 //
2813 CIMInstance mInstance = request->providerModule;
2814 Array<Uint16> operationalStatus;
2815 Uint32 pos = mInstance.findProperty(CIMName ("OperationalStatus"));
2816
2817 if(pos != PEG_NOT_FOUND)
2818 {
2819 //
2820 // ATTN-CAKG-P2-20020821: Check for null status?
2821 //
2822 mInstance.getProperty(pos).getValue().get(operationalStatus);
2823 chip 1.1 }
2824
2825 // update module status from Stopped to OK
2826 for(Uint32 i=0, n = operationalStatus.size(); i < n; i++)
2827 {
2828 if(operationalStatus[i] == _MODULE_STOPPED)
2829 {
2830 operationalStatus.remove(i);
2831 }
2832 }
2833
2834 operationalStatus.append(_MODULE_OK);
2835
2836 //
2837 // get module name
2838 //
2839 String moduleName;
2840
2841 Uint32 pos2 = mInstance.findProperty(CIMName ("Name"));
2842
2843 if(pos2 != PEG_NOT_FOUND)
2844 chip 1.1 {
2845 mInstance.getProperty(pos2).getValue().get(moduleName);
2846 }
2847
2848 if(_providerRegistrationManager->setProviderModuleStatus
2849 (moduleName, operationalStatus) == false)
2850 {
2851 //l10n
2852 //throw PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED, "set module status failed.");
2853 throw PEGASUS_CIM_EXCEPTION_L(CIM_ERR_FAILED, MessageLoaderParms(
2854 "ProviderManager.DefaultProviderManager.SET_MODULE_STATUS_FAILED",
2855 "set module status failed."));
2856 }
2857
2858 CIMEnableModuleResponseMessage * response =
2859 new CIMEnableModuleResponseMessage(
2860 request->messageId,
2861 CIMException(),
2862 request->queueIds.copyAndPop(),
2863 operationalStatus);
2864
2865 chip 1.1 PEGASUS_ASSERT(response != 0);
2866
2867 // preserve message key
2868 response->setKey(request->getKey());
2869
2870 // Set HTTP method in response from request
2871 response->setHttpMethod (request->getHttpMethod ());
2872
2873 PEG_METHOD_EXIT();
2874
2875 return(response);
2876 }
2877
2878 Message * DefaultProviderManager::handleStopAllProvidersRequest(const Message * message) throw()
2879 {
2880 PEG_METHOD_ENTER(TRC_PROVIDERMANAGER, "DefaultProviderManager::handleStopAllProvidersRequest");
2881
2882 CIMStopAllProvidersRequestMessage * request =
2883 dynamic_cast<CIMStopAllProvidersRequestMessage *>(const_cast<Message *>(message));
2884
2885 PEGASUS_ASSERT(request != 0);
2886 chip 1.1
2887 CIMStopAllProvidersResponseMessage * response =
2888 new CIMStopAllProvidersResponseMessage(
2889 request->messageId,
2890 CIMException(),
2891 request->queueIds.copyAndPop());
2892
2893 PEGASUS_ASSERT(response != 0);
2894
2895 // preserve message key
2896 response->setKey(request->getKey());
2897
2898 // Set HTTP method in response from request
2899 response->setHttpMethod (request->getHttpMethod ());
2900
2901 // tell the provider manager to shutdown all the providers
|
2902 schuur 1.10 providerManager.shutdownAllProviders();
|
2903 chip 1.1
2904 PEG_METHOD_EXIT();
2905
2906 return(response);
2907 }
2908
2909 void DefaultProviderManager::_insertEntry (
2910 const Provider & provider,
2911 const EnableIndicationsResponseHandler *handler)
2912 {
2913 PEG_METHOD_ENTER (TRC_INDICATION_SERVICE,
2914 "DefaultProviderManager::_insertEntry");
2915
2916 String tableKey = _generateKey
2917 (provider);
2918
2919 _responseTable.insert (tableKey, const_cast<EnableIndicationsResponseHandler *>(handler));
2920
2921 PEG_METHOD_EXIT();
2922 }
2923
2924 chip 1.1 EnableIndicationsResponseHandler * DefaultProviderManager::_removeEntry(
2925 const String & key)
2926 {
2927 PEG_METHOD_ENTER (TRC_INDICATION_SERVICE,
2928 "DefaultProviderManager::_removeEntry");
2929 EnableIndicationsResponseHandler *ret = 0;
2930
2931 _responseTable.lookup(key, ret);
|
2932 schuur 1.14 _responseTable.remove(key); // why is this needed ? - we get killed when removed...
|
2933 chip 1.1
2934 PEG_METHOD_EXIT();
2935
2936 return(ret);
2937 }
2938
2939 String DefaultProviderManager::_generateKey (
2940 const Provider & provider)
2941 {
2942 String tableKey;
2943
2944 PEG_METHOD_ENTER (TRC_INDICATION_SERVICE,
2945 "DefaultProviderManager::_generateKey");
2946
2947 //
2948 // Append provider key values to key
2949 //
2950 String providerName = provider.getName();
2951 String providerFileName = provider.getModule()->getFileName();
2952 tableKey.append (providerName);
2953 tableKey.append (providerFileName);
2954 chip 1.1
2955 PEG_METHOD_EXIT();
2956
2957 return(tableKey);
|
2958 schuur 1.18 }
2959
2960 String DefaultProviderManager::_generateKey (
2961 const String & providerName,
2962 const String & providerFileName)
2963 {
2964 String tableKey;
2965
2966 PEG_METHOD_ENTER (TRC_INDICATION_SERVICE,
2967 "DefaultProviderManagerService::_generateKey");
2968
2969 //
2970 // Append providerName and providerFileName to key
2971 //
2972 tableKey.append (providerName);
2973 tableKey.append (providerFileName);
2974
2975 PEG_METHOD_EXIT ();
2976 return tableKey;
|
2977 chip 1.5 }
2978
2979 ProviderName DefaultProviderManager::_resolveProviderName(const ProviderName & providerName)
2980 {
2981 ProviderName temp = findProvider(providerName);
|
2982 schuur 1.14 String physicalName = _resolvePhysicalName(temp.getPhysicalName());
2983 temp.setPhysicalName(physicalName);
|
2984 chip 1.5
|
2985 schuur 1.14 return(temp);
2986 }
2987
2988 ProviderName DefaultProviderManager::_resolveProviderName(String & destinationPath)
2989 {
2990 ProviderName temp = findProvider(destinationPath);
|
2991 kv.le 1.8
|
2992 schuur 1.14 String physicalName = _resolvePhysicalName(temp.getPhysicalName());
|
2993 chip 1.5
2994 temp.setPhysicalName(physicalName);
2995
2996 return(temp);
|
2997 chip 1.1 }
2998
2999 PEGASUS_NAMESPACE_END
|