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