ac6d6e8a415747c5e0d3f0269b6285fca4fe915f
[tpot/pegasus/.git] / src / Pegasus / ProviderManager2 / CMPI / CMPIProviderManager.cpp
1 //%LICENSE////////////////////////////////////////////////////////////////
2 //
3 // Licensed to The Open Group (TOG) under one or more contributor license
4 // agreements.  Refer to the OpenPegasusNOTICE.txt file distributed with
5 // this work for additional information regarding copyright ownership.
6 // Each contributor licenses this file to you under the OpenPegasus Open
7 // Source License; you may not use this file except in compliance with the
8 // License.
9 //
10 // Permission is hereby granted, free of charge, to any person obtaining a
11 // copy of this software and associated documentation files (the "Software"),
12 // to deal in the Software without restriction, including without limitation
13 // the rights to use, copy, modify, merge, publish, distribute, sublicense,
14 // and/or sell copies of the Software, and to permit persons to whom the
15 // Software is furnished to do so, subject to the following conditions:
16 //
17 // The above copyright notice and this permission notice shall be included
18 // in all copies or substantial portions of the Software.
19 //
20 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
21 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
22 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
23 // IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
24 // CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
25 // TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
26 // SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
27 //
28 //////////////////////////////////////////////////////////////////////////
29 //
30 //%/////////////////////////////////////////////////////////////////////////////
31
32 #include "CMPI_Version.h"
33
34 #include "CMPIProviderManager.h"
35
36 #include "CMPI_Object.h"
37 #include "CMPI_Instance.h"
38 #include "CMPI_ObjectPath.h"
39 #include "CMPI_Result.h"
40 #include "CMPI_SelectExp.h"
41 #include "CMPISCMOUtilities.h"
42 #include "CMPI_Value.h"
43 #include "CMPIMsgHandleManager.h"
44
45
46 #include <Pegasus/Common/CIMMessage.h>
47 #include <Pegasus/Common/OperationContext.h>
48 #include <Pegasus/Common/OperationContextInternal.h>
49 #include <Pegasus/Common/Tracer.h>
50 #include <Pegasus/Common/StatisticalData.h>
51 #include <Pegasus/Common/Logger.h>
52 #include <Pegasus/Common/LanguageParser.h>
53 #include <Pegasus/Common/MessageLoader.h> //l10n
54 #include <Pegasus/Common/Constants.h>
55 #include <Pegasus/Common/FileSystem.h>
56
57 #include <Pegasus/Config/ConfigManager.h>
58
59 #include <Pegasus/Provider/CIMOMHandleQueryContext.h>
60 #include <Pegasus/ProviderManager2/CIMOMHandleContext.h>
61 #include <Pegasus/ProviderManager2/ProviderName.h>
62 #include <Pegasus/ProviderManager2/AutoPThreadSecurity.h>
63 #include <Pegasus/ProviderManager2/CMPI/CMPIProviderModule.h>
64 #include <Pegasus/ProviderManager2/CMPI/CMPIProvider.h>
65 #include <Pegasus/ProviderManager2/CMPI/CMPI_ThreadContext.h>
66 #include <Pegasus/Query/QueryExpression/QueryExpression.h>
67 #include <Pegasus/Query/QueryCommon/QueryException.h>
68
69 PEGASUS_USING_STD;
70
71 PEGASUS_NAMESPACE_BEGIN
72
73
74 ReadWriteSem CMPIProviderManager::rwSemProvTab;
75 CMPIProviderManager::IndProvTab CMPIProviderManager::indProvTab;
76
77 class CMPIPropertyList
78 {
79     char **props;
80     int pCount;
81 public:
82     CMPIPropertyList(CIMPropertyList &propertyList) : props(0), pCount(0)
83     {
84         PEG_METHOD_ENTER(
85             TRC_PROVIDERMANAGER,
86             "CMPIPropertyList::CMPIPropertyList()");
87         if (!propertyList.isNull())
88         {
89             Array<CIMName> p=propertyList.getPropertyNameArray();
90             pCount=p.size();
91             props = new char*[1+pCount];
92             for (int i=0; i<pCount; i++)
93             {
94                 props[i]=strdup(p[i].getString().getCString());
95             }
96             props[pCount]=NULL;
97         }
98         else props=NULL;
99         PEG_METHOD_EXIT();
100     }
101     ~CMPIPropertyList()
102     {
103         PEG_METHOD_ENTER(
104             TRC_PROVIDERMANAGER,
105             "CMPIPropertyList::~CMPIPropertyList()");
106         if (props)
107         {
108             for (int i=0; i<pCount; i++)
109                 free(props[i]);
110             delete [] props;
111         }
112         PEG_METHOD_EXIT();
113     }
114     char  **getList()
115     {
116         return props;
117     }
118 };
119
120 CMPIProviderManager::CMPIProviderManager()
121 {
122     PEG_METHOD_ENTER(
123         TRC_PROVIDERMANAGER,
124         "CMPIProviderManager::CMPIProviderManager()");
125
126     _subscriptionInitComplete = false;
127     PEG_TRACE_CSTRING (
128         TRC_PROVIDERMANAGER,
129         Tracer::LEVEL2,
130         "-- CMPI Provider Manager activated");
131     PEG_METHOD_EXIT();
132 }
133
134 CMPIProviderManager::~CMPIProviderManager()
135 {
136     PEG_METHOD_ENTER(
137         TRC_PROVIDERMANAGER,
138         "CMPIProviderManager::~CMPIProviderManager()");
139
140     IndProvRecord *indProvRec = 0;
141
142     WriteLock lock(rwSemProvTab);
143
144     for (IndProvTab::Iterator i = indProvTab.start(); i; i++)
145     {
146         indProvTab.lookup(i.key(), indProvRec);
147         delete indProvRec;
148     }
149
150     PEG_METHOD_EXIT();
151 }
152
153
154 SCMOInstance* CMPIProviderManager::getSCMOClassFromRequest(
155     CString& nameSpace,
156     CString& className )
157 {
158     SCMOClass* scmoClass = mbGetSCMOClass(
159         (const char*)nameSpace,
160         strlen((const char*)nameSpace),
161         (const char*)className,
162         strlen((const char*)className));
163
164     if (0 == scmoClass)
165     {
166         // This indicates a severe error, since we should't have come
167         // here at all, if the class is invalid
168         PEG_TRACE((TRC_PROVIDERMANAGER,Tracer::LEVEL2,
169             "CMPIProviderManager::getSCMOClassFromRequest - "
170             "Failed to obtain SCMOClass for Namespace: %s  Classname: %s",
171             (const char*) nameSpace,
172             (const char*) className));
173
174         CIMException cimException(CIM_ERR_NOT_FOUND);
175         throw cimException;
176     }
177
178     return new SCMOInstance(*scmoClass);
179 }
180
181 SCMOInstance* CMPIProviderManager::getSCMOObjectPathFromRequest(
182     CString& nameSpace,
183     CString& className,
184     CIMObjectPath& cimObjPath )
185 {
186     SCMOClass* scmoClass = mbGetSCMOClass(
187         (const char*)nameSpace,
188         strlen((const char*)nameSpace),
189         (const char*)className,
190         strlen((const char*)className));
191
192     if (0 == scmoClass)
193     {
194         // This indicates a severe error, since we should't have come
195         // here at all, if the class is invalid
196         PEG_TRACE((TRC_PROVIDERMANAGER,Tracer::LEVEL1,
197             "CMPIProviderManager::getSCMOObjectPathFromRequest - "
198             "Failed to obtain CIMClass for Namespace: %s  Classname: %s",
199             (const char*) nameSpace,
200             (const char*) className));
201
202         CIMException cimException(CIM_ERR_NOT_FOUND);
203         throw cimException;
204     }
205
206     SCMOInstance * objectPath = new SCMOInstance(*scmoClass,cimObjPath);
207     objectPath->setHostName((const char*)System::getHostName().getCString());
208     return objectPath;
209 }
210
211 SCMOInstance* CMPIProviderManager::getSCMOInstanceFromRequest(
212     CString& nameSpace,
213     CString& className,
214     CIMInstance& cimInstance )
215 {
216     SCMOClass* scmoClass = mbGetSCMOClass(
217         (const char*)nameSpace,
218         strlen((const char*)nameSpace),
219         (const char*)className,
220         strlen((const char*)className));
221
222     if (0 == scmoClass)
223     {
224         // This indicates a severe error, since we should't have come
225         // here at all, if the class is invalid
226         PEG_TRACE((TRC_PROVIDERMANAGER,Tracer::LEVEL1,
227             "CMPIProviderManager::getSCMOInstanceFromRequest - "
228             "Failed to obtain CIMClass for Namespace: %s  Classname: %s",
229             (const char*) nameSpace,
230             (const char*) className));
231
232         CIMException cimException(CIM_ERR_NOT_FOUND);
233         throw cimException;
234     }
235
236     SCMOInstance * newInstance = new SCMOInstance(*scmoClass, cimInstance);
237     newInstance->setHostName((const char*)System::getHostName().getCString());
238
239     return newInstance;
240 }
241
242
243
244 Message * CMPIProviderManager::processMessage(Message * request)
245 {
246     PEG_METHOD_ENTER(
247         TRC_PROVIDERMANAGER,
248         "CMPIProviderManager::processMessage()");
249
250     Message * response = 0;
251
252     // pass the request message to a handler method based on message type
253     switch (request->getType())
254     {
255         case CIM_GET_INSTANCE_REQUEST_MESSAGE:
256             response = handleGetInstanceRequest(request);
257
258             break;
259         case CIM_ENUMERATE_INSTANCES_REQUEST_MESSAGE:
260             response = handleEnumerateInstancesRequest(request);
261
262             break;
263         case CIM_ENUMERATE_INSTANCE_NAMES_REQUEST_MESSAGE:
264             response = handleEnumerateInstanceNamesRequest(request);
265
266             break;
267         case CIM_CREATE_INSTANCE_REQUEST_MESSAGE:
268             response = handleCreateInstanceRequest(request);
269
270             break;
271         case CIM_MODIFY_INSTANCE_REQUEST_MESSAGE:
272             response = handleModifyInstanceRequest(request);
273
274             break;
275         case CIM_DELETE_INSTANCE_REQUEST_MESSAGE:
276             response = handleDeleteInstanceRequest(request);
277
278             break;
279         case CIM_EXEC_QUERY_REQUEST_MESSAGE:
280             response = handleExecQueryRequest(request);
281
282             break;
283         case CIM_ASSOCIATORS_REQUEST_MESSAGE:
284             response = handleAssociatorsRequest(request);
285
286             break;
287         case CIM_ASSOCIATOR_NAMES_REQUEST_MESSAGE:
288             response = handleAssociatorNamesRequest(request);
289
290             break;
291         case CIM_REFERENCES_REQUEST_MESSAGE:
292             response = handleReferencesRequest(request);
293
294             break;
295         case CIM_REFERENCE_NAMES_REQUEST_MESSAGE:
296             response = handleReferenceNamesRequest(request);
297
298             break;
299         case CIM_INVOKE_METHOD_REQUEST_MESSAGE:
300             response = handleInvokeMethodRequest(request);
301
302             break;
303         case CIM_CREATE_SUBSCRIPTION_REQUEST_MESSAGE:
304             response = handleCreateSubscriptionRequest(request);
305
306             break;
307 /*    case CIM_MODIFY_SUBSCRIPTION_REQUEST_MESSAGE:
308         response = handleModifySubscriptionRequest(request);
309
310         break;
311 */
312         case CIM_DELETE_SUBSCRIPTION_REQUEST_MESSAGE:
313             response = handleDeleteSubscriptionRequest(request);
314
315             break;
316 /*    case CIM_EXPORT_INDICATION_REQUEST_MESSAGE:
317         response = handleExportIndicationRequest(request);
318         break;
319 */
320         case CIM_DISABLE_MODULE_REQUEST_MESSAGE:
321             response = handleDisableModuleRequest(request);
322
323             break;
324         case CIM_ENABLE_MODULE_REQUEST_MESSAGE:
325             response = handleEnableModuleRequest(request);
326
327             break;
328         case CIM_STOP_ALL_PROVIDERS_REQUEST_MESSAGE:
329             response = handleStopAllProvidersRequest(request);
330
331             break;
332         case CIM_SUBSCRIPTION_INIT_COMPLETE_REQUEST_MESSAGE:
333             response = handleSubscriptionInitCompleteRequest (request);
334
335             break;
336         case CIM_INDICATION_SERVICE_DISABLED_REQUEST_MESSAGE:
337             response = handleIndicationServiceDisabledRequest (request);
338             break;
339         case CIM_GET_PROPERTY_REQUEST_MESSAGE:
340             response = handleGetPropertyRequest(request);
341
342             break;
343         case CIM_SET_PROPERTY_REQUEST_MESSAGE:
344             response = handleSetPropertyRequest(request);
345
346             break;
347         default:
348             response = handleUnsupportedRequest(request);
349
350             break;
351     }
352
353     PEG_METHOD_EXIT();
354
355     return(response);
356 }
357
358 Boolean CMPIProviderManager::hasActiveProviders()
359 {
360     return providerManager.hasActiveProviders();
361 }
362
363 void CMPIProviderManager::unloadIdleProviders()
364 {
365     providerManager.unloadIdleProviders();
366 }
367
368
369 #define CHARS(cstring) (char*)(strlen(cstring)?(const char*)cstring:NULL)
370
371
372 #define HandlerIntroBase(type,type1,message,request,response,handler) \
373     CIM##type##RequestMessage * request = \
374         dynamic_cast<CIM##type##RequestMessage *>(const_cast<Message *> \
375         (message)); \
376     PEGASUS_ASSERT(request != 0); \
377     CIM##type##ResponseMessage * response = \
378         dynamic_cast<CIM##type##ResponseMessage*>(request->buildResponse()); \
379     PEGASUS_ASSERT(response != 0); \
380     type1##ResponseHandler handler(request, response, _responseChunkCallback);
381
382 #define HandlerIntroInd(type,message,request,response,handler) \
383      HandlerIntroBase(type,Operation,message,request,response,handler)
384
385 #define HandlerIntroInit(type,message,request,response,handler) \
386      HandlerIntroBase(type,Operation,message,request,response,handler)
387
388 #define HandlerIntro(type,message,request,response,handler) \
389      HandlerIntroBase(type,type,message,request,response,handler)
390
391 #define HandlerCatch(handler) \
392     catch(const CIMException & e)  \
393     { PEG_TRACE((TRC_PROVIDERMANAGER, Tracer::LEVEL1, \
394           "CIMException: %s",(const char*)e.getMessage().getCString())); \
395         handler.setCIMException(e); \
396     } \
397     catch(const Exception & e) \
398     { PEG_TRACE((TRC_PROVIDERMANAGER, Tracer::LEVEL1, \
399           "Exception: %s",(const char*)e.getMessage().getCString())); \
400         handler.setStatus(CIM_ERR_FAILED, e.getContentLanguages(), \
401         e.getMessage()); \
402     } \
403     catch(...) \
404     { PEG_TRACE_CSTRING(TRC_PROVIDERMANAGER, Tracer::LEVEL1, \
405                 "Exception: Unknown"); \
406         handler.setStatus(CIM_ERR_FAILED, "Unknown error."); \
407     }
408
409 /* setup the CMPI context based on the requests OperationContext
410    the OperationContext
411    nameSpace and remoteInfo are used by pointer instead of by reference to
412    avoid copies being generated, both CStrings are anchored on the stack in the
413    scope of the calling function to keep them valid across the lifetime of the
414    CMPI processing of a request
415 */
416 void CMPIProviderManager::_setupCMPIContexts(
417     CMPI_ContextOnStack * eCtx,
418     OperationContext * context,
419     const CString * nameSpace,
420     const CString * remoteInfo,
421     Boolean remote,
422     Boolean includeQualifiers,
423     Boolean includeClassOrigin,
424     Boolean setFlags)
425 {
426     if (setFlags)
427     {
428         // set CMPI invocation flags
429         CMPIValue value;
430         value.uint32 = 0;
431         if (includeQualifiers) value.uint32 |= CMPI_FLAG_IncludeQualifiers;
432         if (includeClassOrigin) value.uint32 |= CMPI_FLAG_IncludeClassOrigin;
433         eCtx->ft->addEntry(
434             eCtx,
435             CMPIInvocationFlags,
436             &value,
437             CMPI_uint32);
438     }
439
440     // add identity context
441     const IdentityContainer container =
442     context->get(IdentityContainer::NAME);
443     eCtx->ft->addEntry(
444         eCtx,
445         CMPIPrincipal,
446         (CMPIValue*)(const char*)container.getUserName().getCString(),
447         CMPI_chars);
448
449     // add AcceptLanguages to CMPI context
450     const AcceptLanguageListContainer accept_language=
451     context->get(AcceptLanguageListContainer::NAME);
452     const AcceptLanguageList acceptLangs = accept_language.getLanguages();
453
454     eCtx->ft->addEntry(
455         eCtx,
456         CMPIAcceptLanguage,
457         (CMPIValue*)(const char*)
458             LanguageParser::buildAcceptLanguageHeader(acceptLangs).getCString(),
459         CMPI_chars);
460
461     // add initial namespace to context
462     eCtx->ft->addEntry(
463         eCtx,
464         CMPIInitNameSpace,
465         (CMPIValue*)(const char*)(*nameSpace),
466         CMPI_chars);
467
468     // add remote info to context
469     if (remote)
470     {
471         eCtx->ft->addEntry(
472             eCtx,
473             "CMPIRRemoteInfo",(CMPIValue*)(const char*)(*remoteInfo),
474             CMPI_chars);
475     }
476 }
477
478 /*
479    Function resolves the provider name and gets the cached or loads new
480    provider module, also returns if operation is remote and the remote
481    information
482 */
483 CMPIProvider & CMPIProviderManager::_resolveAndGetProvider(
484     OperationContext * context,
485     OpProviderHolder * ph,
486     CString * remoteInfo,
487     Boolean & isRemote)
488 {
489         isRemote=false;
490
491         // resolve provider name
492         ProviderIdContainer pidc =
493             context->get(ProviderIdContainer::NAME);
494
495         ProviderName name = _resolveProviderName(pidc);
496
497         if ((isRemote=pidc.isRemoteNameSpace()))
498         {
499             *ph = providerManager.getRemoteProvider(
500                 name.getLocation(),
501                 name.getLogicalName(),
502                 name.getModuleName());
503         }
504         else
505         {
506             // get cached or load new provider module
507             *ph = providerManager.getProvider(
508                 name.getPhysicalName(),
509                 name.getLogicalName(),
510                 name.getModuleName());
511         }
512         *remoteInfo = pidc.getRemoteInfo().getCString();
513
514         // forward request
515         return ph->GetProvider();
516 }
517
518 Message * CMPIProviderManager::handleGetInstanceRequest(
519     const Message * message)
520 {
521     PEG_METHOD_ENTER(
522         TRC_PROVIDERMANAGER,
523         "CMPIProviderManager::handleGetInstanceRequest()");
524
525     HandlerIntro(GetInstance,message,request,response,handler);
526
527     try
528     {
529         PEG_TRACE((TRC_PROVIDERMANAGER,Tracer::LEVEL3,
530             "CMPIProviderManager::handleGetInstanceRequest - Host name:"
531             " %s  Name space: %s  Class name: %s",
532             (const char*) System::getHostName().getCString(),
533             (const char*) request->nameSpace.getString().getCString(),
534             (const char*)
535                 request->instanceName.getClassName().getString().getCString()));
536
537         Boolean remote=false;
538         OpProviderHolder ph;
539         CString remoteInfo;
540
541         CMPIProvider & pr = _resolveAndGetProvider(
542             &(request->operationContext),
543             &ph,
544             &remoteInfo,
545             remote);
546
547         CMPIStatus rc={CMPI_RC_OK,NULL};
548         CMPI_ContextOnStack eCtx(request->operationContext);
549         CMPI_ResultOnStack eRes(handler,pr.getBroker());
550         CMPI_ThreadContext thr(pr.getBroker(),&eCtx);
551
552         CMPIPropertyList props(request->propertyList);
553         CString nameSpace = request->nameSpace.getString().getCString();
554         CString className = request->className.getString().getCString();
555
556         _setupCMPIContexts(
557             &eCtx,
558             &(request->operationContext),
559             &nameSpace,
560             &remoteInfo,
561             remote,
562             request->includeQualifiers,
563             request->includeClassOrigin,
564             true);
565
566
567         SCMOInstance * objectPath = getSCMOObjectPathFromRequest(
568             nameSpace, className, request->instanceName);
569
570         CMPI_ObjectPathOnStack eRef(objectPath);
571
572         CMPIProvider::pm_service_op_lock op_lock(&pr);
573
574         PEG_TRACE((
575             TRC_PROVIDERMANAGER,
576             Tracer::LEVEL2,
577             "Calling provider.getInstance: %s",
578             (const char*)pr.getName().getCString()));
579
580         {
581             AutoPThreadSecurity threadLevelSecurity(request->operationContext);
582
583             StatProviderTimeMeasurement providerTime(response);
584
585             rc = pr.getInstMI()->ft->getInstance(
586                 pr.getInstMI(),
587                 &eCtx,
588                 &eRes,
589                 &eRef,
590                 (const char **)props.getList());
591         }
592
593         PEG_TRACE((
594             TRC_PROVIDERMANAGER,
595             Tracer::LEVEL2,
596             "Returning from provider.getInstance: %s",
597             (const char*)pr.getName().getCString()));
598
599 //      Need to save ContentLanguage value into operation context of response
600 //      Do this before checking rc from provider to throw exception in case
601 //      rc.msg is also localized.
602         CMPIStatus tmprc={CMPI_RC_OK,NULL};
603         CMPIData cldata =
604             eCtx.ft->getEntry (&eCtx, CMPIContentLanguage, &tmprc);
605         if (tmprc.rc == CMPI_RC_OK)
606         {
607             response->operationContext.set(
608                 ContentLanguageListContainer(
609                 ContentLanguageList(
610                 LanguageParser::parseContentLanguageHeader(
611                 CMGetCharsPtr(cldata.value.string, NULL)))));
612             handler.setContext(response->operationContext);
613         }
614
615         _throwCIMException(rc, eRes.resError);
616     }
617     HandlerCatch(handler);
618
619     PEG_METHOD_EXIT();
620
621     return(response);
622 }
623
624 Message * CMPIProviderManager::handleEnumerateInstancesRequest(
625     const Message * message)
626 {
627     PEG_METHOD_ENTER(
628         TRC_PROVIDERMANAGER,
629         "CMPIProviderManager::handleEnumerateInstanceRequest()");
630
631     HandlerIntro(EnumerateInstances,message,request,response,handler);
632     try
633     {
634         PEG_TRACE((TRC_PROVIDERMANAGER,Tracer::LEVEL3,
635             "CMPIProviderManager::handleEnumerateInstancesRequest - Host name:"
636             " %s  Name space: %s  Class name: %s",
637             (const char*) System::getHostName().getCString(),
638             (const char*) request->nameSpace.getString().getCString(),
639             (const char*) request->className.getString().getCString()));
640
641
642         Boolean remote=false;
643         OpProviderHolder ph;
644         CString remoteInfo;
645
646         CMPIProvider & pr = _resolveAndGetProvider(
647             &(request->operationContext),
648             &ph,
649             &remoteInfo,
650             remote);
651
652         CIMPropertyList propertyList(request->propertyList);
653
654         CMPIStatus rc={CMPI_RC_OK,NULL};
655         CMPI_ContextOnStack eCtx(request->operationContext);
656         CMPI_ResultOnStack eRes(handler,pr.getBroker());
657         CMPI_ThreadContext thr(pr.getBroker(),&eCtx);
658         CMPIPropertyList props(propertyList);
659         CString nameSpace = request->nameSpace.getString().getCString();
660         CString className = request->className.getString().getCString();
661
662         _setupCMPIContexts(
663             &eCtx,
664             &(request->operationContext),
665             &nameSpace,
666             &remoteInfo,
667             remote,
668             request->includeQualifiers,
669             request->includeClassOrigin,
670             true);
671
672         SCMOInstance * objectPath =
673             getSCMOClassFromRequest(nameSpace, className);
674
675         CMPI_ObjectPathOnStack eRef(objectPath);
676
677         CMPIProvider::pm_service_op_lock op_lock(&pr);
678
679         PEG_TRACE((
680             TRC_PROVIDERMANAGER,
681             Tracer::LEVEL2,
682             "Calling provider.enumerateInstances: %s",
683              (const char*)pr.getName().getCString()));
684
685         {
686             AutoPThreadSecurity threadLevelSecurity(request->operationContext);
687
688             StatProviderTimeMeasurement providerTime(response);
689
690             rc = pr.getInstMI()->ft->enumerateInstances(
691                 pr.getInstMI(),
692                 &eCtx,
693                 &eRes,
694                 &eRef,
695                 (const char **)props.getList());
696         }
697
698         PEG_TRACE((
699             TRC_PROVIDERMANAGER,
700             Tracer::LEVEL2,
701             "Returning from provider.enumerateInstances: %s",
702              (const char*)pr.getName().getCString()));
703
704 //      Need to save ContentLanguage value into operation context of response
705 //      Do this before checking rc from provider to throw exception in case
706 //      rc.msg is also localized.
707         CMPIStatus tmprc={CMPI_RC_OK,NULL};
708         CMPIData cldata =
709             eCtx.ft->getEntry(&eCtx, CMPIContentLanguage, &tmprc);
710         if (tmprc.rc == CMPI_RC_OK)
711         {
712             response->operationContext.set(
713                 ContentLanguageListContainer(
714                 ContentLanguageList(
715                 LanguageParser::parseContentLanguageHeader(
716                 CMGetCharsPtr(cldata.value.string, NULL)))));
717             handler.setContext(response->operationContext);
718         }
719
720         _throwCIMException(rc, eRes.resError);
721     }
722     HandlerCatch(handler);
723
724     PEG_METHOD_EXIT();
725
726     return(response);
727 }
728
729 Message * CMPIProviderManager::handleEnumerateInstanceNamesRequest(
730     const Message * message)
731 {
732     PEG_METHOD_ENTER(
733         TRC_PROVIDERMANAGER,
734         "CMPIProviderManager::handleEnumerateInstanceNamesRequest()");
735
736     HandlerIntro(EnumerateInstanceNames,message,request,response,handler);
737     try
738     {
739         PEG_TRACE((TRC_PROVIDERMANAGER,Tracer::LEVEL3,
740             "CMPIProviderManager::handleEnumerateInstanceNamesRequest"
741             " - Host name: %s  Name space: %s  Class name: %s",
742             (const char*) System::getHostName().getCString(),
743             (const char*) request->nameSpace.getString().getCString(),
744             (const char*) request->className.getString().getCString()));
745
746         Boolean remote=false;
747         OpProviderHolder ph;
748         CString remoteInfo;
749
750         CMPIProvider & pr = _resolveAndGetProvider(
751             &(request->operationContext),
752             &ph,
753             &remoteInfo,
754             remote);
755
756         CMPIStatus rc={CMPI_RC_OK,NULL};
757         CMPI_ContextOnStack eCtx(request->operationContext);
758         CMPI_ResultOnStack eRes(handler,pr.getBroker());
759         CMPI_ThreadContext thr(pr.getBroker(),&eCtx);
760
761         CString nameSpace = request->nameSpace.getString().getCString();
762         CString className = request->className.getString().getCString();
763
764         _setupCMPIContexts(
765             &eCtx,
766             &(request->operationContext),
767             &nameSpace,
768             &remoteInfo,
769             remote,
770             false,
771             false,
772             true);
773
774         SCMOInstance * objectPath =
775             getSCMOClassFromRequest(nameSpace, className);
776
777         CMPI_ObjectPathOnStack eRef(objectPath);
778
779         CMPIProvider::pm_service_op_lock op_lock(&pr);
780
781         PEG_TRACE((
782             TRC_PROVIDERMANAGER,
783             Tracer::LEVEL2,
784             "Calling provider.enumerateInstanceNames: %s",
785             (const char*)pr.getName().getCString()));
786
787         {
788             AutoPThreadSecurity threadLevelSecurity(request->operationContext);
789
790             StatProviderTimeMeasurement providerTime(response);
791
792             rc = pr.getInstMI()->ft->enumerateInstanceNames(
793                 pr.getInstMI(),
794                 &eCtx,
795                 &eRes,
796                 &eRef);
797         }
798
799         PEG_TRACE((
800             TRC_PROVIDERMANAGER,
801             Tracer::LEVEL2,
802             "Returning from provider.enumerateInstanceNames: %s",
803             (const char*)pr.getName().getCString()));
804
805 //      Need to save ContentLanguage value into operation context of response
806 //      Do this before checking rc from provider to throw exception in case
807 //      rc.msg is also localized.
808         CMPIStatus tmprc={CMPI_RC_OK,NULL};
809         CMPIData cldata =
810             eCtx.ft->getEntry (&eCtx, CMPIContentLanguage, &tmprc);
811         if (tmprc.rc == CMPI_RC_OK)
812         {
813             response->operationContext.set(
814                 ContentLanguageListContainer(
815                 ContentLanguageList(
816                 LanguageParser::parseContentLanguageHeader(
817                 CMGetCharsPtr(cldata.value.string, NULL)))));
818             handler.setContext(response->operationContext);
819         }
820         _throwCIMException(rc, eRes.resError);
821     }
822     HandlerCatch(handler);
823
824     PEG_METHOD_EXIT();
825
826     return(response);
827 }
828
829 Message * CMPIProviderManager::handleCreateInstanceRequest(
830     const Message * message)
831 {
832     PEG_METHOD_ENTER(
833         TRC_PROVIDERMANAGER,
834         "CMPIProviderManager::handleCreateInstanceRequest()");
835
836     HandlerIntro(CreateInstance,message,request,response,handler);
837     try
838     {
839         PEG_TRACE((TRC_PROVIDERMANAGER,Tracer::LEVEL3,
840             "CMPIProviderManager::handleCreateInstanceRequest"
841             " - Host name: %s  Name space: %s  Class name: %s",
842             (const char*) System::getHostName().getCString(),
843             (const char*) request->nameSpace.getString().getCString(),
844             (const char*)
845           request->newInstance.getPath().getClassName().getString().getCString()
846         ));
847
848         Boolean remote=false;
849         OpProviderHolder ph;
850         CString remoteInfo;
851
852         CMPIProvider & pr = _resolveAndGetProvider(
853             &(request->operationContext),
854             &ph,
855             &remoteInfo,
856             remote);
857
858         CMPIStatus rc={CMPI_RC_OK,NULL};
859         CMPI_ContextOnStack eCtx(request->operationContext);
860         CMPI_ResultOnStack eRes(handler,pr.getBroker());
861         CMPI_ThreadContext thr(pr.getBroker(),&eCtx);
862
863         CString nameSpace = request->nameSpace.getString().getCString();
864         CString className = request->newInstance.getPath().getClassName().
865             getString().getCString();
866
867         _setupCMPIContexts(
868             &eCtx,
869             &(request->operationContext),
870             &nameSpace,
871             &remoteInfo,
872             remote,
873             false,
874             false,
875             true);
876
877         SCMOInstance * newInstance = getSCMOInstanceFromRequest(
878             nameSpace, className, request->newInstance);
879         CMPI_InstanceOnStack eInst(newInstance);
880
881         // This will create a second reference for the same SCMOInstance
882         CMPI_ObjectPathOnStack eRef(*newInstance);
883
884         CMPIProvider::pm_service_op_lock op_lock(&pr);
885
886         PEG_TRACE((
887             TRC_PROVIDERMANAGER,
888             Tracer::LEVEL2,
889             "Calling provider.createInstance: %s",
890             (const char*)ph.GetProvider().getName().getCString()));
891
892         {
893             AutoPThreadSecurity threadLevelSecurity(request->operationContext);
894
895             StatProviderTimeMeasurement providerTime(response);
896
897             rc = pr.getInstMI()->ft->createInstance(
898                 pr.getInstMI(),
899                 &eCtx,
900                 &eRes,
901                 &eRef,
902                 &eInst);
903         }
904
905         PEG_TRACE((
906             TRC_PROVIDERMANAGER,
907             Tracer::LEVEL2,
908             "Returning from provider.createInstance: %s",
909             (const char*)ph.GetProvider().getName().getCString()));
910
911 //      Need to save ContentLanguage value into operation context of response
912 //      Do this before checking rc from provider to throw exception in case
913 //      rc.msg is also localized.
914         CMPIStatus tmprc={CMPI_RC_OK,NULL};
915         CMPIData cldata =
916             eCtx.ft->getEntry (&eCtx, CMPIContentLanguage, &tmprc);
917         if (tmprc.rc == CMPI_RC_OK)
918         {
919             response->operationContext.set(
920                 ContentLanguageListContainer(
921                 ContentLanguageList(
922                 LanguageParser::parseContentLanguageHeader(
923                 CMGetCharsPtr(cldata.value.string, NULL)))));
924             handler.setContext(response->operationContext);
925         }
926         _throwCIMException(rc, eRes.resError);
927     }
928     HandlerCatch(handler);
929
930     PEG_METHOD_EXIT();
931
932     return(response);
933 }
934
935 Message * CMPIProviderManager::handleModifyInstanceRequest(
936     const Message * message)
937 {
938     PEG_METHOD_ENTER(
939         TRC_PROVIDERMANAGER,
940         "CMPIProviderManager::handleModifyInstanceRequest()");
941
942     HandlerIntro(ModifyInstance,message,request,response,handler);
943     try
944     {
945         PEG_TRACE((TRC_PROVIDERMANAGER,Tracer::LEVEL3,
946             "CMPIProviderManager::handleModifyInstanceRequest"
947             " - Host name: %s  Name space: %s  Class name: %s",
948             (const char*) System::getHostName().getCString(),
949             (const char*) request->nameSpace.getString().getCString(),
950             (const char*) request->modifiedInstance.\
951                 getPath().getClassName().getString().getCString()));
952
953         Boolean remote=false;
954         OpProviderHolder ph;
955         CString remoteInfo;
956
957         CMPIProvider & pr = _resolveAndGetProvider(
958             &(request->operationContext),
959             &ph,
960             &remoteInfo,
961             remote);
962
963         CMPIStatus rc={CMPI_RC_OK,NULL};
964         CMPI_ContextOnStack eCtx(request->operationContext);
965         CMPI_ResultOnStack eRes(handler,pr.getBroker());
966         CMPI_ThreadContext thr(pr.getBroker(),&eCtx);
967
968         CMPIPropertyList props(request->propertyList);
969
970         CString nameSpace = request->nameSpace.getString().getCString();
971         CString className = request->modifiedInstance.getPath().getClassName().
972             getString().getCString();
973
974         _setupCMPIContexts(
975             &eCtx,
976             &(request->operationContext),
977             &nameSpace,
978             &remoteInfo,
979             remote,
980             request->includeQualifiers,
981             false,
982             true);
983
984
985         SCMOInstance * modInstance = getSCMOInstanceFromRequest(
986             nameSpace, className, request->modifiedInstance);
987         CMPI_InstanceOnStack eInst(modInstance);
988
989         // This will create a second reference for the same SCMOInstance
990         CMPI_ObjectPathOnStack eRef(*modInstance);
991
992         CMPIProvider::pm_service_op_lock op_lock(&pr);
993
994         PEG_TRACE((
995             TRC_PROVIDERMANAGER,
996             Tracer::LEVEL2,
997             "Calling provider.modifyInstance: %s",
998             (const char*)pr.getName().getCString()));
999
1000         {
1001             AutoPThreadSecurity threadLevelSecurity(request->operationContext);
1002
1003             StatProviderTimeMeasurement providerTime(response);
1004
1005             rc = pr.getInstMI()->ft->modifyInstance(
1006                 pr.getInstMI(),
1007                 &eCtx,
1008                 &eRes,
1009                 &eRef,
1010                 &eInst,
1011                 (const char **)props.getList());
1012         }
1013
1014         PEG_TRACE((
1015             TRC_PROVIDERMANAGER,
1016             Tracer::LEVEL2,
1017             "Returning from provider.modifyInstance: %s",
1018             (const char*)pr.getName().getCString()));
1019
1020 //      Need to save ContentLanguage value into operation context of response
1021 //      Do this before checking rc from provider to throw exception in case
1022 //      rc.msg is also localized.
1023         CMPIStatus tmprc={CMPI_RC_OK,NULL};
1024         CMPIData cldata =
1025             eCtx.ft->getEntry (&eCtx, CMPIContentLanguage, &tmprc);
1026         if (tmprc.rc == CMPI_RC_OK)
1027         {
1028             response->operationContext.set(
1029                 ContentLanguageListContainer(
1030                 ContentLanguageList(
1031                 LanguageParser::parseContentLanguageHeader(
1032                 CMGetCharsPtr(cldata.value.string, NULL)))));
1033             handler.setContext(response->operationContext);
1034         }
1035         _throwCIMException(rc, eRes.resError);
1036     }
1037     HandlerCatch(handler);
1038
1039     PEG_METHOD_EXIT();
1040
1041     return(response);
1042 }
1043
1044 Message * CMPIProviderManager::handleDeleteInstanceRequest(
1045     const Message * message)
1046 {
1047     PEG_METHOD_ENTER(
1048         TRC_PROVIDERMANAGER,
1049         "CMPIProviderManager::handleDeleteInstanceRequest()");
1050
1051     HandlerIntro(DeleteInstance,message,request,response,handler);
1052     try
1053     {
1054         PEG_TRACE((TRC_PROVIDERMANAGER,Tracer::LEVEL3,
1055             "CMPIProviderManager::handleDeleteInstanceRequest"
1056             " - Host name: %s  Name space: %s  Class name: %s",
1057             (const char*) System::getHostName().getCString(),
1058             (const char*) request->nameSpace.getString().getCString(),
1059             (const char*)
1060                 request->instanceName.getClassName().getString().getCString()));
1061
1062         Boolean remote=false;
1063         OpProviderHolder ph;
1064         CString remoteInfo;
1065
1066         CMPIProvider & pr = _resolveAndGetProvider(
1067             &(request->operationContext),
1068             &ph,
1069             &remoteInfo,
1070             remote);
1071
1072         CMPIStatus rc={CMPI_RC_OK,NULL};
1073         CMPI_ContextOnStack eCtx(request->operationContext);
1074         CMPI_ResultOnStack eRes(handler,pr.getBroker());
1075         CMPI_ThreadContext thr(pr.getBroker(),&eCtx);
1076
1077         CString nameSpace = request->nameSpace.getString().getCString();
1078         CString className = request->instanceName.getClassName().
1079             getString().getCString();
1080
1081         _setupCMPIContexts(
1082             &eCtx,
1083             &(request->operationContext),
1084             &nameSpace,
1085             &remoteInfo,
1086             remote,
1087             false,
1088             false,
1089             true);
1090
1091         SCMOInstance * objectPath = getSCMOObjectPathFromRequest(
1092             nameSpace, className, request->instanceName);
1093
1094         CMPI_ObjectPathOnStack eRef(objectPath);
1095
1096         CMPIProvider::pm_service_op_lock op_lock(&pr);
1097
1098         PEG_TRACE((
1099             TRC_PROVIDERMANAGER,
1100             Tracer::LEVEL2,
1101             "Calling provider.deleteInstance: %s",
1102             (const char*)pr.getName().getCString()));
1103
1104         {
1105             AutoPThreadSecurity threadLevelSecurity(request->operationContext);
1106
1107             StatProviderTimeMeasurement providerTime(response);
1108
1109             rc = pr.getInstMI()->ft->deleteInstance(
1110                 pr.getInstMI(),
1111                 &eCtx,
1112                 &eRes,
1113                 &eRef);
1114         }
1115
1116         PEG_TRACE((
1117             TRC_PROVIDERMANAGER,
1118             Tracer::LEVEL2,
1119             "Returning from provider.deleteInstance: %s",
1120             (const char*)pr.getName().getCString()));
1121
1122 //      Need to save ContentLanguage value into operation context of response
1123 //      Do this before checking rc from provider to throw exception in case
1124 //      rc.msg is also localized.
1125         CMPIStatus tmprc={CMPI_RC_OK,NULL};
1126         CMPIData cldata =
1127             eCtx.ft->getEntry (&eCtx, CMPIContentLanguage, &tmprc);
1128         if (tmprc.rc == CMPI_RC_OK)
1129         {
1130             response->operationContext.set(
1131                 ContentLanguageListContainer(
1132                 ContentLanguageList(
1133                 LanguageParser::parseContentLanguageHeader(
1134                 CMGetCharsPtr(cldata.value.string, NULL)))));
1135             handler.setContext(response->operationContext);
1136         }
1137         _throwCIMException(rc, eRes.resError);
1138     }
1139     HandlerCatch(handler);
1140
1141     PEG_METHOD_EXIT();
1142
1143     return(response);
1144 }
1145
1146 Message * CMPIProviderManager::handleExecQueryRequest(const Message * message)
1147 {
1148     PEG_METHOD_ENTER(
1149         TRC_PROVIDERMANAGER,
1150         "CMPIProviderManager::handleExecQueryRequest()");
1151
1152     HandlerIntro(ExecQuery,message,request,response,handler);
1153
1154     try
1155     {
1156         PEG_TRACE((TRC_PROVIDERMANAGER,Tracer::LEVEL3,
1157             "CMPIProviderManager::ExecQueryRequest"
1158             " - Host name: %s  Name space: %s  Class name: %s",
1159             (const char*) System::getHostName().getCString(),
1160             (const char*) request->nameSpace.getString().getCString(),
1161             (const char*) request->className.getString().getCString()));
1162
1163         Boolean remote=false;
1164         OpProviderHolder ph;
1165         CString remoteInfo;
1166
1167         CMPIProvider & pr = _resolveAndGetProvider(
1168             &(request->operationContext),
1169             &ph,
1170             &remoteInfo,
1171             remote);
1172
1173         const char **props=NULL;
1174
1175         CMPIStatus rc={CMPI_RC_OK,NULL};
1176         CMPI_ContextOnStack eCtx(request->operationContext);
1177         CMPI_ResultOnStack eRes(handler,pr.getBroker());
1178         CMPI_ThreadContext thr(pr.getBroker(),&eCtx);
1179
1180         const CString queryLan=request->queryLanguage.getCString();
1181         const CString query=request->query.getCString();
1182         CString nameSpace = request->nameSpace.getString().getCString();
1183         CString className = request->className.getString().getCString();
1184
1185         _setupCMPIContexts(
1186             &eCtx,
1187             &(request->operationContext),
1188             &nameSpace,
1189             &remoteInfo,
1190             remote,
1191             false,
1192             false,
1193             true);
1194
1195         SCMOInstance * classPath = getSCMOClassFromRequest(nameSpace,className);
1196         CMPI_ObjectPathOnStack eRef(classPath);
1197
1198         CMPIProvider::pm_service_op_lock op_lock(&pr);
1199
1200         PEG_TRACE((
1201             TRC_PROVIDERMANAGER,
1202             Tracer::LEVEL2,
1203             "Calling provider.execQuery: %s",
1204             (const char*)pr.getName().getCString()));
1205
1206         {
1207             AutoPThreadSecurity threadLevelSecurity(request->operationContext);
1208
1209             StatProviderTimeMeasurement providerTime(response);
1210
1211             rc = pr.getInstMI()->ft->execQuery(
1212                 pr.getInstMI(),
1213                 &eCtx,
1214                 &eRes,
1215                 &eRef,
1216                 CHARS(queryLan),
1217                 CHARS(query));
1218         }
1219
1220         PEG_TRACE((
1221             TRC_PROVIDERMANAGER,
1222             Tracer::LEVEL2,
1223             "Returning from provider.execQuery: %s",
1224             (const char*)pr.getName().getCString()));
1225
1226 //      Need to save ContentLanguage value into operation context of response
1227 //      Do this before checking rc from provider to throw exception in case
1228 //      rc.msg is also localized.
1229         CMPIStatus tmprc={CMPI_RC_OK,NULL};
1230         CMPIData cldata =
1231             eCtx.ft->getEntry (&eCtx, CMPIContentLanguage, &tmprc);
1232         if (tmprc.rc == CMPI_RC_OK)
1233         {
1234             response->operationContext.set(
1235                 ContentLanguageListContainer(
1236                 ContentLanguageList(
1237                 LanguageParser::parseContentLanguageHeader(
1238                 CMGetCharsPtr(cldata.value.string, NULL)))));
1239             handler.setContext(response->operationContext);
1240         }
1241         _throwCIMException(rc, eRes.resError);
1242
1243     }
1244     HandlerCatch(handler);
1245
1246     PEG_METHOD_EXIT();
1247
1248     return(response);
1249 }
1250
1251 Message * CMPIProviderManager::handleAssociatorsRequest(const Message * message)
1252 {
1253     PEG_METHOD_ENTER(
1254         TRC_PROVIDERMANAGER,
1255         "CMPIProviderManager::handleAssociatorsRequest()");
1256
1257     HandlerIntro(Associators,message,request,response,handler);
1258     try
1259     {
1260         PEG_TRACE((TRC_PROVIDERMANAGER,Tracer::LEVEL3,
1261             "CMPIProviderManager::handleAssociatorsRequest"
1262             " - Host name: %s  Name space: %s  Class name: %s",
1263             (const char*) System::getHostName().getCString(),
1264             (const char*) request->nameSpace.getString().getCString(),
1265             (const char*)
1266                 request->objectName.getClassName().getString().getCString()));
1267
1268         Boolean remote=false;
1269         OpProviderHolder ph;
1270         CString remoteInfo;
1271
1272         CMPIProvider & pr = _resolveAndGetProvider(
1273             &(request->operationContext),
1274             &ph,
1275             &remoteInfo,
1276             remote);
1277
1278         PEG_TRACE((TRC_PROVIDERMANAGER,Tracer::LEVEL4,
1279             "--- CMPIProviderManager::associators < role: > %s%s",
1280             (const char*)request->role.getCString(),
1281             (const char*)request->assocClass.getString().getCString()));
1282
1283         CMPIStatus rc={CMPI_RC_OK,NULL};
1284         CMPI_ContextOnStack eCtx(request->operationContext);
1285         CMPI_ResultOnStack eRes(handler,pr.getBroker());
1286         CMPI_ThreadContext thr(pr.getBroker(),&eCtx);
1287         const CString aClass=request->assocClass.getString().getCString();
1288         const CString rClass=request->resultClass.getString().getCString();
1289         const CString rRole=request->role.getCString();
1290         const CString resRole=request->resultRole.getCString();
1291         CString nameSpace = request->nameSpace.getString().getCString();
1292         CString className =
1293             request->objectName.getClassName().getString().getCString();
1294
1295         CMPIPropertyList props(request->propertyList);
1296
1297         _setupCMPIContexts(
1298             &eCtx,
1299             &(request->operationContext),
1300             &nameSpace,
1301             &remoteInfo,
1302             remote,
1303             request->includeQualifiers,
1304             request->includeClassOrigin,
1305             true);
1306
1307         SCMOInstance * objectPath = getSCMOObjectPathFromRequest(
1308             nameSpace, className, request->objectName);
1309
1310         CMPI_ObjectPathOnStack eRef(objectPath);
1311
1312         CMPIProvider::pm_service_op_lock op_lock(&pr);
1313
1314         PEG_TRACE((
1315             TRC_PROVIDERMANAGER,
1316             Tracer::LEVEL2,
1317             "Calling provider.associators: %s",
1318             (const char*)pr.getName().getCString()));
1319
1320         {
1321             AutoPThreadSecurity threadLevelSecurity(request->operationContext);
1322
1323             StatProviderTimeMeasurement providerTime(response);
1324
1325             rc = pr.getAssocMI()->ft->associators(
1326                 pr.getAssocMI(),
1327                 &eCtx,
1328                 &eRes,
1329                 &eRef,
1330                 CHARS(aClass),
1331                 CHARS(rClass),
1332                 CHARS(rRole),
1333                 CHARS(resRole),
1334                 (const char **)props.getList());
1335         }
1336
1337         PEG_TRACE((
1338             TRC_PROVIDERMANAGER,
1339             Tracer::LEVEL2,
1340             "Returning from provider.associators: %s",
1341             (const char*)pr.getName().getCString()));
1342
1343 //      Need to save ContentLanguage value into operation context of response
1344 //      Do this before checking rc from provider to throw exception in case
1345 //      rc.msg is also localized.
1346         CMPIStatus tmprc={CMPI_RC_OK,NULL};
1347         CMPIData cldata = eCtx.ft->getEntry (
1348             &eCtx,
1349             CMPIContentLanguage,
1350             &tmprc);
1351         if (tmprc.rc == CMPI_RC_OK)
1352         {
1353             response->operationContext.set(
1354                 ContentLanguageListContainer(
1355                 ContentLanguageList(
1356                 LanguageParser::parseContentLanguageHeader(
1357                 CMGetCharsPtr(cldata.value.string, NULL)))));
1358             handler.setContext(response->operationContext);
1359         }
1360         _throwCIMException(rc, eRes.resError);
1361     }
1362     HandlerCatch(handler);
1363
1364     PEG_METHOD_EXIT();
1365
1366     return(response);
1367 }
1368
1369 Message * CMPIProviderManager::handleAssociatorNamesRequest(
1370     const Message * message)
1371 {
1372     PEG_METHOD_ENTER(
1373         TRC_PROVIDERMANAGER,
1374         "CMPIProviderManager::handleAssociatorNamesRequest()");
1375
1376     HandlerIntro(AssociatorNames,message,request,response,handler);
1377     try
1378     {
1379         PEG_TRACE((TRC_PROVIDERMANAGER,Tracer::LEVEL3,
1380             "CMPIProviderManager::handleAssociatorNamesRequest"
1381             " - Host name: %s  Name space: %s  Class name: %s",
1382             (const char*) System::getHostName().getCString(),
1383             (const char*) request->nameSpace.getString().getCString(),
1384             (const char*)
1385                 request->objectName.getClassName().getString().getCString()));
1386
1387         Boolean remote=false;
1388         OpProviderHolder ph;
1389         CString remoteInfo;
1390
1391         CMPIProvider & pr = _resolveAndGetProvider(
1392             &(request->operationContext),
1393             &ph,
1394             &remoteInfo,
1395             remote);
1396
1397         PEG_TRACE((TRC_PROVIDERMANAGER,Tracer::LEVEL4,
1398             "--- CMPIProviderManager::associatorNames --  role: %s< aCls %s",
1399             (const char*)request->role.getCString(),
1400             (const char*)request->assocClass.getString().getCString()));
1401
1402         CMPIStatus rc={CMPI_RC_OK,NULL};
1403         CMPI_ContextOnStack eCtx(request->operationContext);
1404         CMPI_ResultOnStack eRes(handler,pr.getBroker());
1405         CMPI_ThreadContext thr(pr.getBroker(),&eCtx);
1406         const CString aClass=request->assocClass.getString().getCString();
1407         const CString rClass=request->resultClass.getString().getCString();
1408         const CString rRole=request->role.getCString();
1409         const CString resRole=request->resultRole.getCString();
1410         CString nameSpace = request->nameSpace.getString().getCString();
1411         CString className =
1412             request->objectName.getClassName().getString().getCString();
1413
1414         _setupCMPIContexts(
1415             &eCtx,
1416             &(request->operationContext),
1417             &nameSpace,
1418             &remoteInfo,
1419             remote,
1420             false,
1421             false,
1422             true);
1423
1424         SCMOInstance * objectPath = getSCMOObjectPathFromRequest(
1425             nameSpace, className, request->objectName);
1426
1427         CMPI_ObjectPathOnStack eRef(objectPath);
1428
1429         CMPIProvider::pm_service_op_lock op_lock(&pr);
1430
1431         PEG_TRACE((
1432             TRC_PROVIDERMANAGER,
1433             Tracer::LEVEL2,
1434             "Calling provider.associatorNames: %s",
1435             (const char*)pr.getName().getCString()));
1436
1437         {
1438             AutoPThreadSecurity threadLevelSecurity(request->operationContext);
1439
1440             StatProviderTimeMeasurement providerTime(response);
1441
1442             rc = pr.getAssocMI()->ft->associatorNames(
1443                 pr.getAssocMI(),
1444                 &eCtx,
1445                 &eRes,
1446                 &eRef,
1447                 CHARS(aClass),
1448                 CHARS(rClass),
1449                 CHARS(rRole),
1450                 CHARS(resRole));
1451         }
1452
1453         PEG_TRACE((
1454             TRC_PROVIDERMANAGER,
1455             Tracer::LEVEL2,
1456             "Returning from provider.associatorNames: %s",
1457             (const char*)pr.getName().getCString()));
1458
1459 //      Need to save ContentLanguage value into operation context of response
1460 //      Do this before checking rc from provider to throw exception in case
1461 //      rc.msg is also localized.
1462         CMPIStatus tmprc={CMPI_RC_OK,NULL};
1463         CMPIData cldata =
1464             eCtx.ft->getEntry (&eCtx, CMPIContentLanguage, &tmprc);
1465         if (tmprc.rc == CMPI_RC_OK)
1466         {
1467             response->operationContext.set(
1468                 ContentLanguageListContainer(
1469                 ContentLanguageList(
1470                 LanguageParser::parseContentLanguageHeader(
1471                 CMGetCharsPtr(cldata.value.string, NULL)))));
1472             handler.setContext(response->operationContext);
1473         }
1474         _throwCIMException(rc, eRes.resError);
1475     }
1476     HandlerCatch(handler);
1477
1478     PEG_METHOD_EXIT();
1479
1480     return(response);
1481 }
1482
1483 Message * CMPIProviderManager::handleReferencesRequest(const Message * message)
1484 {
1485     PEG_METHOD_ENTER(
1486         TRC_PROVIDERMANAGER,
1487         "CMPIProviderManager::handleReferencesRequest()");
1488
1489     HandlerIntro(References,message,request,response,handler);
1490     try
1491     {
1492         PEG_TRACE((TRC_PROVIDERMANAGER,Tracer::LEVEL3,
1493             "CMPIProviderManager::handleReferencesRequest"
1494             " - Host name: %s  Name space: %s  Class name: %s",
1495             (const char*) System::getHostName().getCString(),
1496             (const char*) request->nameSpace.getString().getCString(),
1497             (const char*)
1498                 request->objectName.getClassName().getString().getCString()));
1499
1500         Boolean remote=false;
1501         OpProviderHolder ph;
1502         CString remoteInfo;
1503
1504         CMPIProvider & pr = _resolveAndGetProvider(
1505             &(request->operationContext),
1506             &ph,
1507             &remoteInfo,
1508             remote);
1509
1510         PEG_TRACE((TRC_PROVIDERMANAGER,Tracer::LEVEL4,
1511             "--- CMPIProviderManager::references -- role:%s< aCls %s",
1512             (const char*)request->role.getCString(),
1513             (const char*)request->resultClass.getString().getCString()));
1514
1515         CMPIStatus rc={CMPI_RC_OK,NULL};
1516         CMPI_ContextOnStack eCtx(request->operationContext);
1517         CMPI_ResultOnStack eRes(handler,pr.getBroker());
1518         CMPI_ThreadContext thr(pr.getBroker(),&eCtx);
1519         const CString rClass=request->resultClass.getString().getCString();
1520         const CString rRole=request->role.getCString();
1521         CString nameSpace = request->nameSpace.getString().getCString();
1522         CString className =
1523             request->objectName.getClassName().getString().getCString();
1524
1525         CMPIPropertyList props(request->propertyList);
1526
1527         _setupCMPIContexts(
1528             &eCtx,
1529             &(request->operationContext),
1530             &nameSpace,
1531             &remoteInfo,
1532             remote,
1533             request->includeQualifiers,
1534             request->includeClassOrigin,
1535             true);
1536
1537         SCMOInstance * objectPath = getSCMOObjectPathFromRequest(
1538             nameSpace, className, request->objectName);
1539
1540         CMPI_ObjectPathOnStack eRef(objectPath);
1541
1542         CMPIProvider::pm_service_op_lock op_lock(&pr);
1543
1544         PEG_TRACE((
1545             TRC_PROVIDERMANAGER,
1546             Tracer::LEVEL2,
1547             "Calling provider.references: %s",
1548             (const char*)pr.getName().getCString()));
1549
1550         {
1551             AutoPThreadSecurity threadLevelSecurity(request->operationContext);
1552
1553             StatProviderTimeMeasurement providerTime(response);
1554
1555             rc = pr.getAssocMI()->ft->references(
1556                 pr.getAssocMI(),
1557                 &eCtx,
1558                 &eRes,
1559                 &eRef,
1560                 CHARS(rClass),
1561                 CHARS(rRole),
1562                 (const char **)props.getList());
1563         }
1564
1565         PEG_TRACE((
1566             TRC_PROVIDERMANAGER,
1567             Tracer::LEVEL2,
1568             "Returning from provider.references: %s",
1569             (const char*)pr.getName().getCString()));
1570
1571 //      Need to save ContentLanguage value into operation context of response
1572 //      Do this before checking rc from provider to throw exception in case
1573 //      rc.msg is also localized.
1574         CMPIStatus tmprc={CMPI_RC_OK,NULL};
1575         CMPIData cldata =
1576             eCtx.ft->getEntry (&eCtx, CMPIContentLanguage, &tmprc);
1577         if (tmprc.rc == CMPI_RC_OK)
1578         {
1579             response->operationContext.set(
1580                 ContentLanguageListContainer(
1581                 ContentLanguageList(
1582                 LanguageParser::parseContentLanguageHeader(
1583                 CMGetCharsPtr(cldata.value.string, NULL)))));
1584             handler.setContext(response->operationContext);
1585         }
1586         _throwCIMException(rc, eRes.resError);
1587     }
1588     HandlerCatch(handler);
1589
1590     PEG_METHOD_EXIT();
1591
1592     return(response);
1593 }
1594
1595 Message * CMPIProviderManager::handleReferenceNamesRequest(
1596     const Message * message)
1597 {
1598     PEG_METHOD_ENTER(
1599         TRC_PROVIDERMANAGER,
1600         "CMPIProviderManager::handleReferenceNamesRequest()");
1601
1602     HandlerIntro(ReferenceNames,message,request,response,handler);
1603     try
1604     {
1605         PEG_TRACE((TRC_PROVIDERMANAGER,Tracer::LEVEL3,
1606             "CMPIProviderManager::handleReferenceNamesRequest"
1607             " - Host name: %s  Name space: %s  Class name: %s",
1608             (const char*) System::getHostName().getCString(),
1609             (const char*) request->nameSpace.getString().getCString(),
1610             (const char*)
1611                 request->objectName.getClassName().getString().getCString()));
1612
1613         Boolean remote=false;
1614         OpProviderHolder ph;
1615         CString remoteInfo;
1616
1617         CMPIProvider & pr = _resolveAndGetProvider(
1618             &(request->operationContext),
1619             &ph,
1620             &remoteInfo,
1621             remote);
1622
1623         PEG_TRACE((TRC_PROVIDERMANAGER,Tracer::LEVEL4,
1624             "--- CMPIProviderManager::referenceNames -- role: %s< aCls %s",
1625             (const char*)request->role.getCString(),
1626             (const char*)request->resultClass.getString().getCString()));
1627
1628         CMPIStatus rc={CMPI_RC_OK,NULL};
1629         CMPI_ContextOnStack eCtx(request->operationContext);
1630         CMPI_ResultOnStack eRes(handler,pr.getBroker());
1631         CMPI_ThreadContext thr(pr.getBroker(),&eCtx);
1632         const CString rClass=request->resultClass.getString().getCString();
1633         const CString rRole=request->role.getCString();
1634
1635         CString nameSpace = request->nameSpace.getString().getCString();
1636         CString className =
1637             request->objectName.getClassName().getString().getCString();
1638
1639         _setupCMPIContexts(
1640             &eCtx,
1641             &(request->operationContext),
1642             &nameSpace,
1643             &remoteInfo,
1644             remote,
1645             false,
1646             false,
1647             true);
1648
1649         SCMOInstance * objectPath = getSCMOObjectPathFromRequest(
1650             nameSpace, className, request->objectName);
1651
1652         CMPI_ObjectPathOnStack eRef(objectPath);
1653
1654         CMPIProvider::pm_service_op_lock op_lock(&pr);
1655
1656         PEG_TRACE((
1657             TRC_PROVIDERMANAGER,
1658             Tracer::LEVEL2,
1659             "Calling provider.referenceNames: %s",
1660             (const char*)pr.getName().getCString()));
1661
1662         {
1663             AutoPThreadSecurity threadLevelSecurity(request->operationContext);
1664
1665             StatProviderTimeMeasurement providerTime(response);
1666
1667             rc = pr.getAssocMI()->ft->referenceNames(
1668                 pr.getAssocMI(),
1669                 &eCtx,
1670                 &eRes,
1671                 &eRef,
1672                 CHARS(rClass),
1673                 CHARS(rRole));
1674         }
1675
1676         PEG_TRACE((
1677             TRC_PROVIDERMANAGER,
1678             Tracer::LEVEL2,
1679             "Returning from provider.referenceNames: %s",
1680             (const char*)pr.getName().getCString()));
1681
1682 //      Need to save ContentLanguage value into operation context of response
1683 //      Do this before checking rc from provider to throw exception in case
1684 //      rc.msg is also localized.
1685         CMPIStatus tmprc={CMPI_RC_OK,NULL};
1686         CMPIData cldata =
1687              eCtx.ft->getEntry (&eCtx, CMPIContentLanguage, &tmprc);
1688         if (tmprc.rc == CMPI_RC_OK)
1689         {
1690             response->operationContext.set(
1691                 ContentLanguageListContainer(
1692                 ContentLanguageList(
1693                 LanguageParser::parseContentLanguageHeader(
1694                 CMGetCharsPtr(cldata.value.string, NULL)))));
1695             handler.setContext(response->operationContext);
1696         }
1697         _throwCIMException(rc, eRes.resError);
1698     }
1699     HandlerCatch(handler);
1700
1701     PEG_METHOD_EXIT();
1702
1703     return(response);
1704 }
1705
1706 Message * CMPIProviderManager::handleInvokeMethodRequest(
1707     const Message * message)
1708 {
1709     PEG_METHOD_ENTER(
1710         TRC_PROVIDERMANAGER,
1711         "CMPIProviderManager::handleInvokeMethodRequest()");
1712
1713     HandlerIntro(InvokeMethod,message,request,response,handler);
1714     try
1715     {
1716         PEG_TRACE((TRC_PROVIDERMANAGER,Tracer::LEVEL3,
1717             "CMPIProviderManager::handleInvokeMethodRequest"
1718             " - Host name: %s  Name space: %s  Class name: %s",
1719             (const char*) System::getHostName().getCString(),
1720             (const char*) request->nameSpace.getString().getCString(),
1721             (const char*)
1722                 request->instanceName.getClassName().getString().getCString()));
1723
1724         Boolean remote=false;
1725         OpProviderHolder ph;
1726         CString remoteInfo;
1727
1728         CMPIProvider & pr = _resolveAndGetProvider(
1729             &(request->operationContext),
1730             &ph,
1731             &remoteInfo,
1732             remote);
1733
1734         CMPIStatus rc={CMPI_RC_OK,NULL};
1735         CMPI_ContextOnStack eCtx(request->operationContext);
1736         CMPI_ResultOnStack eRes(handler,pr.getBroker());
1737         CMPI_ThreadContext thr(pr.getBroker(),&eCtx);
1738         CMPI_ArgsOnStack eArgsIn(request->inParameters);
1739         Array<CIMParamValue> outArgs;
1740         CMPI_ArgsOnStack eArgsOut(outArgs);
1741         CString mName=request->methodName.getString().getCString();
1742         CString nameSpace = request->nameSpace.getString().getCString();
1743         CString className = request->className.getString().getCString();
1744
1745         _setupCMPIContexts(
1746             &eCtx,
1747             &(request->operationContext),
1748             &nameSpace,
1749             &remoteInfo,
1750             remote,
1751             false,
1752             false,
1753             true);
1754
1755
1756         SCMOInstance * objectPath = getSCMOObjectPathFromRequest(
1757             nameSpace, className, request->instanceName);
1758
1759         CMPI_ObjectPathOnStack eRef(objectPath);
1760
1761         CMPIProvider::pm_service_op_lock op_lock(&pr);
1762
1763         PEG_TRACE((
1764             TRC_PROVIDERMANAGER,
1765             Tracer::LEVEL2,
1766             "Calling provider.invokeMethod: %s",
1767             (const char*)pr.getName().getCString()));
1768
1769         {
1770             AutoPThreadSecurity threadLevelSecurity(request->operationContext);
1771
1772             StatProviderTimeMeasurement providerTime(response);
1773
1774             rc = pr.getMethMI()->ft->invokeMethod(
1775                 pr.getMethMI(),
1776                 &eCtx,
1777                 &eRes,
1778                 &eRef,
1779                 CHARS(mName),
1780                 &eArgsIn,
1781                 &eArgsOut);
1782         }
1783
1784         PEG_TRACE((
1785             TRC_PROVIDERMANAGER,
1786             Tracer::LEVEL2,
1787             "Returning from provider.invokeMethod: %s",
1788             (const char*)pr.getName().getCString()));
1789
1790 //      Need to save ContentLanguage value into operation context of response
1791 //      Do this before checking rc from provider to throw exception in case
1792 //      rc.msg is also localized.
1793         CMPIStatus tmprc={CMPI_RC_OK,NULL};
1794         CMPIData cldata =
1795             eCtx.ft->getEntry (&eCtx, CMPIContentLanguage, &tmprc);
1796         if (tmprc.rc == CMPI_RC_OK)
1797         {
1798             response->operationContext.set(
1799                 ContentLanguageListContainer(
1800                 ContentLanguageList(
1801                 LanguageParser::parseContentLanguageHeader(
1802                 CMGetCharsPtr(cldata.value.string, NULL)))));
1803             handler.setContext(response->operationContext);
1804         }
1805         _throwCIMException(rc, eRes.resError);
1806
1807         // Even if external normalization is enabled we don't normalize the
1808         // Embedded instances present in output args. Normalize them here.
1809         {
1810             // There is no try catch here because if there is no external
1811             // normalization, then these containers were added by this method.
1812             const CachedClassDefinitionContainer * classCont =
1813                 dynamic_cast<const CachedClassDefinitionContainer *>(
1814                 &request->operationContext.get(
1815                 CachedClassDefinitionContainer::NAME));
1816             PEGASUS_ASSERT(classCont != 0);
1817
1818             CIMConstClass classDef(classCont->getClass());
1819             Uint32 methodIndex = classDef.findMethod(request->methodName);
1820             CIMConstMethod methodDef;
1821             if (methodIndex != PEG_NOT_FOUND)
1822             {
1823                 methodDef = classDef.getMethod(methodIndex);
1824             }
1825             for (unsigned int i = 0, n = outArgs.size(); i < n; ++i)
1826             {
1827                 CIMParamValue currentParam(outArgs[i]);
1828                 CIMValue paramValue(currentParam.getValue());
1829                 // If the parameter value is an EmbeddedObject type, we have
1830                 // to check against the type of the parameter definition.
1831                 // CMPI does not distinguish between EmbeddedObjects and
1832                 // EmbeddedInstances, so if the parameter definition has a type
1833                 // of EmbeddedInstance, the type of the output parameter must
1834                 // be changed.
1835                 if (paramValue.getType() == CIMTYPE_OBJECT &&
1836                     methodIndex != PEG_NOT_FOUND)
1837                 {
1838                     String currentParamName(currentParam.getParameterName());
1839                     Uint32 paramIndex = methodDef.findParameter(
1840                         CIMName(currentParamName));
1841                     if (paramIndex == PEG_NOT_FOUND)
1842                     {
1843                         MessageLoaderParms msg("ProviderManager.CMPI."
1844                             "CMPIProviderManager.PARAMETER_NOT_FOUND",
1845                             "Parameter $0 not found in definition for "
1846                             "method $1.", currentParamName,
1847                             request->methodName.getString());
1848
1849                         PEG_TRACE((TRC_PROVIDERMANAGER, Tracer::LEVEL1,
1850                             "Parameter %s not found in definition for "
1851                             "method %s.",
1852                             (const char*)currentParamName.getCString(),
1853                             (const char*)
1854                                 request->methodName.getString().getCString()));
1855
1856                         handler.setStatus(CIM_ERR_FAILED,
1857                             MessageLoader::getMessage(msg));
1858                     }
1859                     else
1860                     {
1861                         CIMConstParameter paramDef(
1862                             methodDef.getParameter(paramIndex));
1863                         if (paramDef.findQualifier(
1864                                 PEGASUS_QUALIFIERNAME_EMBEDDEDINSTANCE)
1865                             != PEG_NOT_FOUND)
1866                         {
1867                             if (paramValue.isArray())
1868                             {
1869                                 Array<CIMInstance> paramInstArr;
1870                                 Array<CIMObject> paramObjectArr;
1871                                 paramValue.get(paramObjectArr);
1872                                 for (Uint32 j = 0 ;
1873                                     j < paramObjectArr.size() ; ++j)
1874                                 {
1875                                     paramInstArr.append(
1876                                         CIMInstance(paramObjectArr[j]));
1877                                 }
1878                                 currentParam = CIMParamValue(currentParamName,
1879                                     CIMValue(paramInstArr));
1880                             }
1881                             else
1882                             {
1883                                 CIMObject paramObject;
1884                                 paramValue.get(paramObject);
1885                                 CIMInstance paramInst(paramObject);
1886                                 currentParam = CIMParamValue(currentParamName,
1887                                     CIMValue(paramInst));
1888                             }
1889                         }
1890                         else
1891                         {
1892                             currentParam = CIMParamValue(currentParamName,
1893                                 paramValue);
1894                         }
1895
1896                         handler.deliverParamValue(currentParam);
1897                     }
1898                 }
1899                 else
1900                 {
1901                     handler.deliverParamValue(currentParam);
1902                 }
1903             }
1904         }
1905         handler.complete();
1906     }
1907     HandlerCatch(handler);
1908
1909     PEG_METHOD_EXIT();
1910
1911     return(response);
1912 }
1913
1914 int LocateIndicationProviderNames(
1915     const CIMInstance& pInstance,
1916     const CIMInstance& pmInstance,
1917     String& providerName,
1918     String& location)
1919 {
1920    PEG_METHOD_ENTER(
1921         TRC_PROVIDERMANAGER,
1922         "CMPIProviderManager:LocateIndicationProviderNames()");
1923     Uint32 pos = pInstance.findProperty(PEGASUS_PROPERTYNAME_NAME);
1924     pInstance.getProperty(pos).getValue().get(providerName);
1925
1926     pos = pmInstance.findProperty(CIMName ("Location"));
1927     pmInstance.getProperty(pos).getValue().get(location);
1928     PEG_METHOD_EXIT();
1929     return 0;
1930 }
1931
1932 String CMPIProviderManager::_getClassNameFromQuery(
1933     CIMOMHandleQueryContext *context,
1934     String &query,
1935     String &lang)
1936 {
1937     String className;
1938
1939     try
1940     {
1941         QueryExpression qe(lang, query, *context);
1942         // Neither WQL nor CQL support joins, we should get only
1943         // one class path here.
1944         PEGASUS_ASSERT(qe.getClassPathList().size() == 1);
1945         className = qe.getClassPathList()[0].getClassName().getString();
1946     }
1947     catch(QueryException&)
1948     {
1949         // We should never get query parsing exceptions, IndicationService
1950         // already performed this checking.
1951         PEGASUS_ASSERT(0);
1952     }
1953     return className;
1954 }
1955
1956 void CMPIProviderManager::_throwCIMException(
1957     CMPIStatus rc,
1958     CMPI_Error* cmpiError)
1959 {
1960     if (rc.rc!=CMPI_RC_OK)
1961     {
1962         CIMException cimException(
1963             (CIMStatusCode)rc.rc,
1964             rc.msg ? CMGetCharsPtr(rc.msg, NULL) : String::EMPTY);
1965         if (cmpiError)
1966         {
1967             for (CMPI_Error* currErr=cmpiError;
1968                 currErr!=NULL;
1969                 currErr=currErr->nextError)
1970             {
1971                 cimException.addError(
1972                     ((CIMError*)currErr->hdl)->getInstance());
1973             }
1974         }
1975         throw cimException;
1976     }
1977
1978 }
1979
1980 Message * CMPIProviderManager::handleCreateSubscriptionRequest(
1981     const Message * message)
1982 {
1983     PEG_METHOD_ENTER(
1984         TRC_PROVIDERMANAGER,
1985         "CMPIProviderManager::handleCreateSubscriptionRequest()");
1986
1987     HandlerIntroInd(CreateSubscription,message,request,response,
1988         handler);
1989     try
1990     {
1991         CIMInstance req_provider, req_providerModule;
1992         ProviderIdContainer pidc =
1993             (ProviderIdContainer)request->operationContext.get(
1994             ProviderIdContainer::NAME);
1995         req_provider = pidc.getProvider();
1996         req_providerModule = pidc.getModule();
1997
1998         String providerName,providerLocation;
1999         LocateIndicationProviderNames(req_provider, req_providerModule,
2000             providerName,providerLocation);
2001
2002         PEG_TRACE((TRC_PROVIDERMANAGER,Tracer::LEVEL3,
2003             "CMPIProviderManager::handleCreateSubscriptionRequest"
2004             " - Host name: %s  Name space: %s  Provider name(s): %s",
2005             (const char*) System::getHostName().getCString(),
2006             (const char*) request->nameSpace.getString().getCString(),
2007             (const char*) providerName.getCString()));
2008
2009         Boolean remote=false;
2010         OpProviderHolder ph;
2011         CString remoteInfo;
2012
2013         CMPIProvider & pr = _resolveAndGetProvider(
2014             &(request->operationContext),
2015             &ph,
2016             &remoteInfo,
2017             remote);
2018
2019         //
2020         //  Save the provider instance from the request
2021         //
2022         pr.setProviderInstance (req_provider);
2023
2024         CIMObjectPath subscriptionName =
2025             request->subscriptionInstance.getPath();
2026
2027         CMPIStatus rc={CMPI_RC_OK,NULL};
2028         CMPI_ContextOnStack eCtx(request->operationContext);
2029         SubscriptionFilterConditionContainer sub_cntr =
2030             request->operationContext.get(
2031             SubscriptionFilterConditionContainer::NAME);
2032
2033         CIMOMHandleQueryContext _context(
2034             CIMNamespaceName(
2035             request->nameSpace.getString()),
2036             *pr.getCIMOMHandle());
2037
2038         CMPI_SelectExp *eSelx=new CMPI_SelectExp(
2039             request->operationContext,
2040             &_context,
2041             request->query,
2042             sub_cntr.getQueryLanguage());
2043
2044         IndProvRecord *indProvRec=NULL;
2045         const CIMObjectPath &sPath=request->subscriptionInstance.getPath();
2046
2047         {
2048             WriteLock lock(rwSemProvTab);
2049             indProvTab.lookup(pr.getName(), indProvRec);
2050             if (indProvRec == NULL)
2051             {
2052                 indProvRec = new IndProvRecord();
2053 #ifdef PEGASUS_ENABLE_REMOTE_CMPI
2054                 if (remote)
2055                 {
2056                     indProvRec->setRemoteInfo((const char*)remoteInfo);
2057                 }
2058 #endif
2059                 indProvTab.insert(pr.getName(), indProvRec);                
2060             }
2061             // Note that per provider subscription path MUST be unique.
2062             Boolean ok = indProvRec->addSelectExp(sPath, eSelx);
2063             PEGASUS_ASSERT(ok);
2064         }
2065
2066
2067         CMPI_ThreadContext thr(pr.getBroker(),&eCtx);
2068
2069         String lang(sub_cntr.getQueryLanguage());
2070         CString className = _getClassNameFromQuery(
2071             &_context,
2072             request->query,
2073             lang).getCString();
2074         CString nameSpace = request->nameSpace.getString().getCString();
2075
2076         CIMObjectPath indClassPath(
2077             System::getHostName(),
2078             request->nameSpace,
2079             (const char*)className);
2080
2081         eSelx->classNames.append(indClassPath);
2082
2083         SCMOInstance * indClassPathSCMO =
2084             getSCMOClassFromRequest(nameSpace, className);
2085         indClassPathSCMO->setHostName(
2086             (const char*)System::getHostName().getCString());
2087         eSelx->classNamesSCMO.append(*indClassPathSCMO);
2088         delete indClassPathSCMO;
2089
2090         CIMPropertyList propertyList = request->propertyList;
2091         if (!propertyList.isNull())
2092         {
2093             Array<CIMName> p=propertyList.getPropertyNameArray();
2094             int pCount=p.size();
2095             eSelx->props = new const char*[1+pCount];
2096             for (int i=0; i<pCount; i++)
2097             {
2098                 eSelx->props[i]=strdup(p[i].getString().getCString());
2099             }
2100             eSelx->props[pCount]=NULL;
2101         }
2102
2103         // includeQualifiers and includeClassOrigin not of interest for
2104         // this type of request
2105         _setupCMPIContexts(
2106             &eCtx,
2107             &(request->operationContext),
2108             &nameSpace,
2109             &remoteInfo,
2110             remote);
2111
2112         CMPIProvider::pm_service_op_lock op_lock(&pr);
2113
2114         PEG_TRACE((
2115             TRC_PROVIDERMANAGER,
2116             Tracer::LEVEL2,
2117             "Calling provider.createSubscriptionRequest: %s",
2118             (const char*)pr.getName().getCString()));
2119
2120         Boolean filterActivated = false;
2121         {
2122             AutoPThreadSecurity threadLevelSecurity(request->operationContext);
2123
2124             StatProviderTimeMeasurement providerTime(response);
2125
2126             // Call activateFilter() on each subclass name, Check if atleast one
2127             // filter can be activated for any of the subclasses.
2128             for (Uint32 i = 0, n = request->classNames.size(); i < n; i++)
2129             {
2130                 CString subClassName =
2131                     request->classNames[i].getString().getCString();
2132
2133                 // make target object paths
2134                 CIMObjectPath classPath(
2135                     System::getHostName(),
2136                     request->nameSpace,
2137                     request->classNames[i]);
2138
2139                 SCMOInstance * classPathSCMO =
2140                     getSCMOClassFromRequest(nameSpace, className);
2141                 classPathSCMO->setHostName(
2142                     (const char*)System::getHostName().getCString());
2143                 CMPI_ObjectPathOnStack eRef(classPathSCMO);
2144
2145                 if (pr.getIndMI()->ft->ftVersion >= 100)
2146                 {
2147                     rc = pr.getIndMI()->ft->activateFilter(
2148                         pr.getIndMI(),
2149                         &eCtx,
2150                         eSelx,
2151                         CHARS(className),
2152                         &eRef,
2153                         i == 0);
2154                 }
2155                 else
2156                 {
2157                     // Older version of (pre 1.00) also pass in a CMPIResult
2158
2159                     rc = ((CMPIStatus (*)(
2160                              CMPIIndicationMI*,
2161                              CMPIContext*,
2162                              CMPIResult*,
2163                              CMPISelectExp*,
2164                              const char *,
2165                              CMPIObjectPath*,
2166                              CMPIBoolean))pr.getIndMI()->ft->activateFilter)
2167                                  (pr.getIndMI(),
2168                                   &eCtx,
2169                                   NULL,
2170                                   eSelx,
2171                                   CHARS(className),
2172                                   &eRef,
2173                                   i == 0);
2174                 }
2175
2176                 if (rc.rc == CMPI_RC_OK)
2177                 {
2178                     filterActivated = true;
2179                     eSelx->classNames.append(classPath);
2180                     eSelx->classNamesSCMO.append(*classPathSCMO);
2181                 }
2182                 else
2183                 {
2184                     PEG_TRACE((
2185                         TRC_PROVIDERMANAGER,
2186                         Tracer::LEVEL2,
2187                         "activateFilter() for class %s in namespace %s "
2188                             "failed. Error : %s",
2189                         CHARS(classPath.getClassName().
2190                             getString().getCString()),
2191                         CHARS(request->nameSpace.getString().getCString()),
2192                         rc.msg ? CMGetCharsPtr(rc.msg, NULL) : "Unknown"));
2193                 }
2194             }
2195         }
2196
2197         PEG_TRACE((
2198             TRC_PROVIDERMANAGER,
2199             Tracer::LEVEL2,
2200             "Returning from provider.createSubscriptionRequest: %s",
2201             (const char*)pr.getName().getCString()));
2202
2203 //      Need to save ContentLanguage value into operation context of response
2204 //      Do this before checking rc from provider to throw exception in case
2205 //      rc.msg is also localized.
2206         CMPIStatus tmprc={CMPI_RC_OK,NULL};
2207         CMPIData cldata =
2208             eCtx.ft->getEntry (&eCtx, CMPIContentLanguage, &tmprc);
2209         if (tmprc.rc == CMPI_RC_OK)
2210         {
2211             response->operationContext.set(
2212                 ContentLanguageListContainer(
2213                 ContentLanguageList(
2214                 LanguageParser::parseContentLanguageHeader(
2215                 CMGetCharsPtr(cldata.value.string, NULL)))));
2216         }
2217
2218         if (!filterActivated)
2219         {
2220             //  Remove the select expression from the cache
2221             WriteLock lock(rwSemProvTab);
2222             Boolean ok = indProvRec->deleteSelectExp(sPath);
2223             PEGASUS_ASSERT(ok);
2224             delete eSelx;
2225             throw CIMException((CIMStatusCode)rc.rc,
2226                 rc.msg ? CMGetCharsPtr(rc.msg, NULL) : String::EMPTY);
2227         }
2228         else
2229         {
2230             //
2231             //  Increment count of current subscriptions for this provider
2232             //
2233             if (ph.GetProvider ().testIfZeroAndIncrementSubscriptions ())
2234             {
2235                 //
2236                 //  If there were no current subscriptions before the increment,
2237                 //  the first subscription has been created
2238                 //  Call the provider's enableIndications method
2239                 //
2240                 if (_subscriptionInitComplete)
2241                 {
2242                     _callEnableIndications (req_provider, _indicationCallback,
2243                         ph, (const char*)pidc.getRemoteInfo().getCString());
2244                 }
2245             }
2246         }
2247     }
2248     HandlerCatch(handler);
2249
2250     PEG_METHOD_EXIT();
2251
2252     return(response);
2253 }
2254
2255 Message * CMPIProviderManager::handleDeleteSubscriptionRequest(
2256     const Message * message)
2257 {
2258     PEG_METHOD_ENTER(
2259         TRC_PROVIDERMANAGER,
2260         "CMPIProviderManager::handleDeleteSubscriptionRequest()");
2261
2262     HandlerIntroInd(DeleteSubscription,message,request,response,
2263         handler);
2264     try
2265     {
2266         String providerName,providerLocation;
2267
2268         CIMInstance req_provider, req_providerModule;
2269         ProviderIdContainer pidc =
2270             (ProviderIdContainer)request->operationContext.get(
2271             ProviderIdContainer::NAME);
2272         req_provider = pidc.getProvider();
2273         req_providerModule = pidc.getModule();
2274
2275         LocateIndicationProviderNames(req_provider, req_providerModule,
2276             providerName,providerLocation);
2277
2278         PEG_TRACE((TRC_PROVIDERMANAGER,Tracer::LEVEL3,
2279             "CMPIProviderManager::handleDeleteSubscriptionRequest"
2280             " - Host name: %s  Name space: %s  Provider name(s): %s",
2281             (const char*) System::getHostName().getCString(),
2282             (const char*) request->nameSpace.getString().getCString(),
2283             (const char*) providerName.getCString()));
2284
2285         Boolean remote=false;
2286         OpProviderHolder ph;
2287         CString remoteInfo;
2288
2289         CMPIProvider & pr = _resolveAndGetProvider(
2290             &(request->operationContext),
2291             &ph,
2292             &remoteInfo,
2293             remote);
2294
2295         const CIMObjectPath &sPath=request->subscriptionInstance.getPath();
2296         IndProvRecord *indProvRec=NULL;
2297         CMPI_SelectExp *eSelx=NULL;
2298         {
2299             WriteLock lock(rwSemProvTab);
2300             indProvTab.lookup(pr.getName(),indProvRec);
2301             if (!indProvRec->lookupSelectExp(sPath, eSelx))
2302             {
2303                 MessageLoaderParms parms(
2304                     "ProviderManager.CMPI.CMPIProviderManager."
2305                         "FAILED_LOCATE_SUBSCRIPTION_FILTER",
2306                     "Failed to locate the subscription filter.");
2307                 // failed to get select expression from hash table
2308                 throw CIMException(CIM_ERR_FAILED, parms);
2309             }
2310             Boolean ok = indProvRec->deleteSelectExp(sPath);
2311             PEGASUS_ASSERT(ok);
2312         }
2313
2314         CString className = eSelx->classNames[0].getClassName().
2315             getString().getCString();
2316
2317         CIMObjectPath subscriptionName =
2318             request->subscriptionInstance.getPath();
2319
2320         CMPIStatus rc={CMPI_RC_OK,NULL};
2321         CMPI_ContextOnStack eCtx(request->operationContext);
2322         CMPI_ThreadContext thr(pr.getBroker(),&eCtx);
2323
2324         CString nameSpace = request->nameSpace.getString().getCString();
2325
2326         // includeQualifiers and includeClassOrigin not of interest for
2327         // this type of request
2328         _setupCMPIContexts(
2329             &eCtx,
2330             &(request->operationContext),
2331             &nameSpace,
2332             &remoteInfo,
2333             remote);
2334
2335         CMPIProvider::pm_service_op_lock op_lock(&pr);
2336
2337         PEG_TRACE((
2338             TRC_PROVIDERMANAGER,
2339             Tracer::LEVEL2,
2340             "Calling provider.deleteSubscriptionRequest: %s",
2341             (const char*)pr.getName().getCString()));
2342
2343         {
2344             AutoPThreadSecurity threadLevelSecurity(request->operationContext);
2345
2346             StatProviderTimeMeasurement providerTime(response);
2347
2348             // Call deactivateFilter() for each subclass name those were
2349             // activated previously using activateFilter().
2350             // Note: Start from Index 1, first name is actual class name in
2351             // the FROM clause of filter query.
2352             for (Uint32 i = 1, n = eSelx->classNames.size(); i < n ; ++i)
2353             {
2354                 CMPI_ObjectPathOnStack eRef(eSelx->classNamesSCMO[i]);
2355                 if (pr.getIndMI()->ft->ftVersion >= 100)
2356                 {
2357                     rc = pr.getIndMI()->ft->deActivateFilter(
2358                         pr.getIndMI(),
2359                         &eCtx,
2360                         eSelx,
2361                         CHARS(className),
2362                         &eRef,
2363                         i == n - 1);
2364                 }
2365                 else
2366                 {
2367                     // Older version of (pre 1.00) also pass in a CMPIResult
2368
2369                     rc = ((CMPIStatus (*)(
2370                         CMPIIndicationMI*,
2371                         CMPIContext*,
2372                         CMPIResult*,
2373                         CMPISelectExp*,
2374                         const char *,
2375                         CMPIObjectPath*,
2376                         CMPIBoolean)) pr.getIndMI()->ft->deActivateFilter)(
2377                             pr.getIndMI(),
2378                             &eCtx,
2379                             NULL,
2380                             eSelx,
2381                             CHARS(className),
2382                             &eRef,
2383                             i == n - 1);
2384                 }
2385                 if (rc.rc != CMPI_RC_OK)
2386                 {
2387                     PEG_TRACE((
2388                         TRC_PROVIDERMANAGER,
2389                         Tracer::LEVEL2,
2390                         "deactivateFilter() for class %s in namespace %s"
2391                             "failed. Error : %s",
2392                         CHARS(eSelx->classNames[i].getClassName().
2393                             getString().getCString()),
2394                         CHARS(request->nameSpace.getString().getCString()),
2395                         rc.msg ? CMGetCharsPtr(rc.msg, NULL) : "Unknown"));
2396                 }
2397             }
2398         }
2399
2400         PEG_TRACE((
2401             TRC_PROVIDERMANAGER,
2402             Tracer::LEVEL2,
2403             "Returning from provider.deleteSubscriptionRequest: %s",
2404             (const char*)pr.getName().getCString()));
2405
2406         delete eSelx;
2407
2408 //      Need to save ContentLanguage value into operation context of response
2409 //      Do this before checking rc from provider to throw exception in case
2410 //      rc.msg is also localized.
2411         CMPIStatus tmprc={CMPI_RC_OK,NULL};
2412         CMPIData cldata =
2413             eCtx.ft->getEntry (&eCtx, CMPIContentLanguage, &tmprc);
2414         if (tmprc.rc == CMPI_RC_OK)
2415         {
2416             response->operationContext.set(
2417                 ContentLanguageListContainer(
2418                 ContentLanguageList(
2419                 LanguageParser::parseContentLanguageHeader(
2420                 CMGetCharsPtr(cldata.value.string, NULL)))));
2421         }
2422
2423         if (rc.rc!=CMPI_RC_OK)
2424         {
2425             throw CIMException((CIMStatusCode)rc.rc,
2426                 rc.msg ? CMGetCharsPtr(rc.msg, NULL) : String::EMPTY);
2427         }
2428         else
2429         {
2430             //
2431             //  Decrement count of current subscriptions for this provider
2432             //
2433             if (pr.decrementSubscriptionsAndTestIfZero ())
2434             {
2435                 Boolean callDisable = false;
2436                 {
2437                     WriteLock lock(rwSemProvTab);
2438                     if (!indProvRec->getSelectExpCount())
2439                     {
2440                         indProvTab.remove(pr.getName());
2441                         delete indProvRec;
2442                         callDisable = true;
2443                     }
2444                 }
2445
2446                 //
2447                 //  If there are no current subscriptions after the decrement,
2448                 //  the last subscription has been deleted
2449                 //  Call the provider's disableIndications method
2450                 //
2451                 if (_subscriptionInitComplete && callDisable)
2452                 {
2453                     _callDisableIndications(
2454                         ph,
2455                         (const char*)pidc.getRemoteInfo().getCString());
2456                 }
2457             }
2458         }
2459     }
2460     HandlerCatch(handler);
2461
2462     PEG_METHOD_EXIT();
2463
2464     return(response);
2465 }
2466
2467 Message * CMPIProviderManager::handleDisableModuleRequest(
2468     const Message * message)
2469 {
2470     PEG_METHOD_ENTER(
2471         TRC_PROVIDERMANAGER,
2472         "CMPIProviderManager::handleDisableModuleRequest()");
2473
2474     CIMDisableModuleRequestMessage * request =
2475         dynamic_cast<CIMDisableModuleRequestMessage *>(
2476         const_cast<Message *>(message));
2477
2478     PEGASUS_ASSERT(request != 0);
2479
2480     //Set to false when provider refused to unload due to pending operations.
2481     Boolean disableModuleOk = true;
2482
2483     // get provider module name
2484     Boolean disableProviderOnly = request->disableProviderOnly;
2485
2486     //
2487     // Unload providers
2488     //
2489     Array<CIMInstance> _pInstances = request->providers;
2490     Array <Boolean> _indicationProviders = request->indicationProviders;
2491     /* The CIMInstances on request->providers array is completly _different_
2492        than the request->providerModule CIMInstance. Hence  */
2493
2494     String physicalName=(request->providerModule.getProperty(
2495         request->
2496         providerModule.findProperty("Location")).getValue().toString());
2497
2498     String moduleName= request->providerModule.getProperty(
2499         request->providerModule.findProperty("Name")).getValue().toString();
2500
2501     for (Uint32 i = 0, n = _pInstances.size(); i < n; i++)
2502     {
2503         String providerName;
2504         _pInstances[i].getProperty(_pInstances [i].findProperty
2505             (PEGASUS_PROPERTYNAME_NAME)).getValue().get(providerName);
2506
2507         Uint32 pos = _pInstances[i].findProperty(PEGASUS_PROPERTYNAME_NAME);
2508
2509         if (!providerManager.isProviderActive(providerName, moduleName))
2510         {
2511             continue;
2512         }
2513
2514         Boolean unloadOk = providerManager.unloadProvider(
2515             physicalName,
2516             _pInstances[i].getProperty(
2517                 _pInstances[i].findProperty(PEGASUS_PROPERTYNAME_NAME)
2518                 ).getValue ().toString (),
2519             moduleName);
2520
2521         if (!unloadOk)
2522         {
2523             disableModuleOk = false;
2524             continue;
2525         }
2526         //
2527         //  Reset the indication provider's count of current
2528         //  subscriptions since it has been disabled
2529         //
2530         if (_indicationProviders [i])
2531         {
2532             if (physicalName.size () > 0)
2533             {
2534                 try
2535                 {
2536                     OpProviderHolder ph =
2537                         providerManager.getProvider(
2538                             physicalName,
2539                             providerName,
2540                             moduleName);
2541                     ph.GetProvider ().resetSubscriptions ();
2542
2543                     // Remove from IndProvRecord table
2544                     IndProvRecord *rec = 0;
2545                     WriteLock lock(rwSemProvTab);
2546                     indProvTab.lookup(ph.GetProvider().getName(), rec);
2547                     delete rec;
2548                     indProvTab.remove(ph.GetProvider().getName());
2549                 }
2550                 catch (const Exception &e)
2551                 {
2552                     PEG_TRACE((TRC_PROVIDERMANAGER, Tracer::LEVEL1,
2553                         "Exception during reset subscriptions on indication "
2554                         "provider %s: %s",
2555                         (const char*)providerName.getCString(),
2556                         (const char*)e.getMessage().getCString()));
2557                 }
2558             }
2559         }
2560     }
2561
2562     CIMDisableModuleResponseMessage* response =
2563         dynamic_cast<CIMDisableModuleResponseMessage*>(
2564             request->buildResponse());
2565     PEGASUS_ASSERT(response != 0);
2566
2567     if (disableModuleOk)
2568     {
2569         response->operationalStatus.append(
2570             CIM_MSE_OPSTATUS_VALUE_STOPPED);
2571     }
2572     else
2573     {
2574         response->operationalStatus.append(
2575             CIM_MSE_OPSTATUS_VALUE_OK);
2576     }
2577
2578     PEG_METHOD_EXIT();
2579
2580     return(response);
2581 }
2582
2583 Message * CMPIProviderManager::handleEnableModuleRequest(
2584     const Message * message)
2585 {
2586     PEG_METHOD_ENTER(
2587         TRC_PROVIDERMANAGER,
2588         "CMPIProviderManager::handleEnableModuleRequest()");
2589
2590     CIMEnableModuleRequestMessage * request =
2591         dynamic_cast<CIMEnableModuleRequestMessage *>(
2592         const_cast<Message *>(message));
2593
2594     PEGASUS_ASSERT(request != 0);
2595
2596     Array<Uint16> operationalStatus;
2597     operationalStatus.append(CIM_MSE_OPSTATUS_VALUE_OK);
2598
2599     CIMEnableModuleResponseMessage* response =
2600         dynamic_cast<CIMEnableModuleResponseMessage*>(
2601             request->buildResponse());
2602     PEGASUS_ASSERT(response != 0);
2603     response->operationalStatus = operationalStatus;
2604
2605     PEG_METHOD_EXIT();
2606
2607     return(response);
2608 }
2609
2610 Message * CMPIProviderManager::handleStopAllProvidersRequest(
2611     const Message * message)
2612 {
2613     PEG_METHOD_ENTER(
2614         TRC_PROVIDERMANAGER,
2615         "CMPIProviderManager::handleStopAllProvidersRequest()");
2616
2617     CIMStopAllProvidersRequestMessage * request =
2618         dynamic_cast<CIMStopAllProvidersRequestMessage *>(
2619         const_cast<Message *>(message));
2620
2621     PEGASUS_ASSERT(request != 0);
2622
2623     CIMStopAllProvidersResponseMessage* response =
2624         dynamic_cast<CIMStopAllProvidersResponseMessage*>(
2625             request->buildResponse());
2626     PEGASUS_ASSERT(response != 0);
2627
2628     // tell the provider manager to shutdown all the providers
2629     providerManager.shutdownAllProviders();
2630
2631     PEG_METHOD_EXIT();
2632
2633     return(response);
2634 }
2635
2636 Message* CMPIProviderManager::handleIndicationServiceDisabledRequest(
2637     Message* message)
2638 {
2639     PEG_METHOD_ENTER(TRC_PROVIDERMANAGER,
2640         "CMPIProviderManager::_handleIndicationServiceDisabledRequest");
2641
2642     CIMIndicationServiceDisabledRequestMessage* request =
2643         dynamic_cast<CIMIndicationServiceDisabledRequestMessage*>(message);
2644     PEGASUS_ASSERT(request != 0);
2645
2646     CIMIndicationServiceDisabledResponseMessage* response =
2647         dynamic_cast<CIMIndicationServiceDisabledResponseMessage*>(
2648             request->buildResponse());
2649     PEGASUS_ASSERT(response != 0);
2650
2651     _subscriptionInitComplete = false;
2652
2653     PEG_METHOD_EXIT ();
2654     return response;
2655 }
2656
2657 Message * CMPIProviderManager::handleSubscriptionInitCompleteRequest(
2658     const Message * message)
2659 {
2660     PEG_METHOD_ENTER(
2661         TRC_PROVIDERMANAGER,
2662         "CMPIProviderManager::handleSubscriptionInitCompleteRequest()");
2663
2664     CIMSubscriptionInitCompleteRequestMessage * request =
2665         dynamic_cast <CIMSubscriptionInitCompleteRequestMessage *>
2666         (const_cast <Message *> (message));
2667
2668     PEGASUS_ASSERT (request != 0);
2669
2670     CIMSubscriptionInitCompleteResponseMessage * response =
2671         dynamic_cast <CIMSubscriptionInitCompleteResponseMessage *>
2672         (request->buildResponse ());
2673
2674     PEGASUS_ASSERT (response != 0);
2675
2676     //
2677     //  Set indicator
2678     //
2679     _subscriptionInitComplete = true;
2680
2681     //
2682     //  For each provider that has at least one subscription, call
2683     //  provider's enableIndications method
2684     //
2685     Array <CMPIProvider *> enableProviders;
2686     enableProviders = providerManager.getIndicationProvidersToEnable ();
2687
2688     Uint32 numProviders = enableProviders.size ();
2689     for (Uint32 i = 0; i < numProviders; i++)
2690     {
2691         try
2692         {
2693             CIMInstance provider;
2694             provider = enableProviders [i]->getProviderInstance ();
2695
2696             CString info;
2697 #ifdef PEGASUS_ENABLE_REMOTE_CMPI
2698             IndProvRecord *provRec = 0;
2699             if (indProvTab.lookup (enableProviders [i]->getName(), provRec))
2700             {
2701                 if (provRec->getRemoteInfo() != String::EMPTY)
2702                 {
2703                     info = provRec->getRemoteInfo().getCString();
2704                 }
2705             }
2706 #endif
2707             //
2708             //  Get cached or load new provider module
2709             //
2710             OpProviderHolder ph;
2711             if ((const char*)info)
2712             {
2713                 ph = providerManager.getRemoteProvider
2714                     (enableProviders [i]->getModule ()->getFileName (),
2715                     enableProviders [i]->getName (),
2716                     enableProviders[i]->getModuleName());
2717             }
2718             else
2719             {
2720                 ph = providerManager.getProvider
2721                     (enableProviders [i]->getModule ()->getFileName (),
2722                     enableProviders [i]->getName (),
2723                     enableProviders[i]->getModuleName());
2724             }
2725             _callEnableIndications(
2726                 provider,
2727                 _indicationCallback,
2728                 ph,
2729                 (const char*)info);
2730         }
2731         catch (const CIMException & e)
2732         {
2733             PEG_TRACE((TRC_PROVIDERMANAGER,Tracer::LEVEL1,
2734                 "CIMException: %s",(const char*)e.getMessage().getCString()));
2735         }
2736         catch (const Exception & e)
2737         {
2738             PEG_TRACE((TRC_PROVIDERMANAGER,Tracer::LEVEL1,
2739                 "Exception: %s",(const char*)e.getMessage().getCString()));
2740         }
2741         catch (...)
2742         {
2743             PEG_TRACE_CSTRING(
2744                 TRC_PROVIDERMANAGER,
2745                 Tracer::LEVEL1,
2746                 "Unknown error in handleSubscriptionInitCompleteRequest");
2747         }
2748     }
2749
2750     PEG_METHOD_EXIT ();
2751     return(response);
2752 }
2753
2754 Message * CMPIProviderManager::handleGetPropertyRequest(
2755     const Message * message)
2756 {
2757     PEG_METHOD_ENTER(
2758         TRC_PROVIDERMANAGER,
2759         "CMPIProviderManager::handleGetPropertyRequest()");
2760
2761     HandlerIntro(GetProperty,message,request,response,handler);
2762
2763     // We're only going to be interested in the specific property from this
2764     // instance.
2765     Array<CIMName> localPropertyListArray;
2766     localPropertyListArray.append(request->propertyName);
2767     CIMPropertyList localPropertyList(localPropertyListArray);
2768
2769     // NOTE: GetProperty will use the CIMInstanceProvider interface, so we
2770     // must manually define a request, response, and handler (emulate
2771     // HandlerIntro macro)
2772     CIMGetInstanceRequestMessage * GI_request =
2773         new CIMGetInstanceRequestMessage(
2774         request->messageId,
2775         request->nameSpace,
2776         request->instanceName,
2777         false,
2778         false,
2779         localPropertyList,
2780         request->queueIds,
2781         request->authType,
2782         request->userName
2783         );
2784
2785     PEGASUS_ASSERT(GI_request != 0);
2786
2787     CIMGetInstanceResponseMessage * GI_response =
2788         dynamic_cast<CIMGetInstanceResponseMessage*>
2789         (GI_request->buildResponse());
2790
2791     PEGASUS_ASSERT(GI_response != 0);
2792
2793     GetInstanceResponseHandler GI_handler(
2794         GI_request,
2795         GI_response,
2796         _responseChunkCallback);
2797
2798     try
2799     {
2800         PEG_TRACE((TRC_PROVIDERMANAGER,Tracer::LEVEL3,
2801             "CMPIProviderManager::handleGetPropertyRequest"
2802             " - Host name: %s  Name space: %s  "
2803                 "Class name: %s  Property name: %s",
2804             (const char*) System::getHostName().getCString(),
2805             (const char*) request->nameSpace.getString().getCString(),
2806             (const char*)
2807                 request->instanceName.getClassName().getString().getCString(),
2808             (const char*) request->propertyName.getString().getCString()));
2809
2810         Boolean remote=false;
2811         OpProviderHolder ph;
2812         CString remoteInfo;
2813
2814         CMPIProvider & pr = _resolveAndGetProvider(
2815             &(request->operationContext),
2816             &ph,
2817             &remoteInfo,
2818             remote);
2819
2820         AutoPtr<NormalizerContext> tmpNormalizerContext(
2821             new CIMOMHandleContext(*pr.getCIMOMHandle()));
2822         request->operationContext.insert(
2823             NormalizerContextContainer(tmpNormalizerContext));
2824
2825         CMPIStatus rc={CMPI_RC_OK,NULL};
2826         CMPI_ContextOnStack eCtx(request->operationContext);
2827         CMPI_ResultOnStack eRes(GI_handler,pr.getBroker());
2828         CMPI_ThreadContext thr(pr.getBroker(),&eCtx);
2829
2830         // For the getInstance provider call, use the property list that we
2831         // created containing the single property from the getProperty call.
2832         CMPIPropertyList props(localPropertyList);
2833
2834         CString nameSpace = request->nameSpace.getString().getCString();
2835         CString className =
2836             request->instanceName.getClassName().getString().getCString();
2837
2838         // Leave includeQualifiers and includeClassOrigin as false for this
2839         // call to getInstance
2840         _setupCMPIContexts(
2841             &eCtx,
2842             &(request->operationContext),
2843             &nameSpace,
2844             &remoteInfo,
2845             remote,
2846             false,
2847             false,
2848             true);
2849
2850         SCMOInstance * objectPath = getSCMOObjectPathFromRequest(
2851             nameSpace, className, request->instanceName);
2852         CMPI_ObjectPathOnStack eRef(objectPath);
2853
2854         CMPIProvider::pm_service_op_lock op_lock(&pr);
2855
2856         PEG_TRACE((
2857             TRC_PROVIDERMANAGER,
2858             Tracer::LEVEL2,
2859             "Calling provider.getInstance via getProperty: %s",
2860             (const char*)pr.getName().getCString()));
2861
2862         {
2863             AutoPThreadSecurity threadLevelSecurity(request->operationContext);
2864
2865             StatProviderTimeMeasurement providerTime(response);
2866
2867             rc = pr.getInstMI()->ft->getInstance(
2868                 pr.getInstMI(),
2869                 &eCtx,
2870                 &eRes,
2871                 &eRef,
2872                 (const char **)props.getList());
2873         }
2874
2875         PEG_TRACE((
2876             TRC_PROVIDERMANAGER,
2877             Tracer::LEVEL2,
2878             "Returning from provider.getInstance via getProperty: %s",
2879             (const char*)pr.getName().getCString()));
2880
2881 //      Need to save ContentLanguage value into operation context of response
2882 //      Do this before checking rc from provider to throw exception in case
2883 //      rc.msg is also localized.
2884         CMPIStatus tmprc={CMPI_RC_OK,NULL};
2885         CMPIData cldata =
2886             eCtx.ft->getEntry (&eCtx, CMPIContentLanguage, &tmprc);
2887         if (tmprc.rc == CMPI_RC_OK)
2888         {
2889             response->operationContext.set(
2890                 ContentLanguageListContainer(
2891                 ContentLanguageList(
2892                 LanguageParser::parseContentLanguageHeader(
2893                 CMGetCharsPtr(cldata.value.string, NULL)))));
2894             handler.setContext(response->operationContext);
2895         }
2896         _throwCIMException(rc, eRes.resError);
2897
2898         // Copy property value from instance to getProperty response
2899         Array<SCMOInstance>& arInstance =
2900             GI_response->getResponseData().getSCMO();
2901         if (arInstance.size() > 0)
2902         {
2903             SCMOInstance& instance = arInstance[0];
2904             if(!(instance.isUninitialized()))
2905             {
2906                 CString pName =
2907                     request->propertyName.getString().getCString();
2908
2909                 // Construct a temporary CMPI Instance object, on which we
2910                 // can use the encapsulation functions to retrieve the property.
2911                 CMPI_InstanceOnStack tmpInst(instance);
2912
2913                 CMPIStatus trc;
2914                 CMPIData data =
2915                     CMGetProperty(&tmpInst, (const char*)pName, &trc);
2916
2917                 if (trc.rc == CMPI_RC_OK)
2918                 {
2919                     // Convert the CMPIData to a CIMValue
2920                     CIMValue val =
2921                         value2CIMValue(&(data.value), data.type, &(trc.rc));
2922
2923                     response->value = val;
2924                 }
2925                 // Else property not found. Return CIM_ERR_NO_SUCH_PROPERTY.
2926                 else
2927                 {
2928                     throw PEGASUS_CIM_EXCEPTION(
2929                         CIM_ERR_NO_SUCH_PROPERTY,
2930                         request->propertyName.getString());
2931                 }
2932             }
2933         }
2934     }
2935     HandlerCatch(handler);
2936
2937     delete GI_request;
2938     delete GI_response;
2939
2940     PEG_METHOD_EXIT();
2941
2942     return(response);
2943 }
2944
2945 Message * CMPIProviderManager::handleSetPropertyRequest(
2946     const Message * message)
2947 {
2948     PEG_METHOD_ENTER(
2949         TRC_PROVIDERMANAGER,
2950         "CMPIProviderManager::handleSetPropertyRequest()");
2951
2952     HandlerIntro(SetProperty,message,request,response,handler);
2953
2954     // We're only going to be interested in the specific property from this
2955     // instance.
2956     Array<CIMName> localPropertyListArray;
2957     localPropertyListArray.append(request->propertyName);
2958     CIMPropertyList localPropertyList(localPropertyListArray);
2959
2960     // Build a modified instance with just the specific property and its
2961     // new value.
2962     CIMInstance localModifiedInstance(request->instanceName.getClassName());
2963     localModifiedInstance.setPath(request->instanceName);
2964     localModifiedInstance.addProperty(
2965         CIMProperty(request->propertyName, request->newValue));
2966
2967     // NOTE: SetProperty will use the CIMInstanceProvider interface, so we must
2968     // manually define a request, response, and handler.
2969     CIMModifyInstanceRequestMessage * MI_request =
2970         new CIMModifyInstanceRequestMessage(
2971         request->messageId,
2972         request->nameSpace,
2973         localModifiedInstance,
2974         false,
2975         localPropertyList,
2976         request->queueIds,
2977         request->authType,
2978         request->userName
2979         );
2980
2981     PEGASUS_ASSERT(MI_request != 0);
2982
2983     CIMModifyInstanceResponseMessage * MI_response =
2984         dynamic_cast<CIMModifyInstanceResponseMessage*>(
2985         MI_request->buildResponse());
2986
2987     PEGASUS_ASSERT(MI_response != 0);
2988
2989     ModifyInstanceResponseHandler MI_handler(
2990         MI_request,
2991         MI_response,
2992         _responseChunkCallback);
2993
2994     try
2995     {
2996         CString nameSpace = request->nameSpace.getString().getCString();
2997         CString className =
2998             request->instanceName.getClassName().getString().getCString();
2999
3000         PEG_TRACE((TRC_PROVIDERMANAGER,Tracer::LEVEL3,
3001             "CMPIProviderManager::handleSetPropertyRequest"
3002             " - Host name: %s  Name space: %s  "
3003                 "Class name: %s  Property name: %s",
3004             (const char*) System::getHostName().getCString(),
3005             (const char*) nameSpace,
3006             (const char*) className,
3007             (const char*) request->propertyName.getString().getCString()));
3008
3009         Boolean remote=false;
3010         OpProviderHolder ph;
3011         CString remoteInfo;
3012
3013         CMPIProvider & pr = _resolveAndGetProvider(
3014             &(request->operationContext),
3015             &ph,
3016             &remoteInfo,
3017             remote);
3018
3019         CMPIStatus rc={CMPI_RC_OK,NULL};
3020         CMPI_ContextOnStack eCtx(request->operationContext);
3021         CMPI_ResultOnStack eRes(MI_handler,pr.getBroker());
3022         CMPI_ThreadContext thr(pr.getBroker(),&eCtx);
3023
3024         CMPIPropertyList props(localPropertyList);
3025
3026         // Leave includeQualifiers as false for this call to modifyInstance
3027         _setupCMPIContexts(
3028             &eCtx,
3029             &(request->operationContext),
3030             &nameSpace,
3031             &remoteInfo,
3032             remote,
3033             false,
3034             false,
3035             true);
3036
3037
3038         SCMOInstance * modInst = getSCMOInstanceFromRequest(
3039             nameSpace, className, localModifiedInstance);
3040         modInst->setPropertyFilter((const char **)props.getList());
3041         CMPI_InstanceOnStack eInst(modInst);
3042
3043         // This will create a second reference for the same SCMOInstance
3044         CMPI_ObjectPathOnStack eRef(*modInst);
3045
3046         CMPIProvider::pm_service_op_lock op_lock(&pr);
3047
3048         PEG_TRACE((
3049             TRC_PROVIDERMANAGER,
3050             Tracer::LEVEL2,
3051             "Calling provider.modifyInstance via setProperty: %s",
3052             (const char*)pr.getName().getCString()));
3053
3054         {
3055             AutoPThreadSecurity threadLevelSecurity(request->operationContext);
3056
3057             StatProviderTimeMeasurement providerTime(response);
3058
3059             rc = pr.getInstMI()->ft->modifyInstance(
3060                 pr.getInstMI(),
3061                 &eCtx,
3062                 &eRes,
3063                 &eRef,
3064                 &eInst,
3065                 (const char **)props.getList());
3066         }
3067
3068         PEG_TRACE((
3069             TRC_PROVIDERMANAGER,
3070             Tracer::LEVEL2,
3071             "Returning from provider.modifyInstance via setProperty: %s",
3072             (const char*)pr.getName().getCString()));
3073
3074 //      Need to save ContentLanguage value into operation context of response
3075 //      Do this before checking rc from provider to throw exception in case
3076 //      rc.msg is also localized.
3077         CMPIStatus tmprc={CMPI_RC_OK,NULL};
3078         CMPIData cldata =
3079             eCtx.ft->getEntry (&eCtx, CMPIContentLanguage, &tmprc);
3080         if (tmprc.rc == CMPI_RC_OK)
3081         {
3082             response->operationContext.set(
3083                 ContentLanguageListContainer(
3084                 ContentLanguageList(
3085                 LanguageParser::parseContentLanguageHeader(
3086                 CMGetCharsPtr(cldata.value.string, NULL)))));
3087             handler.setContext(response->operationContext);
3088         }
3089         _throwCIMException(rc, eRes.resError);
3090     }
3091     HandlerCatch(handler);
3092
3093     delete MI_request;
3094     delete MI_response;
3095
3096     PEG_METHOD_EXIT();
3097
3098     return(response);
3099 }
3100
3101 Message * CMPIProviderManager::handleUnsupportedRequest(
3102     const Message * message)
3103 {
3104     PEG_METHOD_ENTER(
3105         TRC_PROVIDERMANAGER,
3106         "CMPIProviderManager::handleUnsupportedRequest()");
3107     CIMRequestMessage* request =
3108         dynamic_cast<CIMRequestMessage *>(const_cast<Message *>(message));
3109     PEGASUS_ASSERT(request != 0 );
3110
3111     CIMResponseMessage* response = request->buildResponse();
3112     response->cimException =
3113         PEGASUS_CIM_EXCEPTION(CIM_ERR_NOT_SUPPORTED, String::EMPTY);
3114
3115     PEG_METHOD_EXIT();
3116     return response;
3117 }
3118
3119 ProviderName CMPIProviderManager::_resolveProviderName(
3120     const ProviderIdContainer & providerId)
3121 {
3122     String providerName;
3123     String fileName;
3124     String location;
3125     String moduleName;
3126     CIMValue genericValue;
3127
3128     PEG_METHOD_ENTER(
3129         TRC_PROVIDERMANAGER,
3130         "CMPIProviderManager::_resolveProviderName()");
3131
3132     genericValue = providerId.getModule().getProperty(
3133         providerId.getModule().findProperty(
3134             PEGASUS_PROPERTYNAME_NAME)).getValue();
3135     genericValue.get(moduleName);
3136
3137     genericValue = providerId.getProvider().getProperty(
3138         providerId.getProvider().findProperty(
3139             PEGASUS_PROPERTYNAME_NAME)).getValue();
3140     genericValue.get(providerName);
3141
3142     genericValue = providerId.getModule().getProperty(
3143         providerId.getModule().findProperty("Location")).getValue();
3144     genericValue.get(location);
3145     fileName = _resolvePhysicalName(location);
3146
3147     // An empty file name is only for interest if we are in the
3148     // local name space. So the message is only issued if not
3149     // in the remote Name Space.
3150     if (fileName == String::EMPTY && (!providerId.isRemoteNameSpace()))
3151     {
3152         genericValue.get(location);
3153         String fullName = FileSystem::buildLibraryFileName(location);
3154         Logger::put_l(Logger::ERROR_LOG, System::CIMSERVER, Logger::SEVERE,
3155             MessageLoaderParms(
3156                 "ProviderManager.CMPI.CMPIProviderManager.CANNOT_FIND_LIBRARY",
3157                 "For provider $0 library $1 was not found.",
3158                 providerName, fullName));
3159
3160     }
3161     ProviderName name(moduleName, providerName, fileName);
3162     name.setLocation(location);
3163     PEG_METHOD_EXIT();
3164     return name;
3165 }
3166
3167 void CMPIProviderManager::_callEnableIndications
3168     (CIMInstance & req_provider,
3169     PEGASUS_INDICATION_CALLBACK_T _indicationCallback,
3170     OpProviderHolder & ph,
3171     const char* remoteInfo)
3172 {
3173     PEG_METHOD_ENTER(
3174         TRC_PROVIDERMANAGER,
3175         "CMPIProviderManager::_callEnableIndications()");
3176
3177     try
3178     {
3179         IndProvRecord *indProvRec =0;
3180         {
3181             WriteLock lock(rwSemProvTab);
3182
3183             if (indProvTab.lookup (ph.GetProvider ().getName (),indProvRec))
3184             {
3185                 CIMRequestMessage * request = 0;
3186                 CIMResponseMessage * response = 0;
3187                 indProvRec->setHandler(new EnableIndicationsResponseHandler(
3188                     request,
3189                     response,
3190                     req_provider,
3191                     _indicationCallback,
3192                     _responseChunkCallback));
3193             }
3194         }
3195
3196         CMPIProvider & pr=ph.GetProvider();
3197
3198         //
3199         //  Versions prior to 86 did not include enableIndications routine
3200         //
3201         if (pr.getIndMI()->ft->ftVersion >= 86)
3202         {
3203             OperationContext context;
3204 #ifdef PEGASUS_ZOS_THREADLEVEL_SECURITY
3205             // For the z/OS security model we always need an Identity container
3206             // in the operation context. Since we don't have a client request
3207             // ID here we have to use the cim servers identity for the time
3208             // being.
3209             IdentityContainer idContainer(System::getEffectiveUserName());
3210             context.insert(idContainer);
3211 #endif
3212
3213             CMPIStatus rc={CMPI_RC_OK,NULL};
3214             CMPI_ContextOnStack eCtx(context);
3215             CMPI_ThreadContext thr(pr.getBroker(),&eCtx);
3216
3217             // Add RemoteInformation -V 5245
3218             if (remoteInfo)
3219             {
3220                 eCtx.ft->addEntry(&eCtx,"CMPIRRemoteInfo",
3221                     (CMPIValue*)(const char*)remoteInfo,CMPI_chars);
3222             }
3223
3224             PEG_TRACE((
3225                 TRC_PROVIDERMANAGER,
3226                 Tracer::LEVEL2,
3227                 "Calling provider.enableIndications: %s",
3228                 (const char*)pr.getName().getCString()));
3229
3230             pr.protect();
3231
3232             // enableIndications() is defined by the CMPI standard as
3233             // returning a CMPIStatus return value. Unfortunately, Pegasus
3234             // originally implemented enableIndications() with a void
3235             // return type, and this incompatibility was not detected for
3236             // some time. Since exceptions thrown from enableIndications()
3237             // are not reported (other than via logging), it was decided to
3238             // discard the returned CMPIStatus here. This will prevent us from
3239             // breaking existing CMPI Indication providers. This is ok since
3240             // there really isn't a user to which the problem should be
3241             // reported.
3242             pr.getIndMI()->ft->enableIndications(pr.getIndMI(),&eCtx);
3243
3244             PEG_TRACE((
3245                 TRC_PROVIDERMANAGER,
3246                 Tracer::LEVEL2,
3247                 "Returning from provider.enableIndications: %s",
3248                 (const char*)pr.getName().getCString()));
3249
3250         }
3251         else
3252         {
3253             PEG_TRACE((
3254                 TRC_PROVIDERMANAGER,
3255                 Tracer::LEVEL2,
3256                 "Not calling provider.enableIndications: %s routine as it is "
3257                 "an earlier version that does not support this function",
3258                  (const char*)pr.getName().getCString()));
3259         }
3260     }
3261     catch (const Exception & e)
3262     {
3263         Logger::put_l(Logger::ERROR_LOG, System::CIMSERVER, Logger::WARNING,
3264             MessageLoaderParms(
3265                 "ProviderManager.CMPI.CMPIProviderManager."
3266                     "ENABLE_INDICATIONS_FAILED",
3267                 "Failed to enable indications for provider $0: $1.",
3268                 ph.GetProvider().getName(), e.getMessage()));
3269     }
3270     catch (...)
3271     {
3272         Logger::put_l(Logger::ERROR_LOG, System::CIMSERVER, Logger::WARNING,
3273             MessageLoaderParms(
3274                 "ProviderManager.CMPI.CMPIProviderManager."
3275                     "ENABLE_INDICATIONS_FAILED_UNKNOWN",
3276                 "Failed to enable indications for provider $0.",
3277                 ph.GetProvider().getName()));
3278     }
3279
3280     PEG_METHOD_EXIT ();
3281 }
3282
3283 void CMPIProviderManager::_callDisableIndications
3284     (OpProviderHolder & ph, const char *remoteInfo)
3285 {
3286     PEG_METHOD_ENTER(
3287         TRC_PROVIDERMANAGER,
3288         "CMPIProviderManager::_callDisableIndications()");
3289
3290     try
3291     {
3292         CMPIProvider & pr=ph.GetProvider();
3293
3294         //
3295         //  Versions prior to 86 did not include disableIndications routine
3296         //
3297         if (pr.getIndMI()->ft->ftVersion >= 86)
3298         {
3299             OperationContext context;
3300             CMPIStatus rc={CMPI_RC_OK,NULL};
3301             CMPI_ContextOnStack eCtx(context);
3302
3303             if (remoteInfo)
3304             {
3305                 eCtx.ft->addEntry(&eCtx,"CMPIRRemoteInfo",
3306                     (CMPIValue*)(const char*)remoteInfo,CMPI_chars);
3307             }
3308             CMPI_ThreadContext thr(pr.getBroker(),&eCtx);
3309
3310             PEG_TRACE((TRC_PROVIDERMANAGER,Tracer::LEVEL2,
3311                 "Calling provider.disableIndications: %s",
3312                 (const char*)pr.getName().getCString()));
3313
3314             // disableIndications() is defined by the CMPI standard as
3315             // returning a CMPIStatus return value. Unfortunately, Pegasus
3316             // originally implemented disableIndications() with a void
3317             // return type, and this incompatibility was not detected for
3318             // some time. For consistency with the enableIndications()
3319             // interface, it was decided to discard the returned CMPIStatus
3320             // here. This will prevent us from breaking existing CMPI
3321             // Indication providers. This is ok since there really isn't a
3322             // user to which the problem should be reported.
3323             pr.getIndMI()->ft->disableIndications(
3324                 pr.getIndMI(),
3325                 &eCtx);
3326
3327             pr.unprotect();
3328
3329             PEG_TRACE((TRC_PROVIDERMANAGER,Tracer::LEVEL2,
3330                 "Returning from provider.disableIndications: %s",
3331                 (const char*)pr.getName().getCString()));
3332
3333         }
3334         else
3335         {
3336             PEG_TRACE((TRC_PROVIDERMANAGER,Tracer::LEVEL2,
3337                 "Not calling provider.disableIndications: %s routine as it is "
3338                 "an earlier version that does not support this function",
3339                 (const char*)pr.getName().getCString()));
3340         }
3341     }
3342     catch (const Exception & e)
3343     {
3344         Logger::put_l(Logger::ERROR_LOG, System::CIMSERVER, Logger::WARNING,
3345             MessageLoaderParms(
3346                 "ProviderManager.CMPI.CMPIProviderManager."
3347                     "DISABLE_INDICATIONS_FAILED",
3348                 "Failed to disable indications for provider $0: $1.",
3349                 ph.GetProvider().getName(), e.getMessage()));
3350     }
3351     catch (...)
3352     {
3353         Logger::put_l(Logger::ERROR_LOG, System::CIMSERVER, Logger::WARNING,
3354             MessageLoaderParms(
3355                 "ProviderManager.CMPI.CMPIProviderManager."
3356                     "DISABLE_INDICATIONS_FAILED_UNKNOWN",
3357                 "Failed to disable indications for provider $0.",
3358                 ph.GetProvider().getName()));
3359     }
3360
3361     PEG_METHOD_EXIT ();
3362 }
3363
3364 PEGASUS_NAMESPACE_END
3365