(file) Return to CMPI_Instance.cpp CVS log (file) (dir) Up to [Pegasus] / pegasus / src / Pegasus / ProviderManager2 / CMPI

  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 thilo.boehm 1.56 #include "CMPISCMOUtilities.h"
 40 schuur      1.1  
 41 kumpf       1.50 #include <Pegasus/Common/CIMNameCast.h>
 42 schuur      1.1  #include <Pegasus/Common/InternalException.h>
 43 konrad.r    1.18 #include <Pegasus/Common/System.h>
 44 mike        1.29 #include <Pegasus/Common/Mutex.h>
 45 schuur      1.1  #include <string.h>
 46 dave.sudlik 1.23 #include <new>
 47 ms.aruran   1.39 #include <Pegasus/Common/Tracer.h>
 48 thilo.boehm 1.56 #include <Pegasus/Common/SCMODump.h>
 49 schuur      1.1  
 50                  PEGASUS_USING_STD;
 51                  PEGASUS_NAMESPACE_BEGIN
 52                  
 53 kumpf       1.53 extern "C"
 54 venkat.puvvada 1.37 {
 55 schuur         1.12 
 56 venkat.puvvada 1.37     static CMPIStatus instRelease(CMPIInstance* eInst)
 57                         {
 58 thilo.boehm    1.56         SCMOInstance* inst=(SCMOInstance*)eInst->hdl;
 59 venkat.puvvada 1.37         if (inst)
 60                             {
 61                                 delete inst;
 62                                 (reinterpret_cast<CMPI_Object*>(eInst))->unlinkAndDelete();
 63                                 CMReturn(CMPI_RC_OK);
 64                             }
 65                             else
 66                             {
 67                                 CMReturn(CMPI_RC_ERR_INVALID_HANDLE);
 68                             }
 69                         }
 70                     
 71                         static CMPIStatus instReleaseNop(CMPIInstance* eInst)
 72                         {
 73                             CMReturn(CMPI_RC_OK);
 74                         }
 75                     
 76 kumpf          1.53     static CMPIInstance* instClone(const CMPIInstance* eInst, CMPIStatus* rc)
 77 venkat.puvvada 1.37     {
 78 ms.aruran      1.39         PEG_METHOD_ENTER(
 79                                 TRC_CMPIPROVIDERINTERFACE,
 80                                 "CMPI_Instance:instClone()");
 81 thilo.boehm    1.56         SCMOInstance* inst=(SCMOInstance*)eInst->hdl;
 82 venkat.puvvada 1.37         if (!inst)
 83                             {
 84                                 CMSetStatus(rc, CMPI_RC_ERR_INVALID_HANDLE);
 85 ms.aruran      1.39             PEG_METHOD_EXIT();
 86 venkat.puvvada 1.37             return NULL;
 87                             }
 88                             try
 89                             {
 90 thilo.boehm    1.56             AutoPtr<SCMOInstance> cInst(new SCMOInstance(inst->clone()));
 91                                 AutoPtr<CMPI_Object> obj(
 92                                     new CMPI_Object(cInst.get(),CMPI_Object::ObjectTypeInstance));
 93 vijay.eli      1.22             cInst.release();
 94                                 obj->unlink();
 95 kumpf          1.53             CMPIInstance* cmpiInstance =
 96 ms.aruran      1.39                 reinterpret_cast<CMPIInstance *>(obj.release());
 97 thilo.boehm    1.56             CMSetStatus(rc,CMPI_RC_OK);
 98 ms.aruran      1.39             PEG_METHOD_EXIT();
 99                                 return cmpiInstance;
100 venkat.puvvada 1.37         }
101                             catch (const PEGASUS_STD(bad_alloc)&)
102                             {
103                                 CMSetStatus(rc, CMPI_RC_ERROR_SYSTEM);
104 ms.aruran      1.39             PEG_METHOD_EXIT();
105 venkat.puvvada 1.37             return NULL;
106                             }
107                         }
108                     
109                         static CMPIData instGetPropertyAt(
110                             const CMPIInstance* eInst, CMPICount pos, CMPIString** name,
111                             CMPIStatus* rc)
112                         {
113 thilo.boehm    1.56         CMPIData data={0,CMPI_badValue,{0}};
114 venkat.puvvada 1.37 
115 thilo.boehm    1.56         SCMOInstance* inst=(SCMOInstance*)eInst->hdl;
116 venkat.puvvada 1.37         if (!inst)
117                             {
118                                 CMSetStatus(rc, CMPI_RC_ERR_INVALID_HANDLE);
119                                 return data;
120                             }
121                     
122 thilo.boehm    1.56         const SCMBUnion* value = 0;
123                             Boolean isArray = 0;
124                             Uint32 size = 0;
125                             CIMType type = (CIMType)0;
126                             const char* pName=0;
127                     
128                             SCMO_RC src = inst->getPropertyAt((Uint32)pos,
129                                                               &pName,
130                                                               type,
131                                                               &value,
132                                                               isArray,
133                                                               size);
134                             switch(src)
135                             {
136                                 case SCMO_OK:
137                                 {
138                                     CMPIType ct=type2CMPIType(type, isArray);
139 karl           1.59                 CMPISCMOUtilities::scmoValue2CMPIData(value, ct, &data, size);
140 thilo.boehm    1.56                 if ((ct&~CMPI_ARRAY) == CMPI_string)
141                                     {
142                                         // We always receive strings as an array of pointers
143                                         // with at least one element, which needs to be released
144                                         // after it was converted to CMPIData
145                                         free((void*)value);
146                                     }
147                                     break;
148                                 }
149                                 case SCMO_INDEX_OUT_OF_BOUND:
150                                 {
151                                     CMSetStatus(rc, CMPI_RC_ERR_NO_SUCH_PROPERTY);
152                                     CMPIData rdata={0,CMPI_nullValue|CMPI_notFound,{0}};
153                                     return rdata;
154                                 }
155                     
156                                 case SCMO_NULL_VALUE:
157                                 {
158                                     // A NullValue does not indicate an error, but simply that
159                                     // no value has been set for the property.
160                                     data.type = type2CMPIType(type, isArray);
161 thilo.boehm    1.56                 data.state = CMPI_nullValue;
162                                     data.value.uint64 = 0;
163                                     break;
164                                 }
165                     
166                                 default:
167                                 {
168                                     // Other return codes should not appear here, but are possible
169                                     // code wise (i.e. SCMO_NOT_FOUND etc.)
170                                     PEG_TRACE((
171                                         TRC_CMPIPROVIDERINTERFACE,
172                                         Tracer::LEVEL2,
173                                         "Unexpected RC from SCMOInstance.instGetPropertyAt: %d",
174                                         src));
175                                     CMSetStatus(rc, CMPI_RC_ERR_FAILED);
176                                     return data;
177                                 }
178                                 break;
179                             }
180 venkat.puvvada 1.37 
181                     
182 thilo.boehm    1.56         // Returning the property name as CMPI String
183 venkat.puvvada 1.37         if (name)
184                             {
185 thilo.boehm    1.56             *name=string2CMPIString(pName);
186 venkat.puvvada 1.37         }
187                     
188                             CMSetStatus(rc,CMPI_RC_OK);
189                             return data;
190                         }
191                     
192 kumpf          1.53     static CMPIData instGetProperty(const CMPIInstance* eInst,
193                             const char *name, CMPIStatus* rc)
194 venkat.puvvada 1.37     {
195 thilo.boehm    1.56         CMPIData data={0,CMPI_badValue,{0}};
196 venkat.puvvada 1.37 
197 thilo.boehm    1.56         SCMOInstance* inst=(SCMOInstance*)eInst->hdl;
198                             if (!inst)
199 venkat.puvvada 1.37         {
200                                 CMSetStatus(rc, CMPI_RC_ERR_INVALID_HANDLE);
201                                 return data;
202                             }
203 thilo.boehm    1.56 
204 venkat.puvvada 1.37         if (!name)
205                             {
206                                 CMSetStatus(rc, CMPI_RC_ERR_INVALID_PARAMETER);
207                                 return data;
208                             }
209                     
210 thilo.boehm    1.56         const SCMBUnion* value = 0;
211                             Boolean isArray = 0;
212                             Uint32 size = 0;
213                             CIMType type = (CIMType)0;
214                     
215                             SCMO_RC src = inst->getProperty(name, type, &value, isArray, size);
216                             if (src != SCMO_OK)
217                             {
218                                 switch(src)
219                                 {
220                                 case SCMO_NOT_FOUND:
221                                     {
222 venkat.puvvada 1.61                     data.state = CMPI_nullValue | CMPI_notFound;
223 thilo.boehm    1.56                     CMSetStatus(rc, CMPI_RC_ERR_NO_SUCH_PROPERTY);
224                                         return data;
225                                     }
226                                     break;
227                     
228                                 case SCMO_NULL_VALUE:
229                                     {
230                                         // A NullValue does not indicate an error, but simply that
231                                         // no value has been set for the property.
232 venkat.puvvada 1.61                     data.type = type2CMPIType(type, isArray);
233                                         data.value.uint64 = 0;
234                                         data.state = CMPI_nullValue;
235                                         CMSetStatus(rc, CMPI_RC_OK);
236 thilo.boehm    1.56                     return data;
237                                     }
238                                     break;
239                     
240                                 default:
241                                     {
242                                         PEG_TRACE((
243                                             TRC_CMPIPROVIDERINTERFACE,
244                                             Tracer::LEVEL1,
245                                             "Unexpected RC from SCMOInstance.instGetPropertyAt: %d",
246                                             src));
247                                         CMSetStatus(rc, CMPI_RC_ERR_FAILED);
248                                         return data;
249                                     }
250                                     break;
251                                 }
252                             }
253                             else
254 venkat.puvvada 1.37         {
255 thilo.boehm    1.56             CMPIType ct=type2CMPIType(type, isArray);
256                                 CMPISCMOUtilities::scmoValue2CMPIData(value, ct, &data, size);
257                                 if ((ct&~CMPI_ARRAY) == CMPI_string)
258                                 {
259                                     // We always receive strings as an array of pointers
260                                     // with at least one element, which needs to be released
261                                     // after it was converted to CMPIData
262                                     free((void*)value);
263                                 }
264 venkat.puvvada 1.37         }
265 thilo.boehm    1.56 
266                     
267                             CMSetStatus(rc,CMPI_RC_OK);
268 venkat.puvvada 1.37         return data;
269                         }
270                     
271                     
272 kumpf          1.53     static CMPICount instGetPropertyCount(const CMPIInstance* eInst,
273                             CMPIStatus* rc)
274 venkat.puvvada 1.37     {
275 thilo.boehm    1.56         SCMOInstance* inst=(SCMOInstance*)eInst->hdl;
276 venkat.puvvada 1.37         if (!inst)
277                             {
278                                 CMSetStatus(rc, CMPI_RC_ERR_INVALID_HANDLE);
279                                 return 0;
280                             }
281                             CMSetStatus(rc,CMPI_RC_OK);
282                             return inst->getPropertyCount();
283                         }
284                     
285 thilo.boehm    1.56     static CMPIStatus instSetPropertyWithOrigin(
286                             const CMPIInstance* eInst,
287                             const char* name,
288                             const CMPIValue* data,
289                             const CMPIType type,
290 venkat.puvvada 1.37         const char* origin)
291                         {
292 ms.aruran      1.39         PEG_METHOD_ENTER(
293                                 TRC_CMPIPROVIDERINTERFACE,
294                                 "CMPI_Instance:instSetPropertyWithOrigin()");
295 thilo.boehm    1.56 
296                             SCMOInstance *inst=(SCMOInstance*)eInst->hdl;
297 venkat.puvvada 1.37         if (!inst)
298                             {
299 ms.aruran      1.39             PEG_METHOD_EXIT();
300 venkat.puvvada 1.37             CMReturn(CMPI_RC_ERR_INVALID_HANDLE);
301                             }
302                     
303 thilo.boehm    1.56         CMPIStatus cmpiRC = {CMPI_RC_OK,0};
304                             SCMO_RC rc;
305                     
306                             if (!(type&CMPI_ARRAY))
307 venkat.puvvada 1.37         {
308 thilo.boehm    1.56             CIMType cimType=type2CIMType(type);
309 venkat.puvvada 1.60             Boolean nullValue =  false;
310                                 SCMBUnion scmoData = value2SCMOValue(data, type, nullValue);
311 venkat.puvvada 1.37 
312 thilo.boehm    1.56             rc = inst->setPropertyWithOrigin(name,
313                                                                  cimType,
314 venkat.puvvada 1.60                                              nullValue ? 0 : &scmoData,
315 thilo.boehm    1.56                                              false,  // isArray
316                                                                  0,      // arraySize
317                                                                  origin);
318                             }
319                             else
320                             {
321                                 //Get the type of the elements in the array
322                                 CMPIType aType=type&~CMPI_ARRAY;
323                                 CIMType cimType=type2CIMType(aType);
324 venkat.puvvada 1.37 
325 thilo.boehm    1.56             if( data == NULL || data->array == NULL )
326                                 {
327                                     // In this case just set a NULL Value
328                                     rc = inst->setPropertyWithOrigin(name,cimType,0,true,0,origin);
329                                 }
330                                 else
331 venkat.puvvada 1.37             {
332 thilo.boehm    1.56                 // When data is not NULL and data->array is also set
333                                     CMPI_Array* ar = (CMPI_Array*)data->array->hdl;
334                                     CMPIData* arrData = (CMPIData*)ar->hdl;
335                     
336                                     Uint32 arraySize = arrData->value.uint32;
337                     
338                                     // Convert the array of CMPIData to an array of SCMBUnion
339                                     SCMBUnion * scmbArray = 0;
340                                     SCMBUnion scmbArrayBuf[8];
341                                     if (arraySize > 8)
342 venkat.puvvada 1.38                 {
343 thilo.boehm    1.56                     scmbArray=(SCMBUnion *)malloc(arraySize*sizeof(SCMBUnion));
344 venkat.puvvada 1.38                 }
345                                     else
346 kumpf          1.53                 {
347 thilo.boehm    1.56                     scmbArray=&(scmbArrayBuf[0]);
348 venkat.puvvada 1.37                 }
349 venkat.puvvada 1.60                 Boolean nullValue = false;
350 thilo.boehm    1.56                 for (unsigned int x=0; x<arraySize; x++)
351 ms.aruran      1.39                 {
352 thilo.boehm    1.56                     // Note:  First element is the array status information,
353                                         //        therefore cmpi array starts at index 1!!!
354                                         scmbArray[x] = value2SCMOValue(
355                                             &(arrData[x+1].value),
356 venkat.puvvada 1.60                         arrData[x+1].type,
357                                             nullValue);
358 venkat.puvvada 1.37                 }
359 ms.aruran      1.39 
360 thilo.boehm    1.56                 rc = inst->setPropertyWithOrigin(
361                                         name,
362                                         cimType,
363                                         scmbArray,
364                                         true,          // isArray
365                                         arraySize,
366                                         origin);
367                                     if (arraySize > 8)
368 ms.aruran      1.39                 {
369 thilo.boehm    1.56                     free(scmbArray);
370 venkat.puvvada 1.37                 }
371                                 }
372                             }
373 thilo.boehm    1.56 
374                             if (rc != SCMO_OK)
375 venkat.puvvada 1.37         {
376 marek          1.43             PEG_TRACE((TRC_CMPIPROVIDERINTERFACE,Tracer::LEVEL3,
377 marek          1.62                 "Property %s not set on created instance. SCMO_RC=%d",
378                                     name,
379                                     rc));
380 thilo.boehm    1.56 
381                                 switch (rc)
382                                 {
383                                     case SCMO_NOT_SAME_ORIGIN:
384                                         cmpiRC.rc = CMPI_RC_ERR_INVALID_PARAMETER;
385                                         break;
386                                     case SCMO_NOT_FOUND:
387 marek          1.62                 {
388                                         // Logical would be to return an error here, but previous
389                                         // impl. returned OK since CMPI spec. is not specific about
390                                         // this. Should become CMPI_RC_ERR_NO_SUCH_PROPERTY in
391                                         // CMPI 2.1 or 3.0
392 thilo.boehm    1.56                     cmpiRC.rc = CMPI_RC_OK;
393 marek          1.62 
394                                         // Writing a message to log since provider tries to set a 
395                                         // non-existing property
396                                         Logger::put_l(
397                                             Logger::ERROR_LOG,
398                                             System::CIMSERVER,
399                                             Logger::WARNING,
400                                             MessageLoaderParms(
401                                                 "ProviderManager.CMPI.CMPI_Instance."
402 thilo.boehm    1.64                                 "NO_SUCH_PROPERTY",
403                                                 "Property $0 not set on the created instance of "
404 marek          1.62                                 "class $1",
405                                                 name,
406                                                 inst->getClassName()));
407 thilo.boehm    1.56                     break;
408 marek          1.62                 }
409 thilo.boehm    1.56                 case SCMO_WRONG_TYPE:
410                                     case SCMO_NOT_AN_ARRAY:
411                                     case SCMO_IS_AN_ARRAY:
412                                         cmpiRC.rc = CMPI_RC_ERR_INVALID_DATA_TYPE;
413                                         break;
414                                     default:
415                                         cmpiRC.rc = CMPI_RC_ERR_FAILED;
416                                         break;
417 venkat.puvvada 1.37         }
418 thilo.boehm    1.56         }
419                     
420 ms.aruran      1.39         PEG_METHOD_EXIT();
421 thilo.boehm    1.56         return(cmpiRC);
422 venkat.puvvada 1.37     }
423                     
424                         static CMPIStatus instSetProperty(const CMPIInstance* eInst,
425 kumpf          1.53         const char *name, const CMPIValue* data, CMPIType type)
426 venkat.puvvada 1.37     {
427                             return instSetPropertyWithOrigin(eInst, name, data, type, NULL);
428                         }
429                     
430                         static CMPIObjectPath* instGetObjectPath(const CMPIInstance* eInst,
431 kumpf          1.53         CMPIStatus* rc)
432 venkat.puvvada 1.37     {
433 ms.aruran      1.39         PEG_METHOD_ENTER(
434                                 TRC_CMPIPROVIDERINTERFACE,
435                                 "CMPI_Instance:instGetObjectPath()");
436 thilo.boehm    1.56 
437                             SCMOInstance* inst=(SCMOInstance*)eInst->hdl;
438 venkat.puvvada 1.37         if (!inst)
439                             {
440                                 CMSetStatus(rc, CMPI_RC_ERR_INVALID_HANDLE);
441 ms.aruran      1.39             PEG_METHOD_EXIT();
442 venkat.puvvada 1.37             return NULL;
443                             }
444 thilo.boehm    1.56 
445 venkat.puvvada 1.37         try
446                             {
447 thilo.boehm    1.56             // Generate keys from instance
448                                 inst->buildKeyBindingsFromProperties();
449 venkat.puvvada 1.54 
450 thilo.boehm    1.56             // Since we make no difference between ObjectPath and Instance,
451                                 // we simply clone using the ObjectPathOnly option.
452                                 SCMOInstance* cInst = new SCMOInstance(inst->clone(true));
453                     
454                                 CMPIObjectPath* cmpiObjPath =
455                                     reinterpret_cast<CMPIObjectPath *>
456                                     (new CMPI_Object(cInst,CMPI_Object::ObjectTypeObjectPath));
457 mreddy         1.35             CMSetStatus(rc,CMPI_RC_OK);
458 ms.aruran      1.39             PEG_METHOD_EXIT();
459 thilo.boehm    1.56             return cmpiObjPath;
460 venkat.puvvada 1.37         }
461                             catch (const PEGASUS_STD(bad_alloc)&)
462                             {
463                                 CMSetStatus(rc, CMPI_RC_ERROR_SYSTEM);
464 ms.aruran      1.39             PEG_METHOD_EXIT();
465 venkat.puvvada 1.37             return NULL;
466                             }
467                         }
468                     
469                         static CMPIStatus instSetObjectPath(
470 kumpf          1.53         CMPIInstance* eInst,
471 venkat.puvvada 1.37         const CMPIObjectPath *obj)
472                         {
473 ms.aruran      1.39         PEG_METHOD_ENTER(
474                                 TRC_CMPIPROVIDERINTERFACE,
475                                 "CMPI_Instance:instSetObjectPath()");
476 thilo.boehm    1.56 
477                             SCMOInstance* prevInst=(SCMOInstance*)eInst->hdl;
478                             if (prevInst==NULL)
479 venkat.puvvada 1.37         {
480 ms.aruran      1.39             PEG_METHOD_EXIT();
481 venkat.puvvada 1.37             CMReturn(CMPI_RC_ERR_INVALID_HANDLE);
482                             }
483                             if (obj==NULL)
484                             {
485 ms.aruran      1.39             PEG_METHOD_EXIT();
486 thilo.boehm    1.56             CMReturn(CMPI_RC_ERR_INVALID_PARAMETER);
487 venkat.puvvada 1.37         }
488                     
489 thilo.boehm    1.56         SCMOInstance* ref = (SCMOInstance*)(obj->hdl);
490                             if (ref->isSame(*prevInst))
491 venkat.puvvada 1.37         {
492 thilo.boehm    1.56             // Since we represent CMPIObjectPath as well as CMPIInstance
493                                 // through SCMOInstance, in this case both point to the same
494                                 // physical SCMB and the objectPath is already set.
495                                 // So this path is a nop.
496 ms.aruran      1.39             PEG_METHOD_EXIT();
497 thilo.boehm    1.56             CMReturn(CMPI_RC_OK);
498 venkat.puvvada 1.37         }
499 thilo.boehm    1.56         else
500 marek          1.43         {
501 thilo.boehm    1.56             // It is not possible to have an instance or objectPath in
502                                 // this implementation without a classname or namespace.
503                                 const char* nsRef = ref->getNameSpace();
504                                 Uint32 clsRefL;
505                                 const char* clsRef = ref->getClassName_l(clsRefL);
506                                 Uint32 clsPrevInstL;
507                                 const char* clsPrevInst = prevInst->getClassName_l(clsPrevInstL);
508                     
509                                 if (System::strncasecmp(clsRef,clsRefL,clsPrevInst,clsPrevInstL))
510                                 {
511                                     // Set the new namespace
512                                     prevInst->setNameSpace(nsRef);
513                     
514                                     // Remove the previous key properties
515                                     prevInst->clearKeyBindings();
516                     
517                                     // Copy the key properties from the given ObjectPath
518                                     CMPIrc rc = CMPISCMOUtilities::copySCMOKeyProperties(
519                                         ref,            // source
520                                         prevInst);      // target
521                                     if (rc != CMPI_RC_OK)
522 marek          1.43                 {
523 thilo.boehm    1.56                     PEG_TRACE_CSTRING(
524                                             TRC_CMPIPROVIDERINTERFACE,
525                                             Tracer::LEVEL1,
526                                             "Failed to copy key bindings");
527                                         PEG_METHOD_EXIT();
528                                         CMReturn(CMPI_RC_ERR_FAILED);
529 marek          1.43                 }
530                                 }
531 thilo.boehm    1.56             else
532 marek          1.43             {
533 thilo.boehm    1.56                 // Uurrgh, changing class on an existing
534                                     // CMPIInstance is a prohibited change.
535                                     // Simply returning an error
536                                     PEG_TRACE_CSTRING(
537                                         TRC_CMPIPROVIDERINTERFACE,
538                                         Tracer::LEVEL1,
539                                         "Cannot set objectpath because it would change classname"
540                                         "or namespace of instance");
541                                     PEG_METHOD_EXIT();
542                                     CMReturnWithString(
543                                         CMPI_RC_ERR_FAILED,
544                                         string2CMPIString("Incompatible ObjectPath"));
545 marek          1.43             }
546                             }
547 thilo.boehm    1.56 
548                             PEG_METHOD_EXIT();
549                             CMReturn(CMPI_RC_OK);
550 marek          1.43     }
551                     
552 thilo.boehm    1.56 
553 venkat.puvvada 1.37     static CMPIStatus instSetPropertyFilter(CMPIInstance* eInst,
554                             const char** propertyList, const char **keys)
555                         {
556 venkat.puvvada 1.58         PEG_METHOD_ENTER(
557                                 TRC_CMPIPROVIDERINTERFACE,
558                                 "CMPI_Instance:instSetPropertyFilter()");
559                     
560                             SCMOInstance* inst=(SCMOInstance*)eInst->hdl;
561                     
562                             PEG_METHOD_EXIT();
563                             if (inst==NULL)
564                             {
565                                 CMReturn(CMPI_RC_ERR_INVALID_HANDLE);
566                             }
567 anusha.kandepu 1.57         //Property filtering is done by the CIMOM infrastructure.
568 venkat.puvvada 1.37         CMReturn(CMPI_RC_OK);
569                         }
570                     
571                         static CMPIStatus instSetPropertyFilterIgnore(CMPIInstance* eInst,
572                             const char** propertyList, const char **keys)
573                         {
574                             /* We ignore it.  */
575                             CMReturn ( CMPI_RC_OK);
576                         }
577 schuur         1.1  
578 dave.sudlik    1.31 
579 schuur         1.1  }
580                     
581                     static CMPIInstanceFT instance_FT={
582 venkat.puvvada 1.37     CMPICurrentVersion,
583                         instRelease,
584                         instClone,
585                         instGetProperty,
586                         instGetPropertyAt,
587                         instGetPropertyCount,
588                         instSetProperty,
589                         instGetObjectPath,
590                         instSetPropertyFilter,
591 konrad.r       1.19 #if defined(CMPI_VER_100)
592 venkat.puvvada 1.37     instSetObjectPath,
593 konrad.r       1.19 #endif
594 dave.sudlik    1.31 #if defined(CMPI_VER_200)
595 venkat.puvvada 1.37     instSetPropertyWithOrigin,
596 dave.sudlik    1.31 #endif
597 schuur         1.1  };
598                     
599                     static CMPIInstanceFT instanceOnStack_FT={
600 venkat.puvvada 1.37     CMPICurrentVersion,
601                         instReleaseNop,
602                         instClone,
603                         instGetProperty,
604                         instGetPropertyAt,
605                         instGetPropertyCount,
606                         instSetProperty,
607                         instGetObjectPath,
608                         instSetPropertyFilterIgnore,
609 konrad.r       1.19 #if defined(CMPI_VER_100)
610 venkat.puvvada 1.37     instSetObjectPath,
611 konrad.r       1.19 #endif
612 dave.sudlik    1.31 #if defined(CMPI_VER_200)
613 venkat.puvvada 1.37     instSetPropertyWithOrigin,
614 dave.sudlik    1.31 #endif
615 schuur         1.1  };
616                     
617                     CMPIInstanceFT *CMPI_Instance_Ftab=&instance_FT;
618                     CMPIInstanceFT *CMPI_InstanceOnStack_Ftab=&instanceOnStack_FT;
619                     
620                     
621 thilo.boehm    1.56 CMPI_InstanceOnStack::CMPI_InstanceOnStack(const SCMOInstance* ci)
622 venkat.puvvada 1.37 {
623 ms.aruran      1.39     PEG_METHOD_ENTER(
624                             TRC_CMPIPROVIDERINTERFACE,
625                             "CMPI_InstanceOnStack::CMPI_InstanceOnStack()");
626                     
627 thilo.boehm    1.56     hdl=(void*)ci;
628 venkat.puvvada 1.37     ft=CMPI_InstanceOnStack_Ftab;
629 ms.aruran      1.39     PEG_METHOD_EXIT();
630 venkat.puvvada 1.37 }
631 schuur         1.1  
632 thilo.boehm    1.56 CMPI_InstanceOnStack::CMPI_InstanceOnStack(const SCMOInstance& ci)
633                     {
634                         PEG_METHOD_ENTER(
635                             TRC_CMPIPROVIDERINTERFACE,
636                             "CMPI_InstanceOnStack::CMPI_InstanceOnStack()");
637                     
638                         hdl=(void*) new SCMOInstance(ci);
639                         ft=CMPI_InstanceOnStack_Ftab;
640                         PEG_METHOD_EXIT();
641                     }
642                     
643                     CMPI_InstanceOnStack::~CMPI_InstanceOnStack()
644                     {
645                         if (hdl)
646                         {
647                             delete((SCMOInstance*)hdl);
648                         }
649                     }
650                     
651 schuur         1.1  
652                     PEGASUS_NAMESPACE_END
653 kumpf          1.53 

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2