1 karl 1.3 //%2003////////////////////////////////////////////////////////////////////////
|
2 chip 1.1 //
|
3 karl 1.3 // 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.4 //
|
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 schuur 1.4 // Author: Adrian Schuur, schuur@de.ibm.com
|
27 chip 1.1 //
28 // Modified By:
29 //
30 //%/////////////////////////////////////////////////////////////////////////////
31
|
32 schuur 1.14 #include "CMPI_Version.h"
|
33 schuur 1.6
|
34 chip 1.1 #include "CMPIProviderManager.h"
35
|
36 schuur 1.4 #include "CMPI_Object.h"
37 #include "CMPI_ContextArgs.h"
38 #include "CMPI_Instance.h"
39 #include "CMPI_ObjectPath.h"
40 #include "CMPI_Result.h"
41 #include "CMPI_SelectExp.h"
42
43 #include <Pegasus/Common/CIMMessage.h>
44 #include <Pegasus/Common/OperationContext.h>
45 #include <Pegasus/Common/Destroyer.h>
46 #include <Pegasus/Common/Tracer.h>
47 #include <Pegasus/Common/StatisticalData.h>
48 #include <Pegasus/Common/Logger.h>
49 #include <Pegasus/Common/MessageLoader.h> //l10n
50
51 #include <Pegasus/Config/ConfigManager.h>
|
52 schuur 1.14 #include <Pegasus/Server/CIMServer.h>
|
53 schuur 1.4
|
54 schuur 1.13 #include <Pegasus/ProviderManager2/ProviderType.h>
|
55 schuur 1.4 #include <Pegasus/ProviderManager2/ProviderName.h>
56 #include <Pegasus/ProviderManager2/CMPI/CMPIProvider.h>
57 #include <Pegasus/ProviderManager2/CMPI/CMPILocalProviderManager.h>
58 #include <Pegasus/ProviderManager2/ProviderManagerService.h>
|
59 schuur 1.19 //#include <Pegasus/ProviderManager2/Default/OperationResponseHandler.h>
|
60 schuur 1.4
61 #include <Pegasus/Server/ProviderRegistrationManager/ProviderRegistrationManager.h>
62
|
63 schuur 1.7 PEGASUS_USING_STD;
|
64 chip 1.1 PEGASUS_NAMESPACE_BEGIN
65
|
66 schuur 1.10 static CMPILocalProviderManager providerManager;
|
67 schuur 1.4
68 int _cmpi_trace=0;
69
70 #define DDD(x) if (_cmpi_trace) x;
71
72 CMPIProviderManager::IndProvTab CMPIProviderManager::provTab;
73 CMPIProviderManager::IndSelectTab CMPIProviderManager::selxTab;
74 CMPIProviderManager::ProvRegistrar CMPIProviderManager::provReg;
75
|
76 schuur 1.17 class CMPIPropertyList {
77 char **props;
78 int pCount;
79 public:
80 CMPIPropertyList(CIMPropertyList &propertyList) {
81 if (!propertyList.isNull()) {
82 Array<CIMName> p=propertyList.getPropertyNameArray();
83 pCount=p.size();
84 props=(char**)malloc((1+pCount)*sizeof(char*));
85 for (int i=0; i<pCount; i++) {
86 props[i]=strdup(p[i].getString().getCString());
87 }
88 props[pCount]=NULL;
89 }
90 else props=NULL;
91 }
92 ~CMPIPropertyList() {
93 if (props) {
94 for (int i=0; i<pCount; i++)
95 free(props[i]);
96 free(props);
97 schuur 1.17 }
98 }
99 char **getList() {
100 return props;
101 }
102 };
103
|
104 schuur 1.4 CMPIProviderManager::CMPIProviderManager(Mode m)
|
105 chip 1.1 {
|
106 schuur 1.4 mode=m;
107 if (getenv("CMPI_TRACE")) _cmpi_trace=1;
108 else _cmpi_trace=0;
|
109 schuur 1.15 _repository = ProviderManagerService::_repository;
|
110 chip 1.1 }
111
112 CMPIProviderManager::~CMPIProviderManager(void)
113 {
114 }
115
|
116 schuur 1.7 Boolean CMPIProviderManager::insertProvider(const ProviderName & name,
|
117 schuur 1.4 const String &ns, const String &cn)
118 {
119 String key(ns+String("::")+cn+String("::")+CIMValue(name.getCapabilitiesMask()).toString());
120 return provReg.insert(key,name);
121 }
|
122 schuur 1.7
123
|
124 schuur 1.20 Message * CMPIProviderManager::processMessage(Message * request)
|
125 chip 1.1 {
|
126 schuur 1.4 PEG_METHOD_ENTER(TRC_PROVIDERMANAGER,
127 "CMPIProviderManager::processMessage()");
128
129 Message * response = 0;
130
131 // pass the request message to a handler method based on message type
132 switch(request->getType())
133 {
134 case CIM_GET_INSTANCE_REQUEST_MESSAGE:
135 response = handleGetInstanceRequest(request);
136
137 break;
138 case CIM_ENUMERATE_INSTANCES_REQUEST_MESSAGE:
139 response = handleEnumerateInstancesRequest(request);
140
141 break;
142 case CIM_ENUMERATE_INSTANCE_NAMES_REQUEST_MESSAGE:
143 response = handleEnumerateInstanceNamesRequest(request);
144
145 break;
146 case CIM_CREATE_INSTANCE_REQUEST_MESSAGE:
147 schuur 1.4 response = handleCreateInstanceRequest(request);
148
149 break;
150 case CIM_MODIFY_INSTANCE_REQUEST_MESSAGE:
151 response = handleModifyInstanceRequest(request);
152
153 break;
154 case CIM_DELETE_INSTANCE_REQUEST_MESSAGE:
155 response = handleDeleteInstanceRequest(request);
156
157 break;
158 case CIM_EXEC_QUERY_REQUEST_MESSAGE:
|
159 schuur 1.14 response = handleExecQueryRequest(request);
|
160 schuur 1.4
161 break;
162 case CIM_ASSOCIATORS_REQUEST_MESSAGE:
163 response = handleAssociatorsRequest(request);
164
165 break;
166 case CIM_ASSOCIATOR_NAMES_REQUEST_MESSAGE:
167 response = handleAssociatorNamesRequest(request);
168
169 break;
170 case CIM_REFERENCES_REQUEST_MESSAGE:
171 response = handleReferencesRequest(request);
172
173 break;
174 case CIM_REFERENCE_NAMES_REQUEST_MESSAGE:
175 response = handleReferenceNamesRequest(request);
176
177 break;
178 case CIM_INVOKE_METHOD_REQUEST_MESSAGE:
179 response = handleInvokeMethodRequest(request);
180
181 schuur 1.4 break;
182 case CIM_CREATE_SUBSCRIPTION_REQUEST_MESSAGE:
183 response = handleCreateSubscriptionRequest(request);
184
185 break;
186 /* case CIM_MODIFY_SUBSCRIPTION_REQUEST_MESSAGE:
187 response = handleModifySubscriptionRequest(request);
188
189 break;
190 */ case CIM_DELETE_SUBSCRIPTION_REQUEST_MESSAGE:
191 response = handleDeleteSubscriptionRequest(request);
192
193 break;
194 case CIM_ENABLE_INDICATIONS_REQUEST_MESSAGE:
195 response = handleEnableIndicationsRequest(request);
196
197 break;
198 case CIM_DISABLE_INDICATIONS_REQUEST_MESSAGE:
199 response = handleDisableIndicationsRequest(request);
200
201 break;
202 schuur 1.4 /* case CIM_CONSUME_INDICATION_REQUEST_MESSAGE:
203 response = handleConsumeIndicationRequest(request);
204 break;
|
205 schuur 1.16 */
|
206 schuur 1.4 case CIM_DISABLE_MODULE_REQUEST_MESSAGE:
207 response = handleDisableModuleRequest(request);
208
209 break;
210 case CIM_ENABLE_MODULE_REQUEST_MESSAGE:
211 response = handleEnableModuleRequest(request);
212
|
213 schuur 1.16 break;
|
214 schuur 1.4 case CIM_STOP_ALL_PROVIDERS_REQUEST_MESSAGE:
215 response = handleStopAllProvidersRequest(request);
216
|
217 schuur 1.5 break;
|
218 schuur 1.4 default:
219 response = handleUnsupportedRequest(request);
220
221 break;
222 }
223
224 PEG_METHOD_EXIT();
225
226 return(response);
227 }
228
229 void CMPIProviderManager::unload_idle_providers(void)
230 {
|
231 schuur 1.10 providerManager.unload_idle_providers();
|
232 schuur 1.4 }
233
234
235 #define CHARS(cstring) (char*)(strlen(cstring)?(const char*)cstring:NULL)
236
237
238 #define HandlerIntroBase(type,type1,message,request,response,handler,respType) \
239 CIM##type##RequestMessage * request = \
240 dynamic_cast<CIM##type##RequestMessage *>(const_cast<Message *>(message)); \
241 PEGASUS_ASSERT(request != 0); \
242 CIM##type##ResponseMessage * response = \
243 new CIM##type##ResponseMessage( \
244 request->messageId, \
245 CIMException(), \
246 request->queueIds.copyAndPop() \
247 respType \
248 PEGASUS_ASSERT(response != 0); \
249 response->setKey(request->getKey()); \
250 response->setHttpMethod(request->getHttpMethod()); \
251 type1##ResponseHandler handler(request, response);
252
253 schuur 1.4 #define VOIDINTRO );
254 #define NOVOIDINTRO(type) ,type);
255 #define METHODINTRO ,CIMValue(), Array<CIMParamValue>(), request->methodName );
256
257
258 #define HandlerIntroVoid(type,message,request,response,handler) \
259 HandlerIntroBase(type,type,message,request,response,handler,VOIDINTRO)
260
261 #define HandlerIntroMethod(type,message,request,response,handler) \
262 HandlerIntroBase(type,type,message,request,response,handler,METHODINTRO)
263
264 #define HandlerIntroInd(type,message,request,response,handler) \
265 HandlerIntroBase(type,Operation,message,request,response,handler,VOIDINTRO)
266
267 #define HandlerIntro(type,message,request,response,handler,respType) \
268 HandlerIntroBase(type,type,message,request,response,handler,NOVOIDINTRO(respType))
269
270 #define HandlerCatch(handler) \
271 catch(CIMException & e) \
272 { PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4, \
273 "Exception: " + e.getMessage()); \
274 schuur 1.4 handler.setStatus(e.getCode(), e.getContentLanguages(), e.getMessage()); \
275 } \
276 catch(Exception & e) \
277 { PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4, \
278 "Exception: " + e.getMessage()); \
279 handler.setStatus(CIM_ERR_FAILED, e.getContentLanguages(), e.getMessage()); \
280 } \
281 catch(...) \
282 { PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4, \
283 "Exception: Unknown"); \
284 handler.setStatus(CIM_ERR_FAILED, "Unknown error."); \
285 }
286
287
288
|
289 schuur 1.20 Message * CMPIProviderManager::handleGetInstanceRequest(const Message * message)
|
290 schuur 1.4 {
291 PEG_METHOD_ENTER(TRC_PROVIDERMANAGER,
292 "CMPIProviderManager::handleGetInstanceRequest");
293
294 HandlerIntro(GetInstance,message,request,response,handler,CIMInstance());
295
296 try {
297 Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE,
298 "CmpiProviderManager::handleGetInstanceRequest - Host name: $0 Name space: $1 Class name: $2",
299 System::getHostName(),
300 request->nameSpace.getString(),
301 request->instanceName.getClassName().getString());
302
303 // make target object path
304 CIMObjectPath objectPath(
305 System::getHostName(),
306 request->nameSpace,
307 request->instanceName.getClassName(),
308 request->instanceName.getKeyBindings());
309
310 ProviderName name(
|
311 schuur 1.18 objectPath,
|
312 schuur 1.4 ProviderType::INSTANCE);
313
314 // resolve provider name
315 name = _resolveProviderName(name);
316
317 // get cached or load new provider module
|
318 schuur 1.10 CMPIProvider::OpProviderHolder ph = providerManager.getProvider(name.getPhysicalName(),
|
319 schuur 1.4 name.getLogicalName());
320
321 // convert arguments
322 OperationContext context;
323
324 context.insert(IdentityContainer(request->userName));
325 context.insert(AcceptLanguageListContainer(request->acceptLanguages));
326 context.insert(ContentLanguageListContainer(request->contentLanguages));
327
328 // forward request
|
329 schuur 1.17 CMPIProvider & pr=ph.GetProvider();
|
330 schuur 1.4
331 PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
332 "Calling provider.getInstance: " + pr.getName());
333
|
334 schuur 1.7 DDD(cerr<<"--- CMPIProviderManager::getInstance"<<endl);
|
335 schuur 1.4
|
336 schuur 1.17 CMPIStatus rc={CMPI_RC_OK,NULL};
|
337 schuur 1.4 CMPI_ContextOnStack eCtx(context);
338 CMPI_ObjectPathOnStack eRef(objectPath);
339 CMPI_ResultOnStack eRes(handler,&pr.broker);
340 CMPI_ThreadContext thr(&pr.broker,&eCtx);
341
|
342 schuur 1.17 CMPIPropertyList props(request->propertyList);
343
|
344 schuur 1.4 CMPIFlags flgs=0;
345 if (request->includeQualifiers) flgs|=CMPI_FLAG_IncludeQualifiers;
346 if (request->includeClassOrigin) flgs|=CMPI_FLAG_IncludeClassOrigin;
347 eCtx.ft->addEntry(&eCtx,CMPIInvocationFlags,(CMPIValue*)&flgs,CMPI_uint32);
348
349 CMPIProvider::pm_service_op_lock op_lock(&pr);
350
|
351 schuur 1.17 STAT_GETSTARTTIME;
|
352 schuur 1.4
353 rc=pr.miVector.instMI->ft->getInstance
|
354 schuur 1.17 (pr.miVector.instMI,&eCtx,&eRes,&eRef,props.getList());
|
355 schuur 1.4
356 STAT_PMS_PROVIDEREND;
357
358 if (rc.rc!=CMPI_RC_OK)
|
359 schuur 1.17 throw CIMException((CIMStatusCode)rc.rc);
|
360 schuur 1.21 }
|
361 schuur 1.4 HandlerCatch(handler);
362
363 PEG_METHOD_EXIT();
364
365 return(response);
366 }
367
|
368 schuur 1.20 Message * CMPIProviderManager::handleEnumerateInstancesRequest(const Message * message)
|
369 schuur 1.4 {
370 PEG_METHOD_ENTER(TRC_PROVIDERMANAGER,
371 "CMPIProviderManager::handleEnumerateInstanceRequest");
372
373 HandlerIntro(EnumerateInstances,message,request,response,
374 handler,Array<CIMInstance>());
375 try {
376 Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE,
377 "CMPIProviderManager::handleEnumerateInstancesRequest - Host name: $0 Name space: $1 Class name: $2",
378 System::getHostName(),
379 request->nameSpace.getString(),
380 request->className.getString());
381
382 // make target object path
383 CIMObjectPath objectPath(
384 System::getHostName(),
385 request->nameSpace,
386 request->className);
387
388 ProviderName name(
|
389 schuur 1.18 objectPath,
|
390 schuur 1.4 ProviderType::INSTANCE);
391
392 // resolve provider name
393 name = _resolveProviderName(name);
394
395 // get cached or load new provider module
396 CMPIProvider::OpProviderHolder ph =
|
397 schuur 1.10 providerManager.getProvider(name.getPhysicalName(), name.getLogicalName(),
|
398 schuur 1.4 String::EMPTY);
399
400 // convert arguments
401 OperationContext context;
402
403 context.insert(IdentityContainer(request->userName));
404 context.insert(AcceptLanguageListContainer(request->acceptLanguages));
405 context.insert(ContentLanguageListContainer(request->contentLanguages));
406
407 CIMPropertyList propertyList(request->propertyList);
408
409 // forward request
|
410 schuur 1.17 CMPIProvider & pr=ph.GetProvider();
|
411 schuur 1.4
412 PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
413 "Calling provider.enumerateInstances: " + pr.getName());
414
|
415 schuur 1.7 DDD(cerr<<"--- CMPIProviderManager::enumerateInstances"<<endl);
|
416 schuur 1.4
|
417 schuur 1.17 CMPIStatus rc={CMPI_RC_OK,NULL};
|
418 schuur 1.4 CMPI_ContextOnStack eCtx(context);
419 CMPI_ObjectPathOnStack eRef(objectPath);
420 CMPI_ResultOnStack eRes(handler,&pr.broker);
421 CMPI_ThreadContext thr(&pr.broker,&eCtx);
422
|
423 schuur 1.17 CMPIPropertyList props(propertyList);
|
424 schuur 1.4
425 CMPIFlags flgs=0;
426 if (request->includeQualifiers) flgs|=CMPI_FLAG_IncludeQualifiers;
427 if (request->includeClassOrigin) flgs|=CMPI_FLAG_IncludeClassOrigin;
428 eCtx.ft->addEntry(&eCtx,CMPIInvocationFlags,(CMPIValue*)&flgs,CMPI_uint32);
429
430 CMPIProvider::pm_service_op_lock op_lock(&pr);
431
432 STAT_GETSTARTTIME;
433
434 rc=pr.miVector.instMI->ft->enumInstances
|
435 schuur 1.17 (pr.miVector.instMI,&eCtx,&eRes,&eRef,props.getList());
|
436 schuur 1.4
437 STAT_PMS_PROVIDEREND;
438
439 if (rc.rc!=CMPI_RC_OK)
|
440 schuur 1.17 throw CIMException((CIMStatusCode)rc.rc);
|
441 schuur 1.4
442 STAT_PMS_PROVIDEREND;
443 }
444 HandlerCatch(handler);
445
446 PEG_METHOD_EXIT();
447
448 return(response);
449 }
450
|
451 schuur 1.20 Message * CMPIProviderManager::handleEnumerateInstanceNamesRequest(const Message * message)
|
452 schuur 1.4 {
453 PEG_METHOD_ENTER(TRC_PROVIDERMANAGER, "CMPIProviderManager::handleEnumerateInstanceNamesRequest");
454
455 HandlerIntro(EnumerateInstanceNames,message,request,response,
456 handler,Array<CIMObjectPath>());
457 try {
458 Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE,
459 "CMPIProviderManager::handleEnumerateInstanceNamesRequest - Host name: $0 Name space: $1 Class name: $2",
460 System::getHostName(),
461 request->nameSpace.getString(),
462 request->className.getString());
463
464 // make target object path
465 CIMObjectPath objectPath(
466 System::getHostName(),
467 request->nameSpace,
468 request->className);
469
470 // build an internal provider name from the request arguments
471 ProviderName name(
|
472 schuur 1.18 objectPath,
|
473 schuur 1.4 ProviderType::INSTANCE);
474
475 // resolve provider name
476 name = _resolveProviderName(name);
477
478 // get cached or load new provider module
479 CMPIProvider::OpProviderHolder ph =
|
480 schuur 1.10 providerManager.getProvider(name.getPhysicalName(), name.getLogicalName());
|
481 schuur 1.4
482 // convert arguments
483 OperationContext context;
484
485 context.insert(IdentityContainer(request->userName));
486 context.insert(AcceptLanguageListContainer(request->acceptLanguages));
487 context.insert(ContentLanguageListContainer(request->contentLanguages));
488
489 CMPIProvider & pr=ph.GetProvider();
490
491 PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
492 "Calling provider.enumerateInstanceNames: " + pr.getName());
493
|
494 schuur 1.7 DDD(cerr<<"--- CMPIProviderManager::enumerateInstanceNames"<<endl);
|
495 schuur 1.4
496 CMPIStatus rc={CMPI_RC_OK,NULL};
497 CMPI_ContextOnStack eCtx(context);
498 CMPI_ObjectPathOnStack eRef(objectPath);
499 CMPI_ResultOnStack eRes(handler,&pr.broker);
500 CMPI_ThreadContext thr(&pr.broker,&eCtx);
501
502 CMPIFlags flgs=0;
503 eCtx.ft->addEntry(&eCtx,CMPIInvocationFlags,(CMPIValue*)&flgs,CMPI_uint32);
504
505 CMPIProvider::pm_service_op_lock op_lock(&pr);
506
507 STAT_GETSTARTTIME;
508
509 rc=pr.miVector.instMI->ft->enumInstanceNames(pr.miVector.instMI,&eCtx,&eRes,&eRef);
510
511 STAT_PMS_PROVIDEREND;
512
513 if (rc.rc!=CMPI_RC_OK)
514 throw CIMException((CIMStatusCode)rc.rc);
515 }
516 schuur 1.4 HandlerCatch(handler);
517
518
519 PEG_METHOD_EXIT();
520
521 return(response);
522 }
523
|
524 schuur 1.20 Message * CMPIProviderManager::handleCreateInstanceRequest(const Message * message)
|
525 schuur 1.4 {
526 PEG_METHOD_ENTER(TRC_PROVIDERMANAGER,
527 "CMPIProviderManager::handleCreateInstanceRequest");
528
529 HandlerIntro(CreateInstance,message,request,response,
530 handler,CIMObjectPath());
531 try {
532 Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE,
533 "CMPIProviderManager::handleCreateInstanceRequest - Host name: $0 Name space: $1 Class name: $2",
534 System::getHostName(),
535 request->nameSpace.getString(),
536 request->newInstance.getPath().getClassName().getString());
537
538 // make target object path
539 CIMObjectPath objectPath(
540 System::getHostName(),
541 request->nameSpace,
542 request->newInstance.getPath().getClassName(),
543 request->newInstance.getPath().getKeyBindings());
544
545 ProviderName name(
|
546 schuur 1.18 objectPath,
|
547 schuur 1.4 ProviderType::INSTANCE);
548
549 // resolve provider name
550 name = _resolveProviderName(name);
551
552 // get cached or load new provider module
553 CMPIProvider::OpProviderHolder ph =
|
554 schuur 1.10 providerManager.getProvider(name.getPhysicalName(), name.getLogicalName(),
|
555 schuur 1.4 String::EMPTY);
556
557 // convert arguments
558 OperationContext context;
559
560 context.insert(IdentityContainer(request->userName));
561 context.insert(AcceptLanguageListContainer(request->acceptLanguages));
562 context.insert(ContentLanguageListContainer(request->contentLanguages));
563
564 // forward request
565 CMPIProvider & pr=ph.GetProvider();
566
567 PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
568 "Calling provider.createInstance: " +
569 ph.GetProvider().getName());
570
|
571 schuur 1.7 DDD(cerr<<"--- CMPIProviderManager::createInstances"<<endl);
|
572 schuur 1.4 CMPIStatus rc={CMPI_RC_OK,NULL};
573 CMPI_ContextOnStack eCtx(context);
574 CMPI_ObjectPathOnStack eRef(objectPath);
575 CMPI_ResultOnStack eRes(handler,&pr.broker);
576 CMPI_InstanceOnStack eInst(request->newInstance);
577 CMPI_ThreadContext thr(&pr.broker,&eCtx);
578
579 CMPIFlags flgs=0;
580 eCtx.ft->addEntry(&eCtx,CMPIInvocationFlags,(CMPIValue*)&flgs,CMPI_uint32);
581
582 CMPIProvider::pm_service_op_lock op_lock(&pr);
583
584 STAT_GETSTARTTIME;
585
586 rc=pr.miVector.instMI->ft->createInstance
587 (pr.miVector.instMI,&eCtx,&eRes,&eRef,&eInst);
588
589 STAT_PMS_PROVIDEREND;
590
591 if (rc.rc!=CMPI_RC_OK)
592 throw CIMException((CIMStatusCode)rc.rc);
593 schuur 1.4 }
594 HandlerCatch(handler);
595
596 PEG_METHOD_EXIT();
597
598 return(response);
599 }
600
|
601 schuur 1.20 Message * CMPIProviderManager::handleModifyInstanceRequest(const Message * message)
|
602 schuur 1.4 {
603 PEG_METHOD_ENTER(TRC_PROVIDERMANAGER,
604 "CMPIProviderManager::handleModifyInstanceRequest");
605
606 HandlerIntroVoid(ModifyInstance,message,request,response,
607 handler);
608 try {
609 Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE,
|
610 schuur 1.14 "CMPIProviderManager::handleModifyInstanceRequest - Host name: $0 Name space: $1 Class name: $2",
|
611 schuur 1.4 System::getHostName(),
612 request->nameSpace.getString(),
613 request->modifiedInstance.getPath().getClassName().getString());
614
615 // make target object path
616 CIMObjectPath objectPath(
617 System::getHostName(),
618 request->nameSpace,
619 request->modifiedInstance.getPath ().getClassName(),
620 request->modifiedInstance.getPath ().getKeyBindings());
621
622 ProviderName name(
|
623 schuur 1.18 objectPath,
|
624 schuur 1.4 ProviderType::INSTANCE);
625
626 // resolve provider name
627 name = _resolveProviderName(name);
628
629 // get cached or load new provider module
630 CMPIProvider::OpProviderHolder ph =
|
631 schuur 1.10 providerManager.getProvider(name.getPhysicalName(), name.getLogicalName(), String::EMPTY);
|
632 schuur 1.4
633 // convert arguments
634 OperationContext context;
635
636 context.insert(IdentityContainer(request->userName));
637 context.insert(AcceptLanguageListContainer(request->acceptLanguages));
638 context.insert(ContentLanguageListContainer(request->contentLanguages));
639
640 // forward request
|
641 schuur 1.17 CMPIProvider & pr=ph.GetProvider();
|
642 schuur 1.4
643 PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
644 "Calling provider.modifyInstance: " + pr.getName());
645
|
646 schuur 1.7 DDD(cerr<<"--- CMPIProviderManager::modifyInstance"<<endl);
|
647 schuur 1.4
|
648 schuur 1.17 CMPIStatus rc={CMPI_RC_OK,NULL};
|
649 schuur 1.4 CMPI_ContextOnStack eCtx(context);
650 CMPI_ObjectPathOnStack eRef(objectPath);
651 CMPI_ResultOnStack eRes(handler,&pr.broker);
652 CMPI_InstanceOnStack eInst(request->modifiedInstance);
653 CMPI_ThreadContext thr(&pr.broker,&eCtx);
654
|
655 schuur 1.17 CMPIPropertyList props(request->propertyList);
656
|
657 schuur 1.4 CMPIFlags flgs=0;
658 if (request->includeQualifiers) flgs|=CMPI_FLAG_IncludeQualifiers;
659 eCtx.ft->addEntry(&eCtx,CMPIInvocationFlags,(CMPIValue*)&flgs,CMPI_uint32);
660
661 CMPIProvider::pm_service_op_lock op_lock(&pr);
662
663 STAT_GETSTARTTIME;
664
665 rc=pr.miVector.instMI->ft->setInstance
|
666 schuur 1.17 (pr.miVector.instMI,&eCtx,&eRes,&eRef,&eInst,props.getList());
|
667 schuur 1.4
668 STAT_PMS_PROVIDEREND;
669
670 if (rc.rc!=CMPI_RC_OK)
671 throw CIMException((CIMStatusCode)rc.rc);
672 }
673 HandlerCatch(handler);
674
675 PEG_METHOD_EXIT();
676
677 return(response);
678 }
679
|
680 schuur 1.20 Message * CMPIProviderManager::handleDeleteInstanceRequest(const Message * message)
|
681 schuur 1.4 {
682 PEG_METHOD_ENTER(TRC_PROVIDERMANAGER,
683 "CMPIProviderManager::handleDeleteInstanceRequest");
684
685 HandlerIntroVoid(DeleteInstance,message,request,response,
686 handler);
687 try {
688 Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE,
|
689 schuur 1.14 "CMPIProviderManager::handleDeleteInstanceRequest - Host name: $0 Name space: $1 Class name: $2",
|
690 schuur 1.4 System::getHostName(),
691 request->nameSpace.getString(),
692 request->instanceName.getClassName().getString());
693
694 // make target object path
695 CIMObjectPath objectPath(
696 System::getHostName(),
697 request->nameSpace,
698 request->instanceName.getClassName(),
699 request->instanceName.getKeyBindings());
700
701 ProviderName name(
|
702 schuur 1.18 objectPath,
|
703 schuur 1.4 ProviderType::INSTANCE);
704
705 // resolve provider name
706 name = _resolveProviderName(name);
707
708 // get cached or load new provider module
709 CMPIProvider::OpProviderHolder ph =
|
710 schuur 1.10 providerManager.getProvider(name.getPhysicalName(), name.getLogicalName(), String::EMPTY);
|
711 schuur 1.4
712 // convert arguments
713 OperationContext context;
714
715 context.insert(IdentityContainer(request->userName));
716 context.insert(AcceptLanguageListContainer(request->acceptLanguages));
717 context.insert(ContentLanguageListContainer(request->contentLanguages));
718
719 // forward request
720 CMPIProvider & pr=ph.GetProvider();
721
722 PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
723 "Calling provider.deleteInstance: " + pr.getName());
724
725 CMPIStatus rc={CMPI_RC_OK,NULL};
726 CMPI_ContextOnStack eCtx(context);
727 CMPI_ObjectPathOnStack eRef(objectPath);
728 CMPI_ResultOnStack eRes(handler,&pr.broker);
729 CMPI_ThreadContext thr(&pr.broker,&eCtx);
730
731 CMPIFlags flgs=0;
732 schuur 1.4 eCtx.ft->addEntry(&eCtx,CMPIInvocationFlags,(CMPIValue*)&flgs,CMPI_uint32);
733
734 CMPIProvider::pm_service_op_lock op_lock(&pr);
735
736 STAT_GETSTARTTIME;
737
738 rc=pr.miVector.instMI->ft->deleteInstance
739 (pr.miVector.instMI,&eCtx,&eRes,&eRef);
740
741 STAT_PMS_PROVIDEREND;
742
743 if (rc.rc!=CMPI_RC_OK)
744 throw CIMException((CIMStatusCode)rc.rc);
745 }
746 HandlerCatch(handler);
747
748 PEG_METHOD_EXIT();
749
750 return(response);
751 }
752
|
753 schuur 1.20 Message * CMPIProviderManager::handleExecQueryRequest(const Message * message)
|
754 schuur 1.4 {
755 PEG_METHOD_ENTER(TRC_PROVIDERMANAGER,
|
756 schuur 1.14 "CMPIProviderManager::handleExecQueryRequest");
|
757 schuur 1.4
|
758 schuur 1.14 HandlerIntro(ExecQuery,message,request,response,
759 handler,Array<CIMObject>());
760
761 try {
762 Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE,
763 "CMPIProviderManager::ExecQueryRequest - Host name: $0 Name space: $1 Class name: $2",
764 System::getHostName(),
765 request->nameSpace.getString(),
766 request->className.getString());
767
768 // make target object path
769 CIMObjectPath objectPath(
770 System::getHostName(),
771 request->nameSpace,
772 request->className);
773
774 ProviderName name(
|
775 schuur 1.18 objectPath,
|
776 schuur 1.14 ProviderType::QUERY);
777
778 // resolve provider name
779 name = _resolveProviderName(name);
780
781 // get cached or load new provider module
782 CMPIProvider::OpProviderHolder ph =
783 providerManager.getProvider(name.getPhysicalName(), name.getLogicalName(),
784 String::EMPTY);
|
785 schuur 1.4
|
786 schuur 1.14 // convert arguments
787 OperationContext context;
|
788 schuur 1.4
|
789 schuur 1.14 context.insert(IdentityContainer(request->userName));
790 context.insert(AcceptLanguageListContainer(request->acceptLanguages));
791 context.insert(ContentLanguageListContainer(request->contentLanguages));
792
793 // forward request
794 CMPIProvider & pr=ph.GetProvider();
795
796 PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
797 "Calling provider.execQuery: " + pr.getName());
798
799 DDD(cerr<<"--- CMPIProviderManager::execQuery"<<endl);
800
801 const char **props=NULL;
802
803 CMPIStatus rc={CMPI_RC_OK,NULL};
804 CMPI_ContextOnStack eCtx(context);
805 CMPI_ObjectPathOnStack eRef(objectPath);
806 CMPI_ResultOnStack eRes(handler,&pr.broker);
807 CMPI_ThreadContext thr(&pr.broker,&eCtx);
808 const CString queryLan=request->queryLanguage.getCString();
809 const CString query=request->query.getCString();
810 schuur 1.14
811 CMPIFlags flgs=0;
812 eCtx.ft->addEntry(&eCtx,CMPIInvocationFlags,(CMPIValue*)&flgs,CMPI_uint32);
813
814 CMPIProvider::pm_service_op_lock op_lock(&pr);
815
816 STAT_GETSTARTTIME;
817
818 rc=pr.miVector.instMI->ft->execQuery
819 (pr.miVector.instMI,&eCtx,&eRes,&eRef,CHARS(queryLan),CHARS(query));
820
821 STAT_PMS_PROVIDEREND;
822
823 if (rc.rc!=CMPI_RC_OK)
824 throw CIMException((CIMStatusCode)rc.rc);
825
826 STAT_PMS_PROVIDEREND;
827 }
828 HandlerCatch(handler);
|
829 schuur 1.4
830 PEG_METHOD_EXIT();
831
832 return(response);
833 }
834
|
835 schuur 1.20 Message * CMPIProviderManager::handleAssociatorsRequest(const Message * message)
|
836 schuur 1.4 {
837 PEG_METHOD_ENTER(TRC_PROVIDERMANAGER,
838 "CMPIProviderManager::handleAssociatorsRequest");
839
840 HandlerIntro(Associators,message,request,response,
841 handler,Array<CIMObject>());
842 try {
843 Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE,
844 "CMPIProviderManager::handleAssociatorsRequest - Host name: $0 Name space: $1 Class name: $2",
845 System::getHostName(),
846 request->nameSpace.getString(),
847 request->objectName.getClassName().getString());
848
849 // make target object path
850 CIMObjectPath objectPath(
851 System::getHostName(),
852 request->nameSpace,
853 request->objectName.getClassName());
854
855 objectPath.setKeyBindings(request->objectName.getKeyBindings());
856
857 schuur 1.4 CIMObjectPath assocPath(
858 System::getHostName(),
859 request->nameSpace,
860 request->assocClass.getString());
861
862 ProviderName name(
|
863 schuur 1.18 assocPath,
|
864 schuur 1.4 ProviderType::ASSOCIATION);
865
866 // resolve provider name
867 name = _resolveProviderName(name);
868
869 // get cached or load new provider module
870 CMPIProvider::OpProviderHolder ph =
|
871 schuur 1.10 providerManager.getProvider(name.getPhysicalName(), name.getLogicalName(), String::EMPTY);
|
872 schuur 1.4
873 // convert arguments
874 OperationContext context;
875
876 context.insert(IdentityContainer(request->userName));
877 context.insert(AcceptLanguageListContainer(request->acceptLanguages));
878 context.insert(ContentLanguageListContainer(request->contentLanguages));
879
880 // forward request
|
881 schuur 1.17 CMPIProvider & pr=ph.GetProvider();
|
882 schuur 1.4
883 PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
884 "Calling provider.associators: " + pr.getName());
885
|
886 schuur 1.7 DDD(cerr<<"--- CMPIProviderManager::associators"<<" role: >"<<request->role<<"< aCls "<<
|
887 schuur 1.17 request->assocClass<<endl);
|
888 schuur 1.4
|
889 schuur 1.17 CMPIStatus rc={CMPI_RC_OK,NULL};
|
890 schuur 1.4 CMPI_ContextOnStack eCtx(context);
891 CMPI_ObjectPathOnStack eRef(objectPath);
|
892 schuur 1.17 CMPI_ResultOnStack eRes(handler,&pr.broker);
|
893 schuur 1.4 CMPI_ThreadContext thr(&pr.broker,&eCtx);
894 const CString aClass=request->assocClass.getString().getCString();
895 const CString rClass=request->resultClass.getString().getCString();
896 const CString rRole=request->role.getCString();
897 const CString resRole=request->resultRole.getCString();
898
|
899 schuur 1.17 CMPIPropertyList props(request->propertyList);
900
|
901 schuur 1.4 CMPIFlags flgs=0;
902 if (request->includeQualifiers) flgs|=CMPI_FLAG_IncludeQualifiers;
903 if (request->includeClassOrigin) flgs|=CMPI_FLAG_IncludeClassOrigin;
904 eCtx.ft->addEntry(&eCtx,CMPIInvocationFlags,(CMPIValue*)&flgs,CMPI_uint32);
905
906 CMPIProvider::pm_service_op_lock op_lock(&pr);
907
908 STAT_GETSTARTTIME;
909
910 rc=pr.miVector.assocMI->ft->associators(
911 pr.miVector.assocMI,&eCtx,&eRes,&eRef,CHARS(aClass),
|
912 schuur 1.17 CHARS(rClass),CHARS(rRole),CHARS(resRole),props.getList());
|
913 schuur 1.4
914 STAT_PMS_PROVIDEREND;
915
916 if (rc.rc!=CMPI_RC_OK)
917 throw CIMException((CIMStatusCode)rc.rc);
918 }
919 HandlerCatch(handler);
920
921 PEG_METHOD_EXIT();
922
923 return(response);
924 }
925
|
926 schuur 1.20 Message * CMPIProviderManager::handleAssociatorNamesRequest(const Message * message)
|
927 schuur 1.4 {
928 PEG_METHOD_ENTER(TRC_PROVIDERMANAGER,
929 "CMPIProviderManager::handleAssociatorNamesRequest");
930
931 HandlerIntro(AssociatorNames,message,request,response,
932 handler,Array<CIMObjectPath>());
933 try {
934 Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE,
935 "CMPIProviderManager::handleAssociatorNamesRequest - Host name: $0 Name space: $1 Class name: $2",
936 System::getHostName(),
937 request->nameSpace.getString(),
938 request->objectName.getClassName().getString());
939
940 // make target object path
941 CIMObjectPath objectPath(
942 System::getHostName(),
943 request->nameSpace,
944 request->objectName.getClassName());
945
946 objectPath.setKeyBindings(request->objectName.getKeyBindings());
947
948 schuur 1.4 CIMObjectPath assocPath(
949 System::getHostName(),
950 request->nameSpace,
951 request->assocClass.getString());
|
952 schuur 1.21
|
953 schuur 1.4 ProviderName name(
|
954 schuur 1.18 assocPath,
|
955 schuur 1.4 ProviderType::ASSOCIATION);
956
957 // resolve provider name
958 name = _resolveProviderName(name);
959
960 // get cached or load new provider module
961 CMPIProvider::OpProviderHolder ph =
|
962 schuur 1.10 providerManager.getProvider(name.getPhysicalName(), name.getLogicalName(), String::EMPTY);
|
963 schuur 1.4
964 // convert arguments
965 OperationContext context;
966
967 context.insert(IdentityContainer(request->userName));
968 context.insert(AcceptLanguageListContainer(request->acceptLanguages));
969 context.insert(ContentLanguageListContainer(request->contentLanguages));
970
971 // forward request
972 CMPIProvider & pr=ph.GetProvider();
973
974 PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
975 "Calling provider.associatorNames: " + pr.getName());
976
|
977 schuur 1.7 DDD(cerr<<"--- CMPIProviderManager::associatorNames"<<" role: >"<<request->role<<"< aCls "<<
978 request->assocClass<<endl);
|
979 schuur 1.4
980 CMPIStatus rc={CMPI_RC_OK,NULL};
981 CMPI_ContextOnStack eCtx(context);
982 CMPI_ObjectPathOnStack eRef(objectPath);
983 CMPI_ResultOnStack eRes(handler,&pr.broker);
984 CMPI_ThreadContext thr(&pr.broker,&eCtx);
985 const CString aClass=request->assocClass.getString().getCString();
986 const CString rClass=request->resultClass.getString().getCString();
987 const CString rRole=request->role.getCString();
988 const CString resRole=request->resultRole.getCString();
989
990 CMPIFlags flgs=0;
991 eCtx.ft->addEntry(&eCtx,CMPIInvocationFlags,(CMPIValue*)&flgs,CMPI_uint32);
992
993 CMPIProvider::pm_service_op_lock op_lock(&pr);
994
995 STAT_GETSTARTTIME;
996
997 rc=pr.miVector.assocMI->ft->associatorNames(
998 pr.miVector.assocMI,&eCtx,&eRes,&eRef,CHARS(aClass),
999 CHARS(rClass),CHARS(rRole),CHARS(resRole));
1000 schuur 1.4
1001 STAT_PMS_PROVIDEREND;
1002
1003 if (rc.rc!=CMPI_RC_OK)
1004 throw CIMException((CIMStatusCode)rc.rc);
1005 }
1006 HandlerCatch(handler);
1007
1008 PEG_METHOD_EXIT();
1009
1010 return(response);
1011 }
1012
|
1013 schuur 1.20 Message * CMPIProviderManager::handleReferencesRequest(const Message * message)
|
1014 schuur 1.4 {
1015 PEG_METHOD_ENTER(TRC_PROVIDERMANAGER,
1016 "CMPIProviderManager::handleReferencesRequest");
1017
1018 HandlerIntro(References,message,request,response,
1019 handler,Array<CIMObject>());
1020 try {
1021 Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE,
|
1022 schuur 1.14 "CMPIProviderManager::handleReferencesRequest - Host name: $0 Name space: $1 Class name: $2",
|
1023 schuur 1.4 System::getHostName(),
1024 request->nameSpace.getString(),
1025 request->objectName.getClassName().getString());
1026
1027 // make target object path
1028 CIMObjectPath objectPath(
1029 System::getHostName(),
1030 request->nameSpace,
1031 request->objectName.getClassName());
1032
1033 objectPath.setKeyBindings(request->objectName.getKeyBindings());
1034
1035 CIMObjectPath resultPath(
1036 System::getHostName(),
1037 request->nameSpace,
1038 request->resultClass.getString());
1039
1040 ProviderName name(
|
1041 schuur 1.18 resultPath,
|
1042 schuur 1.4 ProviderType::ASSOCIATION);
1043
1044 // resolve provider name
1045 name = _resolveProviderName(name);
1046
1047 // get cached or load new provider module
1048 CMPIProvider::OpProviderHolder ph =
|
1049 schuur 1.10 providerManager.getProvider(name.getPhysicalName(), name.getLogicalName(), String::EMPTY);
|
1050 schuur 1.4
1051 // convert arguments
1052 OperationContext context;
1053
1054 context.insert(IdentityContainer(request->userName));
1055 context.insert(AcceptLanguageListContainer(request->acceptLanguages));
1056 context.insert(ContentLanguageListContainer(request->contentLanguages));
1057
1058 // forward request
|
1059 schuur 1.17 CMPIProvider & pr=ph.GetProvider();
|
1060 schuur 1.4
1061 PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
1062 "Calling provider.references: " + pr.getName());
1063
|
1064 schuur 1.7 DDD(cerr<<"--- CMPIProviderManager::references"<<" role: >"<<request->role<<"< aCls "<<
|
1065 schuur 1.17 request->resultClass<<endl);
|
1066 schuur 1.4
|
1067 schuur 1.17 CMPIStatus rc={CMPI_RC_OK,NULL};
|
1068 schuur 1.4 CMPI_ContextOnStack eCtx(context);
1069 CMPI_ObjectPathOnStack eRef(objectPath);
|
1070 schuur 1.17 CMPI_ResultOnStack eRes(handler,&pr.broker);
|
1071 schuur 1.4 CMPI_ThreadContext thr(&pr.broker,&eCtx);
1072 const CString rClass=request->resultClass.getString().getCString();
1073 const CString rRole=request->role.getCString();
1074
|
1075 schuur 1.17 CMPIPropertyList props(request->propertyList);
1076
|
1077 schuur 1.4 CMPIFlags flgs=0;
1078 if (request->includeQualifiers) flgs|=CMPI_FLAG_IncludeQualifiers;
1079 if (request->includeClassOrigin) flgs|=CMPI_FLAG_IncludeClassOrigin;
1080 eCtx.ft->addEntry(&eCtx,CMPIInvocationFlags,(CMPIValue*)&flgs,CMPI_uint32);
1081
1082 CMPIProvider::pm_service_op_lock op_lock(&pr);
1083
1084 STAT_GETSTARTTIME;
1085
1086 rc=pr.miVector.assocMI->ft->references(
1087 pr.miVector.assocMI,&eCtx,&eRes,&eRef,
|
1088 schuur 1.17 CHARS(rClass),CHARS(rRole),props.getList());
|
1089 schuur 1.4
1090 STAT_PMS_PROVIDEREND;
1091
1092 if (rc.rc!=CMPI_RC_OK)
|
1093 schuur 1.17 throw CIMException((CIMStatusCode)rc.rc);
|
1094 schuur 1.4 }
1095 HandlerCatch(handler);
1096
1097 PEG_METHOD_EXIT();
1098
1099 return(response);
1100 }
1101
|
1102 schuur 1.20 Message * CMPIProviderManager::handleReferenceNamesRequest(const Message * message)
|
1103 schuur 1.4 {
1104 PEG_METHOD_ENTER(TRC_PROVIDERMANAGER,
1105 "CMPIProviderManager::handleReferenceNamesRequest");
1106
1107 HandlerIntro(ReferenceNames,message,request,response,
1108 handler,Array<CIMObjectPath>());
1109 try {
1110 Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE,
1111 "CMPIProviderManager::handleReferenceNamesRequest - Host name: $0 Name space: $1 Class name: $2",
1112 System::getHostName(),
1113 request->nameSpace.getString(),
1114 request->objectName.getClassName().getString());
1115
1116 // make target object path
1117 CIMObjectPath objectPath(
1118 System::getHostName(),
1119 request->nameSpace,
1120 request->objectName.getClassName());
1121
1122 objectPath.setKeyBindings(request->objectName.getKeyBindings());
1123
1124 schuur 1.4 CIMObjectPath resultPath(
1125 System::getHostName(),
1126 request->nameSpace,
1127 request->resultClass.getString());
1128
1129 ProviderName name(
|
1130 schuur 1.18 resultPath,
|
1131 schuur 1.4 ProviderType::ASSOCIATION);
1132
1133 // resolve provider name
1134 name = _resolveProviderName(name);
1135
1136 // get cached or load new provider module
1137 CMPIProvider::OpProviderHolder ph =
|
1138 schuur 1.10 providerManager.getProvider(name.getPhysicalName(), name.getLogicalName(), String::EMPTY);
|
1139 schuur 1.4
1140 // convert arguments
1141 OperationContext context;
1142
1143 context.insert(IdentityContainer(request->userName));
1144 context.insert(AcceptLanguageListContainer(request->acceptLanguages));
1145 context.insert(ContentLanguageListContainer(request->contentLanguages));
1146
1147 CMPIProvider & pr=ph.GetProvider();
1148
1149 PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
1150 "Calling provider.referenceNames: " + pr.getName());
1151
|
1152 schuur 1.7 DDD(cerr<<"--- CMPIProviderManager::referenceNames"<<" role: >"<<request->role<<"< aCls "<<
1153 request->resultClass<<endl);
|
1154 schuur 1.4
1155 CMPIStatus rc={CMPI_RC_OK,NULL};
1156 CMPI_ContextOnStack eCtx(context);
1157 CMPI_ObjectPathOnStack eRef(objectPath);
1158 CMPI_ResultOnStack eRes(handler,&pr.broker);
1159 CMPI_ThreadContext thr(&pr.broker,&eCtx);
1160 const CString rClass=request->resultClass.getString().getCString();
1161 const CString rRole=request->role.getCString();
1162
1163 CMPIFlags flgs=0;
1164 eCtx.ft->addEntry(&eCtx,CMPIInvocationFlags,(CMPIValue*)&flgs,CMPI_uint32);
1165
1166 CMPIProvider::pm_service_op_lock op_lock(&pr);
1167
1168 STAT_GETSTARTTIME;
1169
1170 rc=pr.miVector.assocMI->ft->referenceNames(
1171 pr.miVector.assocMI,&eCtx,&eRes,&eRef,
1172 CHARS(rClass),CHARS(rRole));
1173
1174 STAT_PMS_PROVIDEREND;
1175 schuur 1.4
1176 if (rc.rc!=CMPI_RC_OK)
1177 throw CIMException((CIMStatusCode)rc.rc);
1178 }
1179 HandlerCatch(handler);
1180
1181 PEG_METHOD_EXIT();
1182
1183 return(response);
1184 }
1185
|
1186 schuur 1.20 Message * CMPIProviderManager::handleInvokeMethodRequest(const Message * message)
|
1187 schuur 1.4 {
1188 PEG_METHOD_ENTER(TRC_PROVIDERMANAGER,
1189 "CMPIProviderManager::handleInvokeMethodRequest");
1190
1191 HandlerIntroMethod(InvokeMethod,message,request,response,
1192 handler);
1193 try {
1194 Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE,
1195 "CMPIProviderManager::handleInvokeMethodRequest - Host name: $0 Name space: $1 Class name: $2",
1196 System::getHostName(),
1197 request->nameSpace.getString(),
1198 request->instanceName.getClassName().getString());
1199
1200 // make target object path
1201 CIMObjectPath objectPath(
1202 System::getHostName(),
1203 request->nameSpace,
1204 request->instanceName.getClassName(),
1205 request->instanceName.getKeyBindings());
1206
1207 ProviderName name(
|
1208 schuur 1.18 objectPath,
1209 ProviderType::METHOD,
1210 request->methodName);
|
1211 schuur 1.4
1212 // resolve provider name
1213 name = _resolveProviderName(name);
1214
1215 // get cached or load new provider module
1216 CMPIProvider::OpProviderHolder ph =
|
1217 schuur 1.10 providerManager.getProvider(name.getPhysicalName(), name.getLogicalName(), String::EMPTY);
|
1218 schuur 1.4
1219 // convert arguments
1220 OperationContext context;
1221
1222 context.insert(IdentityContainer(request->userName));
1223 context.insert(AcceptLanguageListContainer(request->acceptLanguages));
1224 context.insert(ContentLanguageListContainer(request->contentLanguages));
1225
1226 CIMObjectPath instanceReference(request->instanceName);
1227
1228 // ATTN: propagate namespace
1229 instanceReference.setNameSpace(request->nameSpace);
1230
1231 // forward request
1232 CMPIProvider & pr=ph.GetProvider();
1233
1234 PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
1235 "Calling provider.invokeMethod: " + pr.getName());
1236
1237 CMPIStatus rc={CMPI_RC_OK,NULL};
1238 CMPI_ContextOnStack eCtx(context);
1239 schuur 1.4 CMPI_ObjectPathOnStack eRef(objectPath);
1240 CMPI_ResultOnStack eRes(handler,&pr.broker);
1241 CMPI_ThreadContext thr(&pr.broker,&eCtx);
1242 CMPI_ArgsOnStack eArgsIn(request->inParameters);
1243 Array<CIMParamValue> outArgs;
1244 CMPI_ArgsOnStack eArgsOut(outArgs);
1245 CString mName=request->methodName.getString().getCString();
1246
1247 CMPIFlags flgs=0;
1248 eCtx.ft->addEntry(&eCtx,CMPIInvocationFlags,(CMPIValue*)&flgs,CMPI_uint32);
1249
1250 CMPIProvider::pm_service_op_lock op_lock(&pr);
1251
1252 STAT_GETSTARTTIME;
1253
1254 rc=pr.miVector.methMI->ft->invokeMethod(
1255 pr.miVector.methMI,&eCtx,&eRes,&eRef,CHARS(mName),&eArgsIn,&eArgsOut);
1256
1257 STAT_PMS_PROVIDEREND;
1258
1259 if (rc.rc!=CMPI_RC_OK)
1260 schuur 1.4 throw CIMException((CIMStatusCode)rc.rc);
1261
1262 for (int i=0,s=outArgs.size(); i<s; i++)
1263 handler.deliverParamValue(outArgs[i]);
1264 handler.complete();
1265 }
1266 HandlerCatch(handler);
1267
1268 PEG_METHOD_EXIT();
1269
1270 return(response);
1271 }
|
1272 schuur 1.18
|
1273 schuur 1.4 int LocateIndicationProviderNames(const CIMInstance& pInstance, const CIMInstance& pmInstance,
1274 String& providerName, String& location)
1275 {
1276 Uint32 pos = pInstance.findProperty(CIMName ("Name"));
1277 pInstance.getProperty(pos).getValue().get(providerName);
1278
1279 pos = pmInstance.findProperty(CIMName ("Location"));
|
1280 schuur 1.18 pmInstance.getProperty(pos).getValue().get(location);
|
1281 schuur 1.4 return 0;
1282 }
1283
1284 String CMPIProviderManager::getFilter(CIMInstance &subscription)
1285 {
1286 try {
1287 CIMValue filterValue = subscription.getProperty (subscription.findProperty
1288 ("Filter")).getValue ();
1289 CIMObjectPath filterReference;
1290 filterValue.get(filterReference);
1291 CIMNamespaceName ns("root/PG_InterOp");
1292
1293 CIMInstance filter=_repository->getInstance(ns,filterReference);
1294
1295 CIMValue queryValue = filter.getProperty (filter.findProperty
1296 ("Query")).getValue ();
1297 String query;
1298 queryValue.get(query);
1299 return query;
1300 }
1301 catch (CIMException &e) {
|
1302 schuur 1.7 cout<<"??? CMPIProviderManager::getFilter"<<e.getCode()<<" "<<e.getMessage()<<" ???"<<endl;
|
1303 schuur 1.4 abort();
1304 }
1305 catch (...) {
|
1306 schuur 1.7 cout<<"??? What Happend ???"<<endl;
|
1307 schuur 1.4 abort();
1308 }
|
1309 marek 1.12 return String::EMPTY;
|
1310 schuur 1.4 }
1311
|
1312 schuur 1.20 Message * CMPIProviderManager::handleCreateSubscriptionRequest(const Message * message)
|
1313 schuur 1.4 {
|
1314 schuur 1.14 PEG_METHOD_ENTER(TRC_PROVIDERMANAGER, "CMPIProviderManager::handleCreateSubscriptionRequest");
|
1315 schuur 1.4
1316 HandlerIntroInd(CreateSubscription,message,request,response,
1317 handler);
1318 try {
1319 const CIMObjectPath &x=request->subscriptionInstance.getPath();
1320
|
1321 schuur 1.17 String providerName,providerLocation;
1322 LocateIndicationProviderNames(request->provider, request->providerModule,
1323 providerName,providerLocation);
|
1324 schuur 1.4
1325 Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE,
1326 "CMPIProviderManager::handleCreateSubscriptionRequest - Host name: $0 Name space: $1 Provider name(s): $2",
1327 System::getHostName(),
1328 request->nameSpace.getString(),
1329 providerName);
1330
|
1331 schuur 1.15 String fileName = _resolvePhysicalName(providerLocation);
|
1332 schuur 1.4
1333 // get cached or load new provider module
1334 CMPIProvider::OpProviderHolder ph =
|
1335 schuur 1.10 providerManager.getProvider(fileName, providerName, String::EMPTY);
|
1336 schuur 1.4
1337 indProvRecord *prec=NULL;
|
1338 schuur 1.17 provTab.lookup(providerName,prec);
1339 if (prec) prec->count++;
|
1340 schuur 1.4 else {
|
1341 schuur 1.17 prec=new indProvRecord();
1342 provTab.insert(providerName,prec);
1343 }
|
1344 schuur 1.4
1345 indSelectRecord *srec=new indSelectRecord();
1346 const CIMObjectPath &sPath=request->subscriptionInstance.getPath();
|
1347 schuur 1.17 selxTab.insert(sPath.toString(),srec);
|
1348 schuur 1.4
1349 // convert arguments
1350 OperationContext *context=new OperationContext();
1351
1352 context->insert(IdentityContainer(request->userName));
1353 context->insert(SubscriptionInstanceContainer
1354 (request->subscriptionInstance));
1355 context->insert(SubscriptionFilterConditionContainer
1356 (request->condition, request->queryLanguage));
1357
1358 context->insert(SubscriptionLanguageListContainer
1359 (request->acceptLanguages));
1360 context->insert(AcceptLanguageListContainer(request->acceptLanguages));
1361 context->insert(ContentLanguageListContainer(request->contentLanguages));
1362
1363 CIMObjectPath subscriptionName = request->subscriptionInstance.getPath();
1364
|
1365 schuur 1.17 CMPIProvider & pr=ph.GetProvider();
|
1366 schuur 1.4
|
1367 schuur 1.17 CMPIStatus rc={CMPI_RC_OK,NULL};
|
1368 schuur 1.4 CMPI_ContextOnStack eCtx(*context);
1369 CMPI_SelectExp *eSelx=new CMPI_SelectExp(*context,
|
1370 schuur 1.17 getFilter(request->subscriptionInstance),
1371 request->queryLanguage);
1372 srec->eSelx=eSelx;
|
1373 schuur 1.4 CMPI_ThreadContext thr(&pr.broker,&eCtx);
1374
1375 PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
1376 "Calling provider.createSubscriptionRequest: " + pr.getName());
1377
|
1378 schuur 1.7 DDD(cerr<<"--- CMPIProviderManager::createSubscriptionRequest"<<endl);
|
1379 schuur 1.4
1380 for(Uint32 i = 0, n = request->classNames.size(); i < n; i++) {
1381 CIMObjectPath className(
1382 System::getHostName(),
1383 request->nameSpace,
1384 request->classNames[i]);
1385 eSelx->classNames.append(className);
1386 }
1387 CMPI_ObjectPathOnStack eRef(eSelx->classNames[0]);
1388
1389 CIMPropertyList propertyList = request->propertyList;
|
1390 schuur 1.17 if (!propertyList.isNull()) {
|
1391 schuur 1.4 Array<CIMName> p=propertyList.getPropertyNameArray();
1392 int pCount=p.size();
1393 eSelx->props=(const char**)malloc((1+pCount)*sizeof(char*));
1394 for (int i=0; i<pCount; i++) {
1395 eSelx->props[i]=strdup(p[i].getString().getCString());
|
1396 schuur 1.17 }
|
1397 schuur 1.4 eSelx->props[pCount]=NULL;
1398 }
1399
1400 Uint16 repeatNotificationPolicy = request->repeatNotificationPolicy;
1401
1402 CMPIProvider::pm_service_op_lock op_lock(&pr);
1403
1404 STAT_GETSTARTTIME;
1405
1406 rc=pr.miVector.indMI->ft->activateFilter(
1407 pr.miVector.indMI,&eCtx,NULL,eSelx,
1408 CHARS(request->nameSpace.getString().getCString()),&eRef,false);
1409
1410 STAT_PMS_PROVIDEREND;
1411
1412 if (rc.rc!=CMPI_RC_OK)
|
1413 schuur 1.17 throw CIMException((CIMStatusCode)rc.rc);
|
1414 schuur 1.4 }
1415 HandlerCatch(handler);
1416
1417 PEG_METHOD_EXIT();
1418
1419 return(response);
1420 }
1421
|
1422 schuur 1.20 Message * CMPIProviderManager::handleDeleteSubscriptionRequest(const Message * message)
|
1423 schuur 1.4 {
1424 PEG_METHOD_ENTER(TRC_PROVIDERMANAGER, "CMPIProviderManager::handleDeleteSubscriptionRequest");
1425
1426 HandlerIntroInd(DeleteSubscription,message,request,response,
1427 handler);
1428 try {
1429 String providerName,providerLocation;
1430 LocateIndicationProviderNames(request->provider, request->providerModule,
1431 providerName,providerLocation);
1432
1433 Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE,
1434 "CMPIProviderManager::handleDeleteSubscriptionRequest - Host name: $0 Name space: $1 Provider name(s): $2",
1435 System::getHostName(),
1436 request->nameSpace.getString(),
1437 providerName);
1438
|
1439 schuur 1.15 String fileName = _resolvePhysicalName(providerLocation);
|
1440 schuur 1.4
1441 // get cached or load new provider module
1442 CMPIProvider::OpProviderHolder ph =
|
1443 schuur 1.10 providerManager.getProvider(fileName, providerName, String::EMPTY);
|
1444 schuur 1.4
1445
1446 indProvRecord *prec=NULL;
1447 provTab.lookup(providerName,prec);
1448 if (--prec->count<=0) {
1449 provTab.remove(providerName);
1450 prec=NULL;
1451 }
1452
1453 indSelectRecord *srec=NULL;
1454 const CIMObjectPath &sPath=request->subscriptionInstance.getPath();
1455 String sPathString=sPath.toString();
1456 selxTab.lookup(sPathString,srec);
1457
1458 CMPI_SelectExp *eSelx=srec->eSelx;
1459 CMPI_ObjectPathOnStack eRef(eSelx->classNames[0]);
1460 selxTab.remove(sPathString);
1461
1462 // convert arguments
1463 OperationContext context;
1464
1465 schuur 1.4 context.insert(IdentityContainer(request->userName));
1466 context.insert(SubscriptionInstanceContainer
1467 (request->subscriptionInstance));
1468
1469 context.insert(SubscriptionLanguageListContainer
1470 (request->acceptLanguages));
1471 context.insert(AcceptLanguageListContainer(request->acceptLanguages));
1472 context.insert(ContentLanguageListContainer(request->contentLanguages));
1473
1474 CIMObjectPath subscriptionName = request->subscriptionInstance.getPath();
1475
1476 CMPIProvider & pr=ph.GetProvider();
1477
1478 CMPIStatus rc={CMPI_RC_OK,NULL};
1479 CMPI_ContextOnStack eCtx(context);
1480 CMPI_ThreadContext thr(&pr.broker,&eCtx);
1481
1482 PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
1483 "Calling provider.deleteSubscriptionRequest: " + pr.getName());
1484
|
1485 schuur 1.7 DDD(cerr<<"--- CMPIProviderManager::deleteSubscriptionRequest"<<endl);
|
1486 schuur 1.4
1487 CMPIProvider::pm_service_op_lock op_lock(&pr);
1488
1489 STAT_GETSTARTTIME;
1490
1491 rc=pr.miVector.indMI->ft->deActivateFilter(
1492 pr.miVector.indMI,&eCtx,NULL,eSelx,
1493 CHARS(request->nameSpace.getString().getCString()),&eRef,prec==NULL);
1494
1495 delete eSelx;
1496
1497 STAT_PMS_PROVIDEREND;
1498
1499 if (rc.rc!=CMPI_RC_OK)
1500 throw CIMException((CIMStatusCode)rc.rc);
1501 }
1502 HandlerCatch(handler);
1503
1504 PEG_METHOD_EXIT();
1505
1506 return(response);
1507 schuur 1.4 }
1508
|
1509 schuur 1.20 Message * CMPIProviderManager::handleEnableIndicationsRequest(const Message * message)
|
1510 schuur 1.4 {
1511 PEG_METHOD_ENTER(TRC_PROVIDERMANAGER, "CMPIProviderManager:: handleEnableIndicationsRequest");
1512
1513 HandlerIntroInd(EnableIndications,message,request,response,
1514 handler);
1515 try {
1516 String providerName,providerLocation;
1517 LocateIndicationProviderNames(request->provider, request->providerModule,
1518 providerName,providerLocation);
1519
1520 indProvRecord *provRec;
1521 if (provTab.lookup(providerName,provRec)) {
1522 provRec->enabled=true;
1523 provRec->handler=new EnableIndicationsResponseHandler(request, response,
1524 request->provider, ProviderManagerService::providerManagerService);
1525 }
1526
|
1527 schuur 1.15 String fileName = _resolvePhysicalName(providerLocation);
|
1528 schuur 1.4
1529 // get cached or load new provider module
1530 CMPIProvider::OpProviderHolder ph =
|
1531 schuur 1.10 providerManager.getProvider(fileName, providerName, String::EMPTY);
|
1532 schuur 1.4
1533 // convert arguments
1534 OperationContext context;
1535
1536 context.insert(AcceptLanguageListContainer(request->acceptLanguages));
1537 context.insert(ContentLanguageListContainer(request->contentLanguages));
1538
1539 CMPIProvider & pr=ph.GetProvider();
1540
1541 CMPIStatus rc={CMPI_RC_OK,NULL};
1542 CMPI_ContextOnStack eCtx(context);
1543 CMPI_ThreadContext thr(&pr.broker,&eCtx);
1544
1545 PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
1546 "Calling provider.EnableIndicationRequest: " + pr.getName());
1547
|
1548 schuur 1.7 DDD(cerr<<"--- CMPIProviderManager::enableIndicationRequest"<<endl);
|
1549 schuur 1.4
1550 CMPIProvider::pm_service_op_lock op_lock(&pr);
1551
1552 STAT_GETSTARTTIME;
1553
1554 pr.miVector.indMI->ft->enableIndications(
1555 pr.miVector.indMI);
1556
1557 STAT_PMS_PROVIDEREND;
1558 }
1559 HandlerCatch(handler);
1560
1561 PEG_METHOD_EXIT();
1562
1563 return(response);
1564 }
1565
|
1566 schuur 1.20 Message * CMPIProviderManager::handleDisableIndicationsRequest(const Message * message)
|
1567 schuur 1.4 {
1568 PEG_METHOD_ENTER(TRC_PROVIDERMANAGER, "CMPIProviderManager:: handleDisableIndicationsRequest");
1569
1570 HandlerIntroInd(DisableIndications,message,request,response,
1571 handler);
1572 try {
1573 String providerName,providerLocation;
1574 LocateIndicationProviderNames(request->provider, request->providerModule,
1575 providerName,providerLocation);
1576
1577 indProvRecord *provRec;
1578 if (provTab.lookup(providerName,provRec)) {
1579 provRec->enabled=false;
1580 if (provRec->handler) delete provRec->handler;
1581 provRec->handler=NULL;
1582 }
1583
|
1584 schuur 1.15 String fileName = _resolvePhysicalName(providerLocation);
|
1585 schuur 1.4
1586 // get cached or load new provider module
1587 CMPIProvider::OpProviderHolder ph =
|
1588 schuur 1.10 providerManager.getProvider(fileName, providerName, String::EMPTY);
|
1589 schuur 1.4
1590 // convert arguments
1591 OperationContext context;
1592
1593 context.insert(AcceptLanguageListContainer(request->acceptLanguages));
1594 context.insert(ContentLanguageListContainer(request->contentLanguages));
1595
1596 CMPIProvider & pr=ph.GetProvider();
1597
1598 CMPIStatus rc={CMPI_RC_OK,NULL};
1599 CMPI_ContextOnStack eCtx(context);
1600 CMPI_ThreadContext thr(&pr.broker,&eCtx);
1601
1602 PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
1603 "Calling provider.DisableIndicationRequest: " + pr.getName());
1604
|
1605 schuur 1.7 DDD(cerr<<"--- CMPIProviderManager::disableIndicationRequest"<<endl);
|
1606 schuur 1.4
1607 CMPIProvider::pm_service_op_lock op_lock(&pr);
1608
1609 STAT_GETSTARTTIME;
1610
1611 pr.miVector.indMI->ft->disableIndications(
1612 pr.miVector.indMI);
1613
1614 STAT_PMS_PROVIDEREND;
1615 }
1616 HandlerCatch(handler);
1617
1618 PEG_METHOD_EXIT();
1619
1620 return(response);
1621 }
1622 //
1623 // Provider module status
1624 //
1625 static const Uint16 _MODULE_OK = 2;
1626 static const Uint16 _MODULE_STOPPING = 9;
1627 schuur 1.4 static const Uint16 _MODULE_STOPPED = 10;
1628
|
1629 schuur 1.20 Message * CMPIProviderManager::handleDisableModuleRequest(const Message * message)
|
1630 schuur 1.4 {
1631 // HACK
1632 ProviderRegistrationManager * _providerRegistrationManager = GetProviderRegistrationManager();
1633
1634 PEG_METHOD_ENTER(TRC_PROVIDERMANAGER, "CMPIProviderManager::handleDisableModuleRequest");
1635
1636 CIMDisableModuleRequestMessage * request =
1637 dynamic_cast<CIMDisableModuleRequestMessage *>(const_cast<Message *>(message));
1638
1639 PEGASUS_ASSERT(request != 0);
1640
1641 // get provider module name
1642 String moduleName;
1643 CIMInstance mInstance = request->providerModule;
1644 Uint32 pos = mInstance.findProperty(CIMName ("Name"));
1645
1646 if(pos != PEG_NOT_FOUND)
1647 {
1648 mInstance.getProperty(pos).getValue().get(moduleName);
1649 }
1650
1651 schuur 1.4 Boolean disableProviderOnly = request->disableProviderOnly;
1652
1653 //
1654 // get operational status
1655 //
1656 Array<Uint16> operationalStatus;
1657
1658 if(!disableProviderOnly)
1659 {
1660 Uint32 pos2 = mInstance.findProperty(CIMName ("OperationalStatus"));
1661
1662 if(pos2 != PEG_NOT_FOUND)
1663 {
1664 //
1665 // ATTN-CAKG-P2-20020821: Check for null status?
1666 //
1667 mInstance.getProperty(pos2).getValue().get(operationalStatus);
1668 }
1669
1670 //
1671 // update module status from OK to Stopping
1672 schuur 1.4 //
1673 for(Uint32 i=0, n = operationalStatus.size(); i < n; i++)
1674 {
1675 if(operationalStatus[i] == _MODULE_OK)
1676 {
1677 operationalStatus.remove(i);
1678 }
1679 }
1680 operationalStatus.append(_MODULE_STOPPING);
1681
1682 if(_providerRegistrationManager->setProviderModuleStatus
1683 (moduleName, operationalStatus) == false)
1684 {
1685 //l10n
1686 //throw PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED, "set module status failed.");
1687 throw PEGASUS_CIM_EXCEPTION_L(CIM_ERR_FAILED, MessageLoaderParms(
1688 "ProviderManager.CMPIProviderManager.SET_MODULE_STATUS_FAILED",
1689 "set module status failed."));
1690 }
1691 }
1692
1693 schuur 1.4 // Unload providers
1694 Array<CIMInstance> _pInstances = request->providers;
|
1695 schuur 1.16 String physicalName=_resolvePhysicalName(request->providerModule.getProperty(
1696 request->providerModule.findProperty("Location")).getValue().toString());
|
1697 schuur 1.4
1698 for(Uint32 i = 0, n = _pInstances.size(); i < n; i++)
1699 {
|
1700 schuur 1.16 providerManager.unloadProvider(_pInstances[i].getProperty(
1701 request->providerModule.findProperty
1702 ("Name")).getValue ().toString (),
1703 physicalName);
|
1704 schuur 1.4 }
1705
1706 if(!disableProviderOnly)
1707 {
1708 // update module status from Stopping to Stopped
1709 for(Uint32 i=0, n = operationalStatus.size(); i < n; i++)
1710 {
1711 if(operationalStatus[i] == _MODULE_STOPPING)
1712 {
1713 operationalStatus.remove(i);
1714 }
1715 }
1716
1717 operationalStatus.append(_MODULE_STOPPED);
1718
1719 if(_providerRegistrationManager->setProviderModuleStatus
1720 (moduleName, operationalStatus) == false)
1721 {
1722 //l10n
1723 //throw PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED,
1724 //"set module status failed.");
1725 schuur 1.4 throw PEGASUS_CIM_EXCEPTION_L(CIM_ERR_FAILED, MessageLoaderParms(
1726 "ProviderManager.CMPIProviderManager.SET_MODULE_STATUS_FAILED",
1727 "set module status failed."));
1728 }
1729 }
1730
1731 CIMDisableModuleResponseMessage * response =
1732 new CIMDisableModuleResponseMessage(
1733 request->messageId,
1734 CIMException(),
1735 request->queueIds.copyAndPop(),
1736 operationalStatus);
1737
1738 PEGASUS_ASSERT(response != 0);
1739
1740 // preserve message key
1741 response->setKey(request->getKey());
1742
1743 //
1744 // Set HTTP method in response from request
1745 //
1746 schuur 1.4 response->setHttpMethod (request->getHttpMethod ());
1747
1748 PEG_METHOD_EXIT();
1749
1750 return(response);
1751 }
1752
|
1753 schuur 1.20 Message * CMPIProviderManager::handleEnableModuleRequest(const Message * message)
|
1754 schuur 1.4 {
1755 // HACK
1756 ProviderRegistrationManager * _providerRegistrationManager = GetProviderRegistrationManager();
1757
1758 PEG_METHOD_ENTER(TRC_PROVIDERMANAGER, "CMPIProviderManager::handleEnableModuleRequest");
1759
1760 CIMEnableModuleRequestMessage * request =
1761 dynamic_cast<CIMEnableModuleRequestMessage *>(const_cast<Message *>(message));
1762
1763 PEGASUS_ASSERT(request != 0);
1764
1765 //
1766 // get module status
1767 //
1768 CIMInstance mInstance = request->providerModule;
1769 Array<Uint16> operationalStatus;
1770 Uint32 pos = mInstance.findProperty(CIMName ("OperationalStatus"));
1771
1772 if(pos != PEG_NOT_FOUND)
1773 {
1774 //
1775 schuur 1.4 // ATTN-CAKG-P2-20020821: Check for null status?
1776 //
1777 mInstance.getProperty(pos).getValue().get(operationalStatus);
1778 }
1779
1780 // update module status from Stopped to OK
1781 for(Uint32 i=0, n = operationalStatus.size(); i < n; i++)
1782 {
1783 if(operationalStatus[i] == _MODULE_STOPPED)
1784 {
1785 operationalStatus.remove(i);
1786 }
1787 }
1788
1789 operationalStatus.append(_MODULE_OK);
1790
1791 //
1792 // get module name
1793 //
1794 String moduleName;
1795
1796 schuur 1.4 Uint32 pos2 = mInstance.findProperty(CIMName ("Name"));
1797
1798 if(pos2 != PEG_NOT_FOUND)
1799 {
1800 mInstance.getProperty(pos2).getValue().get(moduleName);
1801 }
1802
1803 if(_providerRegistrationManager->setProviderModuleStatus
1804 (moduleName, operationalStatus) == false)
1805 {
1806 //l10n
1807 //throw PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED, "set module status failed.");
1808 throw PEGASUS_CIM_EXCEPTION_L(CIM_ERR_FAILED, MessageLoaderParms(
1809 "ProviderManager.CMPIProviderManager.SET_MODULE_STATUS_FAILED",
1810 "set module status failed."));
1811 }
1812
1813 CIMEnableModuleResponseMessage * response =
1814 new CIMEnableModuleResponseMessage(
1815 request->messageId,
1816 CIMException(),
1817 schuur 1.4 request->queueIds.copyAndPop(),
1818 operationalStatus);
1819
1820 PEGASUS_ASSERT(response != 0);
1821
1822 // preserve message key
1823 response->setKey(request->getKey());
1824
1825 // Set HTTP method in response from request
1826 response->setHttpMethod (request->getHttpMethod ());
1827
1828 PEG_METHOD_EXIT();
1829
1830 return(response);
1831 }
1832
|
1833 schuur 1.20 Message * CMPIProviderManager::handleStopAllProvidersRequest(const Message * message)
|
1834 schuur 1.4 {
1835 PEG_METHOD_ENTER(TRC_PROVIDERMANAGER, "CMPIProviderManager::handleStopAllProvidersRequest");
1836
1837 CIMStopAllProvidersRequestMessage * request =
1838 dynamic_cast<CIMStopAllProvidersRequestMessage *>(const_cast<Message *>(message));
1839
1840 PEGASUS_ASSERT(request != 0);
1841
1842 CIMStopAllProvidersResponseMessage * response =
1843 new CIMStopAllProvidersResponseMessage(
1844 request->messageId,
1845 CIMException(),
1846 request->queueIds.copyAndPop());
1847
1848 PEGASUS_ASSERT(response != 0);
1849
1850 // preserve message key
1851 response->setKey(request->getKey());
1852
1853 // Set HTTP method in response from request
1854 response->setHttpMethod (request->getHttpMethod ());
1855 schuur 1.4
1856 // tell the provider manager to shutdown all the providers
|
1857 schuur 1.10 providerManager.shutdownAllProviders();
|
1858 schuur 1.4
1859 PEG_METHOD_EXIT();
1860
1861 return(response);
1862 }
1863
|
1864 schuur 1.20 Message * CMPIProviderManager::handleUnsupportedRequest(const Message * message)
|
1865 schuur 1.4 {
1866 PEG_METHOD_ENTER(TRC_PROVIDERMANAGER, "CMPIProviderManager::handleUnsupportedRequest");
1867
1868 PEG_METHOD_EXIT();
1869
1870 // a null response implies unsupported or unknown operation
|
1871 chip 1.1 return(0);
|
1872 schuur 1.4 }
1873
1874 ProviderName CMPIProviderManager::_resolveProviderName(const ProviderName & providerName)
1875 {
1876 ProviderName temp = findProvider(providerName);
1877
|
1878 schuur 1.15 String physicalName=_resolvePhysicalName(temp.getPhysicalName());
|
1879 schuur 1.4
1880 temp.setPhysicalName(physicalName);
1881
1882 return(temp);
|
1883 chip 1.1 }
1884
1885 PEGASUS_NAMESPACE_END
|