1 martin 1.50 //%LICENSE////////////////////////////////////////////////////////////////
|
2 martin 1.51 //
|
3 martin 1.50 // 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 martin 1.51 //
|
10 martin 1.50 // 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 martin 1.51 //
|
17 martin 1.50 // The above copyright notice and this permission notice shall be included
18 // in all copies or substantial portions of the Software.
|
19 martin 1.51 //
|
20 martin 1.50 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
21 martin 1.51 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
22 martin 1.50 // 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 martin 1.51 //
|
28 martin 1.50 //////////////////////////////////////////////////////////////////////////
|
29 schuur 1.1 //
30 //%/////////////////////////////////////////////////////////////////////////////
|
31 venkat.puvvada 1.39
|
32 schuur 1.6 #include "CMPI_Version.h"
|
33 schuur 1.3
|
34 schuur 1.1 #include "CMPI_Broker.h"
35 #include "CMPI_Object.h"
36 #include "CMPI_ContextArgs.h"
37 #include "CMPI_Enumeration.h"
38 #include "CMPI_Value.h"
39 #include "CMPIProviderManager.h"
|
40 schuur 1.9 #include "CMPI_String.h"
|
41 marek 1.43 #include <Pegasus/ProviderManager2/CMPI/CMPIClassCache.h>
|
42 marek 1.53.2.6 #include <Pegasus/ProviderManager2/CMPI/CMPI_ThreadContext.h>
|
43 schuur 1.1
44 #include <Pegasus/Common/CIMName.h>
45 #include <Pegasus/Common/CIMPropertyList.h>
46 #include <Pegasus/Provider/CIMOMHandle.h>
47 #include <Pegasus/Common/CIMValue.h>
48 #include <Pegasus/Common/CIMType.h>
|
49 r.kieninger 1.53.2.2 #include "CMPISCMOUtilities.h"
|
50 schuur 1.1
51
52 PEGASUS_USING_STD;
53 PEGASUS_NAMESPACE_BEGIN
54
|
55 venkat.puvvada 1.36 static const CMPIUint32 MB_CAPABILITIES =
|
56 venkat.puvvada 1.39 # ifdef CMPI_VER_200
57 CMPI_MB_Supports_Extended_Error |
58 # endif
|
59 venkat.puvvada 1.36 CMPI_MB_BasicRead | CMPI_MB_BasicWrite | CMPI_MB_InstanceManipulation |
60 CMPI_MB_AssociationTraversal | CMPI_MB_QueryNormalization |
61 CMPI_MB_Indications | CMPI_MB_BasicQualifierSupport |
62 CMPI_MB_OSEncapsulationSupport
|
63 venkat.puvvada 1.39 # ifndef PEGASUS_DISABLE_EXECQUERY
|
64 venkat.puvvada 1.36 | CMPI_MB_QueryExecution
65 # endif
66 ;
67
|
68 marek 1.45 #define HandlerCatchSetStatus(rc, returnvalue) \
69 catch (const CIMException &e) \
70 { \
|
71 thilo.boehm 1.48 PEG_TRACE(( \
|
72 marek 1.45 TRC_CMPIPROVIDERINTERFACE, \
|
73 thilo.boehm 1.48 Tracer::LEVEL1, \
74 "CIMException: %s",(const char*)e.getMessage().getCString())); \
|
75 marek 1.45 CMSetStatusWithString( \
76 rc, \
77 (CMPIrc)e.getCode(), \
78 (CMPIString*)string2CMPIString(e.getMessage())); \
79 PEG_METHOD_EXIT(); \
80 return returnvalue; \
81 } \
82 catch (const Exception &e) \
83 { \
84 PEG_TRACE(( \
85 TRC_CMPIPROVIDERINTERFACE, \
86 Tracer::LEVEL2, \
87 "Exception: %s", (const char *)e.getMessage().getCString())); \
88 CMSetStatusWithString( \
89 rc, \
90 (CMPIrc)CMPI_RC_ERROR_SYSTEM, \
91 (CMPIString*)string2CMPIString(e.getMessage())); \
92 PEG_METHOD_EXIT(); \
93 return returnvalue; \
94 } \
95 catch (...) \
96 marek 1.45 { \
97 PEG_TRACE(( \
98 TRC_CMPIPROVIDERINTERFACE, \
99 Tracer::LEVEL2, \
100 "Unknown exception")); \
101 CMSetStatusWithString( \
102 rc, \
103 (CMPIrc)CMPI_RC_ERROR_SYSTEM, \
104 (CMPIString*)string2CMPIString("Unknown exception")); \
105 PEG_METHOD_EXIT(); \
106 return returnvalue; \
107 }
108
109 #define HandlerCatchReturnStatus() \
110 catch (const CIMException &e) \
111 { \
|
112 thilo.boehm 1.48 PEG_TRACE(( \
|
113 marek 1.45 TRC_CMPIPROVIDERINTERFACE, \
114 Tracer::LEVEL2, \
|
115 thilo.boehm 1.48 "CIMException: %s",(const char*)e.getMessage().getCString())); \
|
116 marek 1.45 PEG_METHOD_EXIT(); \
117 CMReturnWithString( \
118 (CMPIrc)e.getCode(), \
119 (CMPIString*)string2CMPIString(e.getMessage())); \
120 } \
121 catch (const Exception &e) \
122 { \
123 PEG_TRACE(( \
124 TRC_CMPIPROVIDERINTERFACE, \
125 Tracer::LEVEL2, \
126 "Exception: %s", (const char *)e.getMessage().getCString())); \
127 PEG_METHOD_EXIT(); \
128 CMReturnWithString( \
129 (CMPIrc)CMPI_RC_ERROR_SYSTEM, \
130 (CMPIString*)string2CMPIString(e.getMessage())); \
131 } \
132 catch (...) \
133 { \
134 PEG_TRACE(( \
135 TRC_CMPIPROVIDERINTERFACE, \
136 Tracer::LEVEL2, \
137 marek 1.45 "Unknown exception")); \
138 PEG_METHOD_EXIT(); \
139 CMReturnWithString( \
140 (CMPIrc)CMPI_RC_ERROR_SYSTEM, \
141 (CMPIString*)string2CMPIString("Unknown exception")); \
142 }
143
|
144 venkat.puvvada 1.39 static CIMPropertyList getList(const char** l)
145 {
146 CIMPropertyList pl;
147 if (l)
148 {
149 Array<CIMName> n;
150 while (*l)
151 {
152 n.append(*l++);
153 }
154 pl.set(n);
155 }
156 return pl;
|
157 schuur 1.1 }
158
|
159 r.kieninger 1.53.2.2 SCMOClass* mbGetSCMOClass(
160 const char* nameSpace,
|
161 marek 1.53.2.6 Uint32 nsL,
162 const char* cls,
163 Uint32 clsL)
|
164 r.kieninger 1.53.2.1 {
165 PEG_METHOD_ENTER(TRC_CMPIPROVIDERINTERFACE, "CMPI_Broker:mbGetSCMOClass()");
166
|
167 r.kieninger 1.53.2.8 const CMPIBroker * mb = CMPI_ThreadContext::getBroker();
168 CMPI_Broker *xBroker = (CMPI_Broker*)mb;
|
169 r.kieninger 1.53.2.2
170 const char* ns=nameSpace;
|
171 marek 1.53.2.6 if (0 == nsL)
|
172 r.kieninger 1.53.2.2 {
173 //If we don't have a namespace here, we use the initnamespace from
174 // the thread context, since we need one to be able to lookup the class
175 const CMPIContext* ctx = CMPI_ThreadContext::getContext();
176 if (0!=ctx)
177 {
178 CMPIStatus rc;
179 CMPIData nsCtxData = CMGetContextEntry(ctx, CMPIInitNameSpace,&rc);
180 if (rc.rc == CMPI_RC_OK)
181 {
182 ns = CMGetCharsPtr(nsCtxData.value.string, 0);
183 }
184 }
185
186 }
187
188
|
189 marek 1.53.2.6 SCMOClass* scmoCls =
190 xBroker->classCache.getSCMOClass(xBroker, ns, nsL, cls, clsL);
|
191 r.kieninger 1.53.2.2
|
192 r.kieninger 1.53.2.1 PEG_METHOD_EXIT();
193 return scmoCls;
194 }
195
|
196 venkat.puvvada 1.39 extern "C"
197 {
|
198 schuur 1.1
|
199 venkat.puvvada 1.39 static CMPIInstance* mbGetInstance(
200 const CMPIBroker *mb,
201 const CMPIContext *ctx,
202 const CMPIObjectPath *cop,
203 const char **properties,
204 CMPIStatus *rc)
205 {
|
206 ms.aruran 1.42 PEG_METHOD_ENTER(
207 TRC_CMPIPROVIDERINTERFACE,
208 "CMPI_Broker:mbGetInstance()");
209
|
210 venkat.puvvada 1.39 mb = CM_BROKER;
211 CMPIFlags flgs =
212 ctx->ft->getEntry(ctx,CMPIInvocationFlags,NULL).value.uint32;
213 const CIMPropertyList props = getList(properties);
|
214 r.kieninger 1.53.2.2
215 SCMOInstance* scmoObjPath = SCMO_ObjectPath(cop);
216 CIMObjectPath qop;
|
217 venkat.puvvada 1.39 try
218 {
|
219 r.kieninger 1.53.2.4 scmoObjPath->getCIMObjectPath(qop);
220
221 CIMResponseData resData = CM_CIMOM(mb)->getInstance(
|
222 marek 1.53 *CM_Context(ctx),
|
223 r.kieninger 1.53.2.2 scmoObjPath->getNameSpace(),
224 qop,
|
225 venkat.puvvada 1.39 CM_IncludeQualifiers(flgs),
226 CM_ClassOrigin(flgs),
227 props);
228
|
229 r.kieninger 1.53.2.4 SCMOInstance& scmoOrgInst = resData.getSCMO()[0];
230
231 SCMOInstance* scmoInst = new SCMOInstance(scmoOrgInst);
232
233 // Rebuild the objectPath
|
234 marek 1.53.2.6 if (0==scmoInst->getNameSpace())
|
235 r.kieninger 1.53.2.4 {
236 scmoInst->setNameSpace(scmoObjPath->getNameSpace());
237 }
238 if (0==scmoInst->getClassName())
239 {
240 scmoInst->setClassName(scmoObjPath->getClassName());
241 }
242 scmoInst->buildKeyBindingsFromProperties();
243
|
244 ms.aruran 1.42 CMPIInstance* cmpiInst = reinterpret_cast<CMPIInstance*>(
|
245 r.kieninger 1.53.2.4 new CMPI_Object(scmoInst,CMPI_Object::ObjectTypeInstance));
246
247 CMSetStatus(rc,CMPI_RC_OK);
|
248 ms.aruran 1.42 PEG_METHOD_EXIT();
249 return cmpiInst;
|
250 venkat.puvvada 1.39 }
|
251 marek 1.45 HandlerCatchSetStatus(rc, NULL);
252
|
253 venkat.puvvada 1.39 // Code flow should never get here.
254 }
255
256 static CMPIObjectPath* mbCreateInstance(
257 const CMPIBroker *mb,
258 const CMPIContext *ctx,
259 const CMPIObjectPath *cop,
260 const CMPIInstance *ci,
261 CMPIStatus *rc)
262 {
|
263 ms.aruran 1.42 PEG_METHOD_ENTER(
264 TRC_CMPIPROVIDERINTERFACE,
265 "CMPI_Broker:mbCreateInstance()");
266
|
267 venkat.puvvada 1.39 mb = CM_BROKER;
268
|
269 r.kieninger 1.53.2.2 SCMOInstance* scmoInst = SCMO_Instance(ci);
270 CIMInstance inst;
|
271 venkat.puvvada 1.39 try
272 {
|
273 r.kieninger 1.53.2.4 scmoInst->getCIMInstance(inst);
274
|
275 venkat.puvvada 1.39 CIMObjectPath ncop = CM_CIMOM(mb)->createInstance(
|
276 marek 1.53 *CM_Context(ctx),
|
277 r.kieninger 1.53.2.2 scmoInst->getNameSpace(),
278 inst);
279
280 SCMOInstance* newScmoInst=
281 CMPISCMOUtilities::getSCMOFromCIMObjectPath(
|
282 marek 1.53.2.3 ncop,
|
283 r.kieninger 1.53.2.2 scmoInst->getNameSpace());
284
|
285 ms.aruran 1.42 CMPIObjectPath* cmpiObjPath = reinterpret_cast<CMPIObjectPath*>(
|
286 r.kieninger 1.53.2.4 new CMPI_Object(newScmoInst,CMPI_Object::ObjectTypeObjectPath));
287
288 CMSetStatus(rc,CMPI_RC_OK);
|
289 ms.aruran 1.42 PEG_METHOD_EXIT();
290 return cmpiObjPath;
|
291 venkat.puvvada 1.39 }
|
292 marek 1.45 HandlerCatchSetStatus(rc, NULL);
293
|
294 venkat.puvvada 1.39 // Code flow should never get here.
295 }
296
297 static CMPIStatus mbModifyInstance(
298 const CMPIBroker *mb,
299 const CMPIContext *ctx,
300 const CMPIObjectPath *cop,
301 const CMPIInstance *ci,
302 const char ** properties)
303 {
|
304 ms.aruran 1.42 PEG_METHOD_ENTER(
305 TRC_CMPIPROVIDERINTERFACE,
306 "CMPI_Broker:mbModifyInstance()");
|
307 venkat.puvvada 1.39 mb = CM_BROKER;
308 CMPIFlags flgs =
309 ctx->ft->getEntry(ctx,CMPIInvocationFlags,NULL).value.uint32;
310 const CIMPropertyList props = getList(properties);
311
|
312 r.kieninger 1.53.2.2 SCMOInstance* scmoInst = SCMO_Instance(ci);
313 CIMInstance inst;
|
314 venkat.puvvada 1.39 try
315 {
|
316 r.kieninger 1.53.2.4 scmoInst->getCIMInstance(inst);
317
|
318 venkat.puvvada 1.39 CM_CIMOM(mb)->modifyInstance(
|
319 marek 1.53 *CM_Context(ctx),
|
320 r.kieninger 1.53.2.2 SCMO_ObjectPath(cop)->getNameSpace(),
321 inst,
|
322 venkat.puvvada 1.39 CM_IncludeQualifiers(flgs),
323 props);
324 }
|
325 marek 1.45 HandlerCatchReturnStatus();
326
|
327 ms.aruran 1.42 PEG_METHOD_EXIT();
|
328 venkat.puvvada 1.39 CMReturn(CMPI_RC_OK);
329 }
330
331 static CMPIStatus mbDeleteInstance(
332 const CMPIBroker *mb,
333 const CMPIContext *ctx,
334 const CMPIObjectPath *cop)
335 {
|
336 ms.aruran 1.42 PEG_METHOD_ENTER(
337 TRC_CMPIPROVIDERINTERFACE,
338 "CMPI_Broker:mbDeleteInstance()");
|
339 venkat.puvvada 1.39 mb = CM_BROKER;
|
340 r.kieninger 1.53.2.2
341 SCMOInstance* scmoObjPath = SCMO_ObjectPath(cop);
342 CIMObjectPath qop;
|
343 venkat.puvvada 1.39 try
344 {
|
345 r.kieninger 1.53.2.4 scmoObjPath->getCIMObjectPath(qop);
346
|
347 venkat.puvvada 1.39 CM_CIMOM(mb)->deleteInstance(
|
348 marek 1.53 *CM_Context(ctx),
|
349 r.kieninger 1.53.2.2 SCMO_ObjectPath(cop)->getNameSpace(),
350 qop);
|
351 venkat.puvvada 1.39 }
|
352 marek 1.45 HandlerCatchReturnStatus();
353
|
354 ms.aruran 1.42 PEG_METHOD_EXIT();
|
355 venkat.puvvada 1.39 CMReturn(CMPI_RC_OK);
356 }
357
358 static CMPIEnumeration* mbExecQuery(
359 const CMPIBroker *mb,
360 const CMPIContext *ctx,
361 const CMPIObjectPath *cop,
362 const char *query, const char *lang, CMPIStatus *rc)
363 {
|
364 ms.aruran 1.42 PEG_METHOD_ENTER(
365 TRC_CMPIPROVIDERINTERFACE,
366 "CMPI_Broker:mbExecQuery()");
|
367 venkat.puvvada 1.39 mb = CM_BROKER;
368
369 try
370 {
|
371 r.kieninger 1.53.2.4 CIMResponseData resData = CM_CIMOM(mb)->execQuery(
|
372 marek 1.53 *CM_Context(ctx),
|
373 r.kieninger 1.53.2.2 SCMO_ObjectPath(cop)->getNameSpace(),
|
374 venkat.puvvada 1.39 String(lang),
375 String(query));
376
|
377 r.kieninger 1.53.2.2
|
378 marek 1.53.2.6 Array<SCMOInstance>* aObj =
|
379 r.kieninger 1.53.2.4 new Array<SCMOInstance>(resData.getSCMO());
380
|
381 r.kieninger 1.53.2.2
382 CMPIEnumeration* cmpiEnum = reinterpret_cast<CMPIEnumeration*>(
383 new CMPI_Object(new CMPI_ObjEnumeration(aObj)));
384
|
385 r.kieninger 1.53.2.4 CMSetStatus(rc,CMPI_RC_OK);
|
386 ms.aruran 1.42 PEG_METHOD_EXIT();
387 return cmpiEnum;
|
388 venkat.puvvada 1.39 }
|
389 marek 1.45 HandlerCatchSetStatus(rc, NULL);
390
|
391 venkat.puvvada 1.39 // Code flow should never get here.
392 }
393
394 static CMPIEnumeration* mbEnumInstances(
395 const CMPIBroker *mb,
396 const CMPIContext *ctx,
397 const CMPIObjectPath *cop,
398 const char **properties,
399 CMPIStatus *rc)
400 {
|
401 ms.aruran 1.42 PEG_METHOD_ENTER(
402 TRC_CMPIPROVIDERINTERFACE,
403 "CMPI_Broker:mbEnumInstances()");
|
404 venkat.puvvada 1.39 mb = CM_BROKER;
405
406 CMPIFlags flgs =
407 ctx->ft->getEntry(ctx,CMPIInvocationFlags,NULL).value.uint32;
408 const CIMPropertyList props = getList(properties);
409
410 try
411 {
|
412 r.kieninger 1.53.2.4 CIMResponseData resData =
|
413 venkat.puvvada 1.39 CM_CIMOM(mb)->enumerateInstances(
|
414 marek 1.53 *CM_Context(ctx),
|
415 r.kieninger 1.53.2.2 SCMO_ObjectPath(cop)->getNameSpace(),
416 SCMO_ObjectPath(cop)->getClassName(),
|
417 r.kieninger 1.53.2.7 true,
|
418 venkat.puvvada 1.39 CM_IncludeQualifiers(flgs),
419 CM_ClassOrigin(flgs),
420 props);
421
422 // When running out of process the returned instances don't contain
|
423 marek 1.53.2.6 // a namespace.
|
424 r.kieninger 1.53.2.4 // Add the namespace from the input parameters where neccessary
425 resData.completeNamespace(SCMO_ObjectPath(cop));
|
426 venkat.puvvada 1.39
|
427 marek 1.53.2.6 Array<SCMOInstance>* aInst =
|
428 r.kieninger 1.53.2.4 new Array<SCMOInstance>(resData.getSCMO());
|
429 venkat.puvvada 1.39
|
430 ms.aruran 1.42 CMPIEnumeration* cmpiEnum = reinterpret_cast<CMPIEnumeration*>(
|
431 venkat.puvvada 1.39 new CMPI_Object(new CMPI_InstEnumeration(aInst)));
|
432 r.kieninger 1.53.2.4
433 CMSetStatus(rc,CMPI_RC_OK);
|
434 ms.aruran 1.42 PEG_METHOD_EXIT();
435 return cmpiEnum;
|
436 venkat.puvvada 1.39 }
|
437 marek 1.45 HandlerCatchSetStatus(rc, NULL);
438
|
439 venkat.puvvada 1.39 // Code flow should never get here.
440 }
441
442 static CMPIEnumeration* mbEnumInstanceNames(
443 const CMPIBroker *mb,
444 const CMPIContext *ctx,
445 const CMPIObjectPath *cop,
446 CMPIStatus *rc)
447 {
|
448 ms.aruran 1.42 PEG_METHOD_ENTER(
449 TRC_CMPIPROVIDERINTERFACE,
450 "CMPI_Broker:mbEnumInstanceNames()");
|
451 venkat.puvvada 1.39 mb = CM_BROKER;
452
453 try
454 {
|
455 r.kieninger 1.53.2.4 CIMResponseData resData =
|
456 venkat.puvvada 1.39 CM_CIMOM(mb)->enumerateInstanceNames(
|
457 marek 1.53 *CM_Context(ctx),
|
458 r.kieninger 1.53.2.2 SCMO_ObjectPath(cop)->getNameSpace(),
459 SCMO_ObjectPath(cop)->getClassName());
|
460 venkat.puvvada 1.39
461 // When running out of process the returned instances don't contain
|
462 marek 1.53.2.6 // a namespace.
|
463 r.kieninger 1.53.2.4 // Add the namespace from the input parameters where neccessary
464 resData.completeNamespace(SCMO_ObjectPath(cop));
465
|
466 marek 1.53.2.6 Array<SCMOInstance>* aRef =
|
467 r.kieninger 1.53.2.4 new Array<SCMOInstance>(resData.getSCMO());
468
469
|
470 ms.aruran 1.42 CMPIEnumeration* cmpiEnum = reinterpret_cast<CMPIEnumeration*>(
|
471 venkat.puvvada 1.49 new CMPI_Object(new CMPI_OpEnumeration(aRef)));
|
472 r.kieninger 1.53.2.4
473 CMSetStatus(rc,CMPI_RC_OK);
|
474 ms.aruran 1.42 PEG_METHOD_EXIT();
475 return cmpiEnum;
|
476 venkat.puvvada 1.39 }
|
477 marek 1.45 HandlerCatchSetStatus(rc, NULL);
478
|
479 venkat.puvvada 1.39 // Code flow should never get here.
480 }
481
482 static CMPIEnumeration* mbAssociators(
483 const CMPIBroker *mb,
484 const CMPIContext *ctx,
485 const CMPIObjectPath *cop,
486 const char *assocClass,
487 const char *resultClass,
488 const char *role,
489 const char *resultRole,
490 const char **properties,
491 CMPIStatus *rc)
492 {
|
493 ms.aruran 1.42 PEG_METHOD_ENTER(
494 TRC_CMPIPROVIDERINTERFACE,
495 "CMPI_Broker:mbAssociators()");
|
496 venkat.puvvada 1.39 mb = CM_BROKER;
|
497 dave.sudlik 1.41 // ATTN-CAKG-P2-20020726: The following condition does not correctly
498 // distinguish instanceNames from classNames in every case
499 // The instanceName of a singleton instance of a keyless class has no
500 // key bindings
|
501 r.kieninger 1.53.2.2 if (!SCMO_ObjectPath(cop)->getKeyBindingCount())
|
502 dave.sudlik 1.41 {
503 CMSetStatus(rc, CMPI_RC_ERR_FAILED);
|
504 ms.aruran 1.42 PEG_METHOD_EXIT();
|
505 dave.sudlik 1.41 return 0;
506 }
|
507 venkat.puvvada 1.39 CMPIFlags flgs =
508 ctx->ft->getEntry(ctx,CMPIInvocationFlags,NULL).value.uint32;
509 const CIMPropertyList props = getList(properties);
|
510 r.kieninger 1.53.2.2
511 SCMOInstance* scmoObjPath = SCMO_ObjectPath(cop);
512 CIMObjectPath qop;
|
513 venkat.puvvada 1.39 try
514 {
|
515 r.kieninger 1.53.2.4 scmoObjPath->getCIMObjectPath(qop);
|
516 r.kieninger 1.53.2.8 // For compatibility with previous implementations have empty ns
517 qop.setNameSpace(CIMNamespaceName());
|
518 r.kieninger 1.53.2.4
519 CIMResponseData resData =
|
520 venkat.puvvada 1.39 CM_CIMOM(mb)->associators(
|
521 marek 1.53 *CM_Context(ctx),
|
522 r.kieninger 1.53.2.2 SCMO_ObjectPath(cop)->getNameSpace(),
|
523 venkat.puvvada 1.39 qop,
524 assocClass ? CIMName(assocClass) : CIMName(),
525 resultClass ? CIMName(resultClass) : CIMName(),
526 role ? String(role) : String::EMPTY,
527 resultRole ? String(resultRole) : String::EMPTY,
528 CM_IncludeQualifiers(flgs),
529 CM_ClassOrigin(flgs),
530 props);
531
532 // When running out of process the returned instances don't contain
|
533 marek 1.53.2.6 // a namespace.
|
534 r.kieninger 1.53.2.4 // Add the namespace from the input parameters where neccessary
535 resData.completeNamespace(scmoObjPath);
536
|
537 marek 1.53.2.6 Array<SCMOInstance>* aObj =
|
538 r.kieninger 1.53.2.4 new Array<SCMOInstance>(resData.getSCMO());
|
539 venkat.puvvada 1.49
|
540 ms.aruran 1.42 CMPIEnumeration* cmpiEnum = reinterpret_cast<CMPIEnumeration*>(
|
541 venkat.puvvada 1.49 new CMPI_Object(new CMPI_ObjEnumeration(aObj)));
|
542 r.kieninger 1.53.2.4
543 CMSetStatus(rc,CMPI_RC_OK);
|
544 ms.aruran 1.42 PEG_METHOD_EXIT();
545 return cmpiEnum;
|
546 venkat.puvvada 1.39 }
|
547 marek 1.45 HandlerCatchSetStatus(rc, NULL);
548
|
549 venkat.puvvada 1.39 // Code flow should never get here.
550 }
551
552 static CMPIEnumeration* mbAssociatorNames(
553 const CMPIBroker *mb,
554 const CMPIContext *ctx,
555 const CMPIObjectPath *cop,
556 const char *assocClass,
557 const char *resultClass,
558 const char *role,
559 const char *resultRole,
560 CMPIStatus *rc)
561 {
|
562 ms.aruran 1.42 PEG_METHOD_ENTER(
563 TRC_CMPIPROVIDERINTERFACE,
564 "CMPI_Broker:mbAssociatorNames()");
|
565 venkat.puvvada 1.39 mb = CM_BROKER;
|
566 dave.sudlik 1.41 // ATTN-CAKG-P2-20020726: The following condition does not correctly
567 // distinguish instanceNames from classNames in every case
568 // The instanceName of a singleton instance of a keyless class has no
569 // key bindings
|
570 r.kieninger 1.53.2.2 if (!SCMO_ObjectPath(cop)->getKeyBindingCount())
|
571 dave.sudlik 1.41 {
572 CMSetStatus(rc, CMPI_RC_ERR_FAILED);
|
573 ms.aruran 1.42 PEG_METHOD_EXIT();
|
574 dave.sudlik 1.41 return 0;
575 }
|
576 r.kieninger 1.53.2.2
577 SCMOInstance* scmoObjPath = SCMO_ObjectPath(cop);
578 CIMObjectPath qop;
|
579 venkat.puvvada 1.39 try
580 {
|
581 r.kieninger 1.53.2.4 scmoObjPath->getCIMObjectPath(qop);
|
582 r.kieninger 1.53.2.8 // For compatibility with previous implementations have empty ns
583 qop.setNameSpace(CIMNamespaceName());
|
584 r.kieninger 1.53.2.4
585 CIMResponseData resData =
|
586 venkat.puvvada 1.39 CM_CIMOM(mb)->associatorNames(
|
587 marek 1.53 *CM_Context(ctx),
|
588 r.kieninger 1.53.2.2 scmoObjPath->getNameSpace(),
|
589 venkat.puvvada 1.39 qop,
590 assocClass ? CIMName(assocClass) : CIMName(),
591 resultClass ? CIMName(resultClass) : CIMName(),
592 role ? String(role) : String::EMPTY,
593 resultRole ? String(resultRole) : String::EMPTY);
594
595 // When running out of process the returned instances don't contain
|
596 marek 1.53.2.6 // a namespace.
|
597 r.kieninger 1.53.2.4 // Add the namespace from the input parameters where neccessary
598 resData.completeNamespace(scmoObjPath);
599
|
600 marek 1.53.2.6 Array<SCMOInstance>* aRef =
|
601 r.kieninger 1.53.2.4 new Array<SCMOInstance>(resData.getSCMO());
602
|
603 venkat.puvvada 1.49
|
604 ms.aruran 1.42 CMPIEnumeration* cmpiEnum = reinterpret_cast<CMPIEnumeration*>(
|
605 venkat.puvvada 1.49 new CMPI_Object(new CMPI_OpEnumeration(aRef)));
|
606 r.kieninger 1.53.2.4
607 CMSetStatus(rc,CMPI_RC_OK);
|
608 ms.aruran 1.42 PEG_METHOD_EXIT();
609 return cmpiEnum;
|
610 venkat.puvvada 1.39 }
|
611 marek 1.45 HandlerCatchSetStatus(rc, NULL);
612
|
613 venkat.puvvada 1.39 // Code flow should never get here.
614 }
615
616 static CMPIEnumeration* mbReferences(
617 const CMPIBroker *mb,
618 const CMPIContext *ctx,
619 const CMPIObjectPath *cop,
620 const char *resultClass,
621 const char *role ,
622 const char **properties,
623 CMPIStatus *rc)
624 {
|
625 ms.aruran 1.42 PEG_METHOD_ENTER(
626 TRC_CMPIPROVIDERINTERFACE,
627 "CMPI_Broker:mbReferences()");
|
628 venkat.puvvada 1.39 mb = CM_BROKER;
|
629 dave.sudlik 1.41 // ATTN-CAKG-P2-20020726: The following condition does not correctly
630 // distinguish instanceNames from classNames in every case
631 // The instanceName of a singleton instance of a keyless class has no
632 // key bindings
|
633 r.kieninger 1.53.2.2 if (!SCMO_ObjectPath(cop)->getKeyBindingCount())
|
634 dave.sudlik 1.41 {
635 CMSetStatus(rc, CMPI_RC_ERR_FAILED);
|
636 ms.aruran 1.42 PEG_METHOD_EXIT();
|
637 dave.sudlik 1.41 return 0;
638 }
|
639 venkat.puvvada 1.39 CMPIFlags flgs =
640 ctx->ft->getEntry(ctx,CMPIInvocationFlags,NULL).value.uint32;
641 CIMPropertyList props = getList(properties);
|
642 r.kieninger 1.53.2.2
643
644 SCMOInstance* scmoObjPath = SCMO_ObjectPath(cop);
645 CIMObjectPath qop;
|
646 venkat.puvvada 1.39 try
647 {
|
648 r.kieninger 1.53.2.4 scmoObjPath->getCIMObjectPath(qop);
|
649 r.kieninger 1.53.2.8 // For compatibility with previous implementations have empty ns
650 qop.setNameSpace(CIMNamespaceName());
|
651 r.kieninger 1.53.2.4
652 CIMResponseData resData =
|
653 venkat.puvvada 1.39 CM_CIMOM(mb)->references(
|
654 marek 1.53 *CM_Context(ctx),
|
655 r.kieninger 1.53.2.2 scmoObjPath->getNameSpace(),
|
656 venkat.puvvada 1.39 qop,
657 resultClass ? CIMName(resultClass) : CIMName(),
658 role ? String(role) : String::EMPTY,
659 CM_IncludeQualifiers(flgs),
660 CM_ClassOrigin(flgs),
661 props);
662
663 CMSetStatus(rc,CMPI_RC_OK);
|
664 r.kieninger 1.53.2.4
665 // Add the namespace from the input parameters when neccessary
666 resData.completeNamespace(scmoObjPath);
667
|
668 marek 1.53.2.6 Array<SCMOInstance>* aObj =
|
669 r.kieninger 1.53.2.4 new Array<SCMOInstance>(resData.getSCMO());
|
670 venkat.puvvada 1.49
|
671 ms.aruran 1.42 CMPIEnumeration* cmpiEnum = reinterpret_cast<CMPIEnumeration*>(
|
672 venkat.puvvada 1.49 new CMPI_Object(new CMPI_ObjEnumeration(aObj)));
|
673 ms.aruran 1.42 PEG_METHOD_EXIT();
674 return cmpiEnum;
|
675 venkat.puvvada 1.39 }
|
676 marek 1.45 HandlerCatchSetStatus(rc, NULL);
677
|
678 venkat.puvvada 1.39 // Code flow should never get here.
679 }
680
681 static CMPIEnumeration* mbReferenceNames(
682 const CMPIBroker *mb,
683 const CMPIContext *ctx,
684 const CMPIObjectPath *cop,
685 const char *resultClass,
686 const char *role,
687 CMPIStatus *rc)
688 {
|
689 ms.aruran 1.42 PEG_METHOD_ENTER(
690 TRC_CMPIPROVIDERINTERFACE,
691 "CMPI_Broker:mbReferenceNames()");
|
692 venkat.puvvada 1.39 mb = CM_BROKER;
|
693 dave.sudlik 1.41 // ATTN-CAKG-P2-20020726: The following condition does not correctly
694 // distinguish instanceNames from classNames in every case
695 // The instanceName of a singleton instance of a keyless class has no
696 // key bindings
|
697 r.kieninger 1.53.2.2 if (!SCMO_ObjectPath(cop)->getKeyBindingCount())
|
698 dave.sudlik 1.41 {
699 CMSetStatus(rc, CMPI_RC_ERR_FAILED);
|
700 ms.aruran 1.42 PEG_METHOD_EXIT();
|
701 dave.sudlik 1.41 return 0;
702 }
|
703 r.kieninger 1.53.2.2
704 SCMOInstance* scmoObjPath = SCMO_ObjectPath(cop);
705 CIMObjectPath qop;
|
706 venkat.puvvada 1.39 try
707 {
|
708 r.kieninger 1.53.2.4 scmoObjPath->getCIMObjectPath(qop);
|
709 r.kieninger 1.53.2.8 // For compatibility with previous implementations have empty ns
710 qop.setNameSpace(CIMNamespaceName());
|
711 r.kieninger 1.53.2.4
712 CIMResponseData resData =
|
713 venkat.puvvada 1.39 CM_CIMOM(mb)->referenceNames(
|
714 marek 1.53 *CM_Context(ctx),
|
715 r.kieninger 1.53.2.2 scmoObjPath->getNameSpace(),
|
716 venkat.puvvada 1.39 qop,
717 resultClass ? CIMName(resultClass) : CIMName(),
718 role ? String(role) : String::EMPTY);
719
|
720 r.kieninger 1.53.2.4 // Add the namespace from the input parameters when neccessary
721 resData.completeNamespace(scmoObjPath);
722
|
723 marek 1.53.2.6 Array<SCMOInstance>* aRef =
|
724 r.kieninger 1.53.2.4 new Array<SCMOInstance>(resData.getSCMO());
|
725 venkat.puvvada 1.49
|
726 ms.aruran 1.42 CMPIEnumeration* cmpiEnum = reinterpret_cast<CMPIEnumeration*>(
|
727 venkat.puvvada 1.49 new CMPI_Object(new CMPI_OpEnumeration(aRef)));
|
728 r.kieninger 1.53.2.4 CMSetStatus(rc,CMPI_RC_OK);
|
729 ms.aruran 1.42 PEG_METHOD_EXIT();
730 return cmpiEnum;
|
731 venkat.puvvada 1.39 }
|
732 marek 1.45 HandlerCatchSetStatus(rc, NULL);
733
|
734 venkat.puvvada 1.39 // Code flow should never get here.
735 }
|
736 schuur 1.1
|
737 r.kieninger 1.29 #define CM_Args(args) ((Array<CIMParamValue>*)args->hdl)
738
|
739 venkat.puvvada 1.39 static CMPIData mbInvokeMethod(
740 const CMPIBroker *mb,
741 const CMPIContext *ctx,
742 const CMPIObjectPath *cop,
743 const char *method,
744 const CMPIArgs *in,
745 CMPIArgs *out,
746 CMPIStatus *rc)
747 {
|
748 ms.aruran 1.42 PEG_METHOD_ENTER(
749 TRC_CMPIPROVIDERINTERFACE,
750 "CMPI_Broker:mbInvokeMethod()");
|
751 venkat.puvvada 1.39 CMPIData data = {0,CMPI_nullValue,{0}};
752 mb = CM_BROKER;
|
753 r.kieninger 1.53.2.2
754
755 SCMOInstance* scmoObjPath = SCMO_ObjectPath(cop);
756 CIMObjectPath qop;
|
757 venkat.puvvada 1.39 try
758 {
|
759 r.kieninger 1.53.2.4 scmoObjPath->getCIMObjectPath(qop);
760
|
761 venkat.puvvada 1.39 CIMValue v = CM_CIMOM(mb)->invokeMethod(
|
762 marek 1.53 *CM_Context(ctx),
|
763 r.kieninger 1.53.2.2 SCMO_ObjectPath(cop)->getNameSpace(),
|
764 venkat.puvvada 1.39 qop,
765 method ? String(method) : String::EMPTY,
766 *CM_Args(in),
767 *CM_Args(out));
|
768 r.kieninger 1.53.2.9
769 CIMType vType=v.getType();
770 CMPIType t = type2CMPIType(vType,v.isArray());
771 value2CMPIData(v,t,&data);
772
|
773 venkat.puvvada 1.39 if (rc)
774 {
775 CMSetStatus(rc,CMPI_RC_OK);
776 }
777 }
|
778 marek 1.45 HandlerCatchSetStatus(rc, data);
779
|
780 ms.aruran 1.42 PEG_METHOD_EXIT();
|
781 venkat.puvvada 1.39 return data; // "data" will be valid data or nullValue (in error case)
782 }
783
784 static CMPIStatus mbSetProperty(
785 const CMPIBroker *mb,
786 const CMPIContext *ctx,
787 const CMPIObjectPath *cop,
788 const char *name,
789 const CMPIValue *val,
790 CMPIType type)
791 {
|
792 ms.aruran 1.42 PEG_METHOD_ENTER(
793 TRC_CMPIPROVIDERINTERFACE,
794 "CMPI_Broker:mbSetProperty()");
|
795 venkat.puvvada 1.39 mb = CM_BROKER;
796 CMPIrc rc;
797 CIMValue v = value2CIMValue(val,type,&rc);
798
|
799 r.kieninger 1.53.2.2 SCMOInstance* scmoObjPath = SCMO_ObjectPath(cop);
800 CIMObjectPath qop;
|
801 venkat.puvvada 1.39 try
802 {
|
803 r.kieninger 1.53.2.4 scmoObjPath->getCIMObjectPath(qop);
804
|
805 venkat.puvvada 1.39 CM_CIMOM(mb)->setProperty(
|
806 marek 1.53 *CM_Context(ctx),
|
807 r.kieninger 1.53.2.2 SCMO_ObjectPath(cop)->getNameSpace(),
808 qop,
|
809 venkat.puvvada 1.39 String(name),
810 v);
811 }
|
812 marek 1.45 HandlerCatchReturnStatus();
813
|
814 ms.aruran 1.42 PEG_METHOD_EXIT();
|
815 venkat.puvvada 1.39 CMReturn(CMPI_RC_OK);
816 }
817
818 static CMPIData mbGetProperty(
819 const CMPIBroker *mb,
820 const CMPIContext *ctx,
821 const CMPIObjectPath *cop,
822 const char *name,
823 CMPIStatus *rc)
824 {
|
825 ms.aruran 1.42 PEG_METHOD_ENTER(
826 TRC_CMPIPROVIDERINTERFACE,
827 "CMPI_Broker:mbGetProperty()");
|
828 venkat.puvvada 1.39 mb = CM_BROKER;
829 CMPIData data = {0,CMPI_nullValue,{0}};
830
|
831 r.kieninger 1.53.2.2 SCMOInstance* scmoObjPath = SCMO_ObjectPath(cop);
832 CIMObjectPath qop;
833 scmoObjPath->getCIMObjectPath(qop);
834
|
835 venkat.puvvada 1.39 try
836 {
837 CIMValue v = CM_CIMOM(mb)->getProperty(
|
838 marek 1.53 *CM_Context(ctx),
|
839 r.kieninger 1.53.2.2 SCMO_ObjectPath(cop)->getNameSpace(),
840 qop,
|
841 venkat.puvvada 1.39 String(name));
842 CIMType vType = v.getType();
843 CMPIType t = type2CMPIType(vType,v.isArray());
844 value2CMPIData(v,t,&data);
845 CMSetStatus(rc,CMPI_RC_OK);
846 }
|
847 marek 1.45 HandlerCatchSetStatus(rc, data);
848
|
849 ms.aruran 1.42 PEG_METHOD_EXIT();
|
850 venkat.puvvada 1.39 return data; // "data" will be valid data or nullValue (in error case)
851 }
852
|
853 marek 1.53.2.3 /* With Bug#8541 the CMPI Provider Manager was changed to attach the
|
854 marek 1.53 complete requests operation context to the CMPI thread context.
855 In future, when we have a lot more containers on the operation context,
856 this might lead to an impact on memory usage here, when the entire
857 operation context gets copied to the new thread.
858 */
|
859 venkat.puvvada 1.39 static CMPIContext* mbPrepareAttachThread(
860 const CMPIBroker* mb,
861 const CMPIContext* eCtx)
862 {
|
863 ms.aruran 1.42 PEG_METHOD_ENTER(
864 TRC_CMPIPROVIDERINTERFACE,
865 "CMPI_Broker:mbPrepareAttachThread()");
|
866 venkat.puvvada 1.39 mb = CM_BROKER;
867 OperationContext *ctx = (OperationContext*)((CMPI_Context*)eCtx)->ctx;
868 OperationContext nctx = *ctx;
869 CMPIContext* neCtx = new CMPI_Context(*(new OperationContext(nctx)));
870 CMPIString *name;
871 for (int i=0,s=CMPI_Args_Ftab->getArgCount(
872 reinterpret_cast<const CMPIArgs*>(eCtx),NULL); i<s; i++)
873 {
874 CMPIData data = CMPI_Args_Ftab->getArgAt(
875 reinterpret_cast<const CMPIArgs*>(eCtx),i,&name,NULL);
876 CMPI_Args_Ftab->addArg(
877 reinterpret_cast<CMPIArgs*>(neCtx),
|
878 s.kodali 1.47 CMGetCharsPtr(name,NULL),
|
879 venkat.puvvada 1.39 &data.value,data.type);
880 }
|
881 ms.aruran 1.42 PEG_METHOD_EXIT();
|
882 venkat.puvvada 1.39 return neCtx;
883 }
884
885 static CMPIStatus mbAttachThread(
886 const CMPIBroker* mb,
887 const CMPIContext* eCtx)
888 {
889 ((CMPI_Context*)eCtx)->thr = new CMPI_ThreadContext(mb,eCtx);
890 CMReturn(CMPI_RC_OK);
891 }
892
893 static CMPIStatus mbDetachThread(
894 const CMPIBroker* mb,
895 const CMPIContext* eCtx)
896 {
897 mb = CM_BROKER;
898 CMPI_Context *neCtx = (CMPI_Context *)eCtx;
899 delete neCtx->thr;
900 // Delete also CMPIContext
901 delete neCtx;
902 CMReturn(CMPI_RC_OK);
903 venkat.puvvada 1.39 }
|
904 schuur 1.11
|
905 venkat.puvvada 1.39 static CMPIStatus mbDeliverIndication(
|
906 ms.aruran 1.42 const CMPIBroker* eMb,
907 const CMPIContext* ctx,
908 const char *ns,
909 const CMPIInstance* ind)
910 {
911 PEG_METHOD_ENTER(
912 TRC_CMPIPROVIDERINTERFACE,
913 "CMPI_Broker:mbDeliverIndication()");
|
914 venkat.puvvada 1.39 eMb = CM_BROKER;
915 CMPI_Broker *mb = (CMPI_Broker*)eMb;
|
916 thilo.boehm 1.53.2.10 IndProvRecord *indProvRec;
|
917 venkat.puvvada 1.39 OperationContext* context = CM_Context(ctx);
|
918 r.kieninger 1.53.2.2
919 SCMOInstance* scmoInst = SCMO_Instance(ind);
920 CIMInstance indInst;
921 scmoInst->getCIMInstance(indInst);
922
|
923 venkat.puvvada 1.39 // When an indication to be delivered comes from Remote providers,
924 // the CMPIBroker contains the name of the provider in the form
925 // of physical-name:logical-name. Search using logical-name. -V 5884
926 String provider_name;
927 CMPIUint32 n;
928
929 if ( (n = mb->name.find(':') ) != PEG_NOT_FOUND)
930 {
931 provider_name = mb->name.subString (n + 1);
932 }
933 else
934 {
935 provider_name = mb->name;
936 }
937 ReadLock readLock(CMPIProviderManager::rwSemProvTab);
|
938 thilo.boehm 1.53.2.10 if (CMPIProviderManager::indProvTab.lookup(provider_name, indProvRec))
|
939 venkat.puvvada 1.39 {
|
940 thilo.boehm 1.53.2.10 if (indProvRec->isEnabled())
|
941 venkat.puvvada 1.39 {
942 try
943 {
944 context->get(SubscriptionInstanceNamesContainer::NAME);
945 }
|
946 ms.aruran 1.42 catch (const Exception &e)
|
947 venkat.puvvada 1.39 {
|
948 thilo.boehm 1.48 PEG_TRACE((TRC_CMPIPROVIDERINTERFACE,Tracer::LEVEL1,
949 "Exception: %s",
950 (const char*)e.getMessage().getCString()));
|
951 venkat.puvvada 1.39 Array<CIMObjectPath> subscriptionInstanceNames;
952 context->insert(
953 SubscriptionInstanceNamesContainer(
954 subscriptionInstanceNames));
955 }
|
956 r.kieninger 1.53.2.2 CIMIndication cimIndication(indInst);
|
957 venkat.puvvada 1.39 try
958 {
|
959 thilo.boehm 1.53.2.10 indProvRec->getHandler()->deliver(
|
960 venkat.puvvada 1.39 *context,
961 // OperationContext(*CM_Context(ctx)),
962 cimIndication);
|
963 ms.aruran 1.42 PEG_METHOD_EXIT();
964 CMReturn(CMPI_RC_OK);
|
965 venkat.puvvada 1.39 }
|
966 marek 1.45 HandlerCatchReturnStatus();
|
967 venkat.puvvada 1.39 }
968 }
|
969 ms.aruran 1.42 PEG_METHOD_EXIT();
|
970 venkat.puvvada 1.39 CMReturn(CMPI_RC_ERR_FAILED);
971 }
|
972 schuur 1.11 }
|
973 schuur 1.1
|
974 venkat.puvvada 1.39 static CMPIBrokerFT broker_FT =
975 {
976 MB_CAPABILITIES, // brokerClassification;
977 CMPICurrentVersion,
978 "Pegasus",
979 mbPrepareAttachThread,
980 mbAttachThread,
981 mbDetachThread,
982 mbDeliverIndication,
983 mbEnumInstanceNames,
984 mbGetInstance,
985 mbCreateInstance,
986 mbModifyInstance,
987 mbDeleteInstance,
988 mbExecQuery,
989 mbEnumInstances,
990 mbAssociators,
991 mbAssociatorNames,
992 mbReferences,
993 mbReferenceNames,
994 mbInvokeMethod,
995 venkat.puvvada 1.39 mbSetProperty,
996 mbGetProperty,
|
997 schuur 1.1 };
998
|
999 venkat.puvvada 1.39 CMPIBrokerFT *CMPI_Broker_Ftab = & broker_FT;
|
1000 schuur 1.1
1001 PEGASUS_NAMESPACE_END
|