1 martin 1.51 //%LICENSE////////////////////////////////////////////////////////////////
|
2 martin 1.52 //
|
3 martin 1.51 // 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.52 //
|
10 martin 1.51 // 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.52 //
|
17 martin 1.51 // The above copyright notice and this permission notice shall be included
18 // in all copies or substantial portions of the Software.
|
19 martin 1.52 //
|
20 martin 1.51 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
21 martin 1.52 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
22 martin 1.51 // 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.52 //
|
28 martin 1.51 //////////////////////////////////////////////////////////////////////////
|
29 schuur 1.1 //
30 //%/////////////////////////////////////////////////////////////////////////////
31
|
32 mike 1.29 #include <Pegasus/Common/AutoPtr.h>
|
33 schuur 1.4 #include "CMPI_Version.h"
|
34 schuur 1.2
|
35 schuur 1.1 #include "CMPI_Instance.h"
36 #include "CMPI_Broker.h"
37 #include "CMPI_Value.h"
38 #include "CMPI_String.h"
39
|
40 kumpf 1.50 #include <Pegasus/Common/CIMNameCast.h>
|
41 schuur 1.1 #include <Pegasus/Common/InternalException.h>
|
42 konrad.r 1.18 #include <Pegasus/Common/System.h>
|
43 mike 1.29 #include <Pegasus/Common/Mutex.h>
|
44 schuur 1.1 #include <string.h>
|
45 dave.sudlik 1.23 #include <new>
|
46 ms.aruran 1.39 #include <Pegasus/Common/Tracer.h>
|
47 schuur 1.1
48 PEGASUS_USING_STD;
49 PEGASUS_NAMESPACE_BEGIN
50
|
51 kumpf 1.53 extern "C"
|
52 venkat.puvvada 1.37 {
|
53 schuur 1.12
|
54 venkat.puvvada 1.37 static CMPIStatus instRelease(CMPIInstance* eInst)
55 {
56 CIMInstance* inst=(CIMInstance*)eInst->hdl;
57 if (inst)
58 {
59 delete inst;
60 (reinterpret_cast<CMPI_Object*>(eInst))->unlinkAndDelete();
61 CMReturn(CMPI_RC_OK);
62 }
63 else
64 {
65 CMReturn(CMPI_RC_ERR_INVALID_HANDLE);
66 }
67 }
68
69 static CMPIStatus instReleaseNop(CMPIInstance* eInst)
70 {
71 CMReturn(CMPI_RC_OK);
72 }
73
|
74 kumpf 1.53 static CMPIInstance* instClone(const CMPIInstance* eInst, CMPIStatus* rc)
|
75 venkat.puvvada 1.37 {
|
76 ms.aruran 1.39 PEG_METHOD_ENTER(
77 TRC_CMPIPROVIDERINTERFACE,
78 "CMPI_Instance:instClone()");
|
79 venkat.puvvada 1.37 CIMInstance* inst=(CIMInstance*)eInst->hdl;
80 if (!inst)
81 {
82 CMSetStatus(rc, CMPI_RC_ERR_INVALID_HANDLE);
|
83 ms.aruran 1.39 PEG_METHOD_EXIT();
|
84 venkat.puvvada 1.37 return NULL;
85 }
86 try
87 {
|
88 vijay.eli 1.22 AutoPtr<CIMInstance> cInst(new CIMInstance(inst->clone()));
89 AutoPtr<CMPI_Object> obj(new CMPI_Object(cInst.get()));
90 cInst.release();
91 obj->unlink();
|
92 mreddy 1.35 CMSetStatus(rc,CMPI_RC_OK);
|
93 kumpf 1.53 CMPIInstance* cmpiInstance =
|
94 ms.aruran 1.39 reinterpret_cast<CMPIInstance *>(obj.release());
95 PEG_METHOD_EXIT();
96 return cmpiInstance;
|
97 venkat.puvvada 1.37 }
98 catch (const PEGASUS_STD(bad_alloc)&)
99 {
100 CMSetStatus(rc, CMPI_RC_ERROR_SYSTEM);
|
101 ms.aruran 1.39 PEG_METHOD_EXIT();
|
102 venkat.puvvada 1.37 return NULL;
103 }
104 }
105
106 static CMPIData instGetPropertyAt(
107 const CMPIInstance* eInst, CMPICount pos, CMPIString** name,
108 CMPIStatus* rc)
109 {
110 CIMInstance* inst=(CIMInstance*)eInst->hdl;
111 CMPIData data={0,CMPI_nullValue,{0}};
112
113 if (!inst)
114 {
115 CMSetStatus(rc, CMPI_RC_ERR_INVALID_HANDLE);
116 return data;
117 }
118
119 if (pos>inst->getPropertyCount())
120 {
121 CMSetStatus(rc, CMPI_RC_ERR_NO_SUCH_PROPERTY);
|
122 kumpf 1.45 CMPIData retData={0,CMPI_nullValue|CMPI_notFound,{0}};
123 return retData;
|
124 venkat.puvvada 1.37 }
125 const CIMProperty& p=inst->getProperty(pos);
126 const CIMValue& v=p.getValue();
127 CIMType pType=p.getType();
128 CMPIType t=type2CMPIType(pType,p.isArray());
129
130 value2CMPIData(v,t,&data);
131
132 if (name)
133 {
134 String str=p.getName().getString();
135 *name=(CMPIString*)string2CMPIString(str);
136 }
137
138 CMSetStatus(rc,CMPI_RC_OK);
139 return data;
140 }
141
|
142 kumpf 1.53 static CMPIData instGetProperty(const CMPIInstance* eInst,
143 const char *name, CMPIStatus* rc)
|
144 venkat.puvvada 1.37 {
145 CMPIData data={0,CMPI_nullValue|CMPI_notFound,{0}};
146
147 if (!eInst->hdl)
148 {
149 CMSetStatus(rc, CMPI_RC_ERR_INVALID_HANDLE);
150 return data;
151 }
152 if (!name)
153 {
154 CMSetStatus(rc, CMPI_RC_ERR_INVALID_PARAMETER);
155 return data;
156 }
157 CIMInstance* inst=(CIMInstance*)eInst->hdl;
158 Uint32 pos=inst->findProperty(String(name));
159
160 if (pos!=PEG_NOT_FOUND)
161 {
162 CMSetStatus(rc,CMPI_RC_OK);
163 return instGetPropertyAt(eInst,pos,NULL,rc);
164 }
165 venkat.puvvada 1.37 CMSetStatus(rc, CMPI_RC_ERR_NO_SUCH_PROPERTY);
166 return data;
167 }
168
169
|
170 kumpf 1.53 static CMPICount instGetPropertyCount(const CMPIInstance* eInst,
171 CMPIStatus* rc)
|
172 venkat.puvvada 1.37 {
173 CIMInstance* inst=(CIMInstance*)eInst->hdl;
174 if (!inst)
175 {
176 CMSetStatus(rc, CMPI_RC_ERR_INVALID_HANDLE);
177 return 0;
178 }
179 CMSetStatus(rc,CMPI_RC_OK);
180 return inst->getPropertyCount();
181 }
182
|
183 kumpf 1.53 static CMPIStatus instSetPropertyWithOrigin(const CMPIInstance* eInst,
|
184 venkat.puvvada 1.37 const char* name, const CMPIValue* data, const CMPIType type,
185 const char* origin)
186 {
|
187 ms.aruran 1.39 PEG_METHOD_ENTER(
188 TRC_CMPIPROVIDERINTERFACE,
189 "CMPI_Instance:instSetPropertyWithOrigin()");
|
190 venkat.puvvada 1.37 CIMInstance *inst=(CIMInstance*)eInst->hdl;
191 if (!inst)
192 {
|
193 ms.aruran 1.39 PEG_METHOD_EXIT();
|
194 venkat.puvvada 1.37 CMReturn(CMPI_RC_ERR_INVALID_HANDLE);
195 }
196 CMPIrc rc;
197 CIMValue v=value2CIMValue(data,type,&rc);
198 Uint32 pos;
199 int count=0;
200
|
201 mike 1.49 if ((pos=inst->findProperty(CIMNameCast(name)))!=PEG_NOT_FOUND)
|
202 venkat.puvvada 1.37 {
203
204 CIMProperty cp=inst->getProperty(pos);
205
206
|
207 kumpf 1.53 /* The CMPI interface uses the type "CMPI_instance" to represent
208 both embedded objects and embedded instances. CMPI has no
209 "CMPI_object" type. So when converting a CMPIValue with type
210 "CMPI_instance" to a CIMValue (see value2CIMValue) the type
211 CIMTYPE_OBJECT is always used. If the property's type is
|
212 venkat.puvvada 1.37 CIMTYPE_INSTANCE, and the value's type is CIMTYPE_OBJECT, then
213 we convert the value's type to match the property's type.
214 */
|
215 kumpf 1.53 if (cp.getType() == CIMTYPE_INSTANCE &&
|
216 venkat.puvvada 1.37 v.getType() == CIMTYPE_OBJECT)
217 {
|
218 venkat.puvvada 1.38 if (cp.isArray())
219 {
220 if (!v.isArray())
221 {
|
222 kavita.gupta 1.40 PEG_TRACE((
223 TRC_CMPIPROVIDERINTERFACE,
|
224 marek 1.44 Tracer::LEVEL1,
|
225 kavita.gupta 1.40 "TypeMisMatch, Expected Type: %s, Actual Type: %s",
226 cimTypeToString(cp.getType()),
227 cimTypeToString(v.getType())));
228 PEG_METHOD_EXIT();
229 CMReturn(CMPI_RC_ERR_TYPE_MISMATCH);
|
230 venkat.puvvada 1.38 }
231 Array<CIMObject> tmpObjs;
232 Array<CIMInstance> tmpInsts;
233 v.get(tmpObjs);
234 for (Uint32 i = 0; i < tmpObjs.size() ; ++i)
235 {
236 tmpInsts.append(CIMInstance(tmpObjs[i]));
|
237 kumpf 1.53 }
|
238 venkat.puvvada 1.38 v.set(tmpInsts);
239 }
240 else
|
241 kumpf 1.53 {
|
242 venkat.puvvada 1.38 CIMObject co;
243 v.get(co);
244 if (co.isInstance())
245 v.set(CIMInstance(co));
246 }
|
247 venkat.puvvada 1.37 }
248 try
|
249 dave.sudlik 1.31 {
|
250 venkat.puvvada 1.37 cp.setValue(v);
251 if (origin)
252 {
253 CIMName oName(origin);
254 cp.setClassOrigin(oName);
255 }
|
256 dave.sudlik 1.31 }
|
257 venkat.puvvada 1.37 catch (const TypeMismatchException &)
258 {
|
259 ms.aruran 1.39 PEG_TRACE((
260 TRC_CMPIPROVIDERINTERFACE,
|
261 marek 1.44 Tracer::LEVEL1,
|
262 ms.aruran 1.39 " TypeMisMatch exception for: %s",
263 name));
264 if (getenv("PEGASUS_CMPI_CHECKTYPES")!=NULL)
265 {
266 PEG_TRACE_CSTRING(
267 TRC_CMPIPROVIDERINTERFACE,
|
268 marek 1.44 Tracer::LEVEL1,
|
269 ms.aruran 1.39 " Aborting because of CMPI_CHECKTYPES..");
|
270 venkat.puvvada 1.37 abort();
271 }
|
272 ms.aruran 1.39 PEG_METHOD_EXIT();
|
273 venkat.puvvada 1.37 CMReturn(CMPI_RC_ERR_TYPE_MISMATCH);
274 }
275 catch (const InvalidNameException &)
276 {
|
277 ms.aruran 1.39 PEG_TRACE((
278 TRC_CMPIPROVIDERINTERFACE,
|
279 marek 1.44 Tracer::LEVEL1,
|
280 ms.aruran 1.39 " InvalidName exception for: %s",
281 origin));
282
283 PEG_METHOD_EXIT();
|
284 venkat.puvvada 1.37 CMReturn(CMPI_RC_ERR_INVALID_PARAMETER);
285 }
286 catch (const Exception &e)
287 {
|
288 thilo.boehm 1.46 PEG_TRACE((TRC_CMPIPROVIDERINTERFACE,Tracer::LEVEL1,
289 "Exception for %s: %s",name,
290 (const char*)e.getMessage().getCString()));
|
291 ms.aruran 1.39 if (getenv("PEGASUS_CMPI_CHECKTYPES")!=NULL)
292 {
293 PEG_TRACE_CSTRING(
294 TRC_CMPIPROVIDERINTERFACE,
|
295 marek 1.44 Tracer::LEVEL1,
|
296 ms.aruran 1.39 " Aborting because of CMPI_CHECKTYPES..");
|
297 venkat.puvvada 1.37 abort();
298 }
|
299 ms.aruran 1.39 PEG_METHOD_EXIT();
|
300 venkat.puvvada 1.37 CMReturnWithString(CMPI_RC_ERR_FAILED,
301 reinterpret_cast<CMPIString*>(
302 new CMPI_Object(e.getMessage())));
303 }
304 }
305 else
306 {
|
307 marek 1.43 PEG_TRACE((TRC_CMPIPROVIDERINTERFACE,Tracer::LEVEL3,
308 "Property %s not set on created instance."
309 "Either the property is not part of the class or"
310 "not part of the property list.",
311 name));
|
312 venkat.puvvada 1.37 }
|
313 ms.aruran 1.39 PEG_METHOD_EXIT();
|
314 venkat.puvvada 1.37 CMReturn(CMPI_RC_OK);
315 }
316
317 static CMPIStatus instSetProperty(const CMPIInstance* eInst,
|
318 kumpf 1.53 const char *name, const CMPIValue* data, CMPIType type)
|
319 venkat.puvvada 1.37 {
320 return instSetPropertyWithOrigin(eInst, name, data, type, NULL);
321 }
322
323 static CMPIObjectPath* instGetObjectPath(const CMPIInstance* eInst,
|
324 kumpf 1.53 CMPIStatus* rc)
|
325 venkat.puvvada 1.37 {
|
326 ms.aruran 1.39 PEG_METHOD_ENTER(
327 TRC_CMPIPROVIDERINTERFACE,
328 "CMPI_Instance:instGetObjectPath()");
|
329 venkat.puvvada 1.37 CIMInstance* inst=(CIMInstance*)eInst->hdl;
330 if (!inst)
331 {
332 CMSetStatus(rc, CMPI_RC_ERR_INVALID_HANDLE);
|
333 ms.aruran 1.39 PEG_METHOD_EXIT();
|
334 venkat.puvvada 1.37 return NULL;
335 }
336 const CIMObjectPath &clsRef=inst->getPath();
337 AutoPtr<CIMObjectPath> objPath(NULL);
338 AutoPtr<CMPI_Object> obj(NULL);
339 try
340 {
|
341 dave.sudlik 1.41 /* Check if NameSpace is NULL before calling GetClass. When
|
342 kumpf 1.53 providers run out-of-process and getClass request is made
343 through CIMClient, CIMOperationRequestEncoder tries to
344 encode the request and finds the namespace is invalid
345 (empty) and throws InvalidNamespaceNameException.
|
346 dave.sudlik 1.41 */
|
347 kumpf 1.53 if (clsRef.getKeyBindings().size()==0 &&
|
348 dave.sudlik 1.41 !clsRef.getNameSpace().isNull())
|
349 venkat.puvvada 1.37 {
350 CIMClass *cc=mbGetClass(CMPI_ThreadContext::getBroker(),clsRef);
|
351 kumpf 1.53 /* It seems that when converting the CIMInstnace to XML form,
352 we miss CIMObjectPath from it. When we don't have namespace
353 we may not get class, so make ObjectPath with class-name
|
354 venkat.puvvada 1.37 only.
|
355 kumpf 1.53 TODO: This will create problems when passing the
|
356 venkat.puvvada 1.37 EmbeddedInstances as arguements to MethodProviders, where it
|
357 kumpf 1.53 needs to get ObjectPath from instance. Shall we need to
358 include CIMObjectPath in CIMInstance while converting to XML
359 form ??? ...
|
360 venkat.puvvada 1.37 */
361 if (!cc)
362 {
363 objPath.reset(new CIMObjectPath(clsRef));
364 }
365 else
366 {
367 const CIMObjectPath &ref=inst->buildPath(
368 *(reinterpret_cast<const CIMConstClass*>(cc)));
369 objPath.reset(new CIMObjectPath(ref));
|
370 venkat.puvvada 1.53.2.1 objPath->setHost(clsRef.getHost());
371 objPath->setNameSpace(clsRef.getNameSpace());
|
372 venkat.puvvada 1.37 }
|
373 vijay.eli 1.22 }
|
374 venkat.puvvada 1.37 else
375 objPath.reset(new CIMObjectPath(clsRef));
|
376 vijay.eli 1.22 obj.reset(new CMPI_Object(objPath.get()));
377 objPath.release();
|
378 mreddy 1.35 CMSetStatus(rc,CMPI_RC_OK);
|
379 kumpf 1.53 CMPIObjectPath* cmpiObjectPath =
|
380 ms.aruran 1.39 reinterpret_cast<CMPIObjectPath*> (obj.release());
381 PEG_METHOD_EXIT();
|
382 kumpf 1.53 return cmpiObjectPath;
|
383 venkat.puvvada 1.37 }
384 catch (const PEGASUS_STD(bad_alloc)&)
385 {
386 CMSetStatus(rc, CMPI_RC_ERROR_SYSTEM);
|
387 ms.aruran 1.39 PEG_METHOD_EXIT();
|
388 venkat.puvvada 1.37 return NULL;
389 }
390 }
391
392 static CMPIStatus instSetObjectPath(
|
393 kumpf 1.53 CMPIInstance* eInst,
|
394 venkat.puvvada 1.37 const CMPIObjectPath *obj)
395 {
|
396 ms.aruran 1.39 PEG_METHOD_ENTER(
397 TRC_CMPIPROVIDERINTERFACE,
398 "CMPI_Instance:instSetObjectPath()");
|
399 venkat.puvvada 1.37 CIMInstance* inst=(CIMInstance*)eInst->hdl;
400 if (inst==NULL)
401 {
|
402 ms.aruran 1.39 PEG_METHOD_EXIT();
|
403 venkat.puvvada 1.37 CMReturn(CMPI_RC_ERR_INVALID_HANDLE);
404 }
405 if (obj==NULL)
406 {
|
407 ms.aruran 1.39 PEG_METHOD_EXIT();
|
408 venkat.puvvada 1.37 CMReturn ( CMPI_RC_ERR_INVALID_PARAMETER);
409 }
410
411 CIMObjectPath &ref = *(CIMObjectPath*)(obj->hdl);
412 try
413 {
|
414 kumpf 1.53 inst->setPath(ref);
|
415 venkat.puvvada 1.37 }
416 catch (const TypeMismatchException &e)
417 {
|
418 ms.aruran 1.39 PEG_METHOD_EXIT();
|
419 venkat.puvvada 1.37 CMReturnWithString(CMPI_RC_ERR_FAILED,
420 reinterpret_cast<CMPIString*>(
421 new CMPI_Object(e.getMessage())));
422 }
|
423 ms.aruran 1.39 PEG_METHOD_EXIT();
|
424 venkat.puvvada 1.37 CMReturn ( CMPI_RC_OK);
425 }
426
|
427 marek 1.43 /* The function removes all properties not part of the given
428 array of property names(property lists).
429 Function can handle second list being set or not set.
430 This is an internal function used by instSetPropertyFilter()
431 */
432 static void filterCIMInstance(
433 const char** listroot1,
434 const char** listroot2,
435 CIMInstance & inst)
436 {
|
437 kumpf 1.53 /* listroot1 never can be 0, this function is only called by
|
438 marek 1.43 instSetPropertyFilter() and the check is done there already */
|
439 kumpf 1.53
|
440 marek 1.43 /* determine number of properties on the instance */
441 int propertyCount = inst.getPropertyCount();
442
443 /* number of properties in each property list */
444 int numProperties1 = 0;
|
445 kumpf 1.53 int numProperties2 = 0;
|
446 marek 1.43 /* Masks for property lists
447 0 = list element not yet found
448 1 = list element already found)
|
449 kumpf 1.53 */
|
450 marek 1.43 char * plMask1=0;
|
451 kumpf 1.53 char * plMask2=0;
|
452 marek 1.43 /* end of array of property list names */
453 const char **listend1 = listroot1;
454 /* place end pointer at end of array and count number of properties
455 named in the first list */
|
456 kumpf 1.53 while (*listend1)
|
457 marek 1.43 {
458 listend1++;
459 }
460 /* former while loop steps one field to far, step one back */
461 listend1--;
462 /* calculate last valid index of a property */
463 numProperties1 = listend1 - listroot1;
464 /* reserver memory for index + 1 property mask fields */
465 plMask1 = (char*) calloc(1, numProperties1+1);
466
467 /* special dish for two lists, need to check those at same time */
468 /* variable to hold end of array of property list names */
469 const char **listend2 = listroot2;
470 /* place end pointer at end of array and count number of properties
471 named in the first list */
472 if (listroot2)
473 {
|
474 kumpf 1.53 while (*listend2)
|
475 marek 1.43 {
476 listend2++;
477 }
478 /* former while loop steps one field to far, step one back */
479 listend2--;
480 /* calculate last valid index of a property */
481 numProperties2 = listend2 - listroot2;
482 /* reserver memory for index + 1 property mask fields */
483 plMask2 = (char*) calloc(1, numProperties2+1);
484 }
485
486 /* for each property on the instance */
487 /* use reverse order, so we don't change index of properties not yet
488 checked when removing a property */
489 for (int idx=propertyCount-1; idx >= 0; idx--)
490 {
491 CIMConstProperty prop = inst.getProperty(idx);
492 CString cName = prop.getName().getString().getCString();
493 const char* pName = (const char*)cName;
|
494 kumpf 1.53
|
495 marek 1.43 /* work the property list backward too, as often times
496 properties on the instance and in the list are ordered in the
497 same way, this helps reduce number of required strcasecmp */
498 int found = false;
499 /* use temporary list1 to step through the list */
500 const char **list1 = listend1;
501
502 /* steps through the entire property list and does compare
503 the name in the property list with the currently investigated
504 name of the property, except one of the following conditions
505 is true:
506 1.) the property list element has already been found as
507 indicated by the property list mask
508 2.) the property is found, mark it as found in the mask and
509 leave the for-loop
510 */
511 for (int pos1=numProperties1; pos1 >= 0; pos1--,list1--)
512 {
513 if (!plMask1[pos1])
514 {
515 if (System::strcasecmp(pName, *list1)==0)
516 marek 1.43 {
517 found = true;
518 plMask1[pos1] = 1;
519 break;
520 }
521 }
522 }
523 /* Do the same algorithm for the second list too,
524 except if we found the property already */
525 if (listroot2 && !found)
526 {
527 /* use temporary list2 to step through the list */
528 const char **list2 = listend2;
529 for (int pos2=numProperties2; pos2 >= 0; pos2--,list2--)
530 {
531 if (!plMask2[pos2])
532 {
533 if (System::strcasecmp(pName, *list2)==0)
534 {
535 found = true;
536 plMask2[pos2] = 1;
537 marek 1.43 break;
538 }
539 }
540 }
541 }
542 /* If the property could not be found in either property list,
543 remove the property from the instance */
544 if (!found)
545 {
546 inst.removeProperty(idx);
547 }
548 }
549 free(plMask1);
550 if (listroot2)
551 {
552 free(plMask2);
553 }
554 }
555
|
556 venkat.puvvada 1.37 static CMPIStatus instSetPropertyFilter(CMPIInstance* eInst,
557 const char** propertyList, const char **keys)
558 {
|
559 ms.aruran 1.39 PEG_METHOD_ENTER(
560 TRC_CMPIPROVIDERINTERFACE,
561 "CMPI_Instance:instSetPropertyFilter()");
|
562 venkat.puvvada 1.37 if (!eInst->hdl)
563 {
|
564 ms.aruran 1.39 PEG_METHOD_EXIT();
|
565 venkat.puvvada 1.37 CMReturn(CMPI_RC_ERR_INVALID_HANDLE);
566 }
|
567 marek 1.43 /* The property list is to be applied on the given instance.
568 Currently CMPI provider have to call instSetPropertyFilter to honor
569 property filters or have to filter for themselves.
570 Removing properties from the CIMInstance here helps to effectively
571 avoid the need to carry a property list around in the CMPI layer.
|
572 kumpf 1.53
|
573 marek 1.48 A (propertyList == 0) means the property list is null and there
574 should be no filtering.
|
575 kumpf 1.53
|
576 marek 1.48 An empty propertylist(no property to be returned) is represented by
577 a valid propertyList pointer pointing to a null pointer, i.e.
578 (*propertyList == 0)
|
579 marek 1.43 */
|
580 venkat.puvvada 1.37
|
581 marek 1.43 CIMInstance& inst=*(CIMInstance*)(eInst->hdl);
|
582 marek 1.48 if (propertyList)
|
583 venkat.puvvada 1.37 {
|
584 marek 1.48 if (!keys)
|
585 venkat.puvvada 1.37 {
|
586 marek 1.43 filterCIMInstance(propertyList, 0, inst);
|
587 venkat.puvvada 1.37 }
|
588 marek 1.43 else
589 {
590 filterCIMInstance(propertyList, keys, inst);
591 }
592 };
|
593 ms.aruran 1.39 PEG_METHOD_EXIT();
|
594 venkat.puvvada 1.37 CMReturn(CMPI_RC_OK);
595 }
596
597 static CMPIStatus instSetPropertyFilterIgnore(CMPIInstance* eInst,
598 const char** propertyList, const char **keys)
599 {
600 /* We ignore it. */
601 CMReturn ( CMPI_RC_OK);
602 }
|
603 schuur 1.1
|
604 dave.sudlik 1.31
|
605 schuur 1.1 }
606
607 static CMPIInstanceFT instance_FT={
|
608 venkat.puvvada 1.37 CMPICurrentVersion,
609 instRelease,
610 instClone,
611 instGetProperty,
612 instGetPropertyAt,
613 instGetPropertyCount,
614 instSetProperty,
615 instGetObjectPath,
616 instSetPropertyFilter,
|
617 konrad.r 1.19 #if defined(CMPI_VER_100)
|
618 venkat.puvvada 1.37 instSetObjectPath,
|
619 konrad.r 1.19 #endif
|
620 dave.sudlik 1.31 #if defined(CMPI_VER_200)
|
621 venkat.puvvada 1.37 instSetPropertyWithOrigin,
|
622 dave.sudlik 1.31 #endif
|
623 schuur 1.1 };
624
625 static CMPIInstanceFT instanceOnStack_FT={
|
626 venkat.puvvada 1.37 CMPICurrentVersion,
627 instReleaseNop,
628 instClone,
629 instGetProperty,
630 instGetPropertyAt,
631 instGetPropertyCount,
632 instSetProperty,
633 instGetObjectPath,
634 instSetPropertyFilterIgnore,
|
635 konrad.r 1.19 #if defined(CMPI_VER_100)
|
636 venkat.puvvada 1.37 instSetObjectPath,
|
637 konrad.r 1.19 #endif
|
638 dave.sudlik 1.31 #if defined(CMPI_VER_200)
|
639 venkat.puvvada 1.37 instSetPropertyWithOrigin,
|
640 dave.sudlik 1.31 #endif
|
641 schuur 1.1 };
642
643 CMPIInstanceFT *CMPI_Instance_Ftab=&instance_FT;
644 CMPIInstanceFT *CMPI_InstanceOnStack_Ftab=&instanceOnStack_FT;
645
646
|
647 venkat.puvvada 1.37 CMPI_InstanceOnStack::CMPI_InstanceOnStack(const CIMInstance& ci)
648 {
|
649 ms.aruran 1.39 PEG_METHOD_ENTER(
650 TRC_CMPIPROVIDERINTERFACE,
651 "CMPI_InstanceOnStack::CMPI_InstanceOnStack()");
652
|
653 venkat.puvvada 1.37 hdl=(void*)&ci;
654 ft=CMPI_InstanceOnStack_Ftab;
|
655 ms.aruran 1.39 PEG_METHOD_EXIT();
|
656 venkat.puvvada 1.37 }
|
657 schuur 1.1
658
659 PEGASUS_NAMESPACE_END
|
660 kumpf 1.53
|