(file) Return to ObjectNormalizer.cpp CVS log (file) (dir) Up to [Pegasus] / pegasus / src / Pegasus / Common

  1 karl  1.31 //%2006////////////////////////////////////////////////////////////////////////
  2 chip  1.1  //
  3 karl  1.16 // Copyright (c) 2000, 2001, 2002 BMC Software; Hewlett-Packard Development
  4            // Company, L.P.; IBM Corp.; The Open Group; Tivoli Systems.
  5            // Copyright (c) 2003 BMC Software; Hewlett-Packard Development Company, L.P.;
  6 chip  1.1  // IBM Corp.; EMC Corporation, The Open Group.
  7 karl  1.16 // Copyright (c) 2004 BMC Software; Hewlett-Packard Development Company, L.P.;
  8            // IBM Corp.; EMC Corporation; VERITAS Software Corporation; The Open Group.
  9 karl  1.21 // Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.;
 10            // EMC Corporation; VERITAS Software Corporation; The Open Group.
 11 karl  1.31 // Copyright (c) 2006 Hewlett-Packard Development Company, L.P.; IBM Corp.;
 12            // EMC Corporation; Symantec Corporation; The Open Group.
 13 chip  1.1  //
 14            // Permission is hereby granted, free of charge, to any person obtaining a copy
 15            // of this software and associated documentation files (the "Software"), to
 16            // deal in the Software without restriction, including without limitation the
 17            // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
 18            // sell copies of the Software, and to permit persons to whom the Software is
 19            // furnished to do so, subject to the following conditions:
 20 karl  1.31 // 
 21 chip  1.1  // THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
 22            // ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED
 23            // "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
 24            // LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
 25            // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
 26            // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
 27            // ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
 28            // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 29            //
 30            //==============================================================================
 31            //
 32            // Author: Chip Vincent (cvincent@us.ibm.com)
 33            //
 34 chip  1.17 // Modified By:
 35 chip  1.1  //
 36            //%/////////////////////////////////////////////////////////////////////////////
 37            
 38            #include <Pegasus/Common/ObjectNormalizer.h>
 39 a.dunfey 1.32 #include <Pegasus/Common/ArrayInternal.h>
 40 chip     1.1  
 41               PEGASUS_NAMESPACE_BEGIN
 42               
 43 a.dunfey 1.32 CIMQualifier _processQualifier(
 44 chip     1.26     CIMConstQualifier & referenceQualifier,
 45                   CIMConstQualifier & cimQualifier)
 46 chip     1.1  {
 47 chip     1.17     // check name
 48                   if(!referenceQualifier.getName().equal(cimQualifier.getName()))
 49                   {
 50 chip     1.22         MessageLoaderParms message(
 51                           "Common.ObjectNormalizer.INVALID_QUALIFIER_NAME",
 52 chip     1.23             "Invalid qualifier name: $0",
 53 chip     1.22             cimQualifier.getName().getString());
 54 chip     1.17 
 55                       throw CIMException(CIM_ERR_FAILED, message);
 56                   }
 57 chip     1.15 
 58                   // check type
 59                   if(referenceQualifier.getType() != cimQualifier.getType())
 60                   {
 61 chip     1.22         MessageLoaderParms message(
 62                           "Common.ObjectNormalizer.INVALID_QUALIFIER_TYPE",
 63 chip     1.23             "Invalid qualifier type: $0",
 64 chip     1.22             cimQualifier.getName().getString());
 65 chip     1.15 
 66 chip     1.17         throw CIMException(CIM_ERR_FAILED, message);
 67 chip     1.15     }
 68 chip     1.1  
 69 chip     1.17     CIMQualifier normalizedQualifier(
 70                       referenceQualifier.getName(),
 71                       referenceQualifier.getValue(),  // default value
 72                       referenceQualifier.getFlavor(),
 73                       referenceQualifier.getPropagated() == 0 ? false : true);
 74 chip     1.1  
 75 chip     1.26     // TODO: check override
 76               
 77 chip     1.17     // update value
 78                   if(!cimQualifier.getValue().isNull())
 79 chip     1.1      {
 80 chip     1.17         normalizedQualifier.setValue(cimQualifier.getValue());
 81 chip     1.1      }
 82               
 83 chip     1.17     return(normalizedQualifier);
 84 chip     1.1  }
 85               
 86 a.dunfey 1.32 CIMProperty ObjectNormalizer::_processProperty(
 87 chip     1.26     CIMConstProperty & referenceProperty,
 88 a.dunfey 1.32     CIMConstProperty & instProperty,
 89 chip     1.26     Boolean includeQualifiers,
 90 a.dunfey 1.32     Boolean includeClassOrigin,
 91                   NormalizerContext * context,
 92                   const CIMNamespaceName & nameSpace)
 93 chip     1.1  {
 94 chip     1.17     // check name
 95 a.dunfey 1.32     if(!referenceProperty.getName().equal(instProperty.getName()))
 96 chip     1.17     {
 97 chip     1.22         MessageLoaderParms message(
 98                           "Common.ObjectNormalizer.INVALID_PROPERTY_NAME",
 99 chip     1.23             "Invalid property name: $0",
100 a.dunfey 1.32             instProperty.getName().getString());
101 chip     1.17 
102                       throw CIMException(CIM_ERR_FAILED, message);
103                   }
104 chip     1.1  
105 chip     1.15     // check type
106 a.dunfey 1.32     CIMType referencePropType = referenceProperty.getType();
107                   CIMType instPropType = instProperty.getType();
108                   if(referencePropType != instPropType)
109                   {
110               #ifdef PEGASUS_EMBEDDED_INSTANCE_SUPPORT
111                       // CMPI Providers cannot return a CIMTYPE_INSTANCE, so if the
112                       // referenceProperty type is CIMTYPE_INSTANCE and the instProperty
113                       // type is CIMTYPE_OBJECT, ignore the mismatch. The Normalizer
114                       // will correct it.
115                       if(referencePropType != CIMTYPE_INSTANCE ||
116                           instPropType != CIMTYPE_OBJECT)
117               #endif // PEGASUS_EMBEDDED_INSTANCE_SUPPORT
118                       {
119                           MessageLoaderParms message(
120                               "Common.ObjectNormalizer.INVALID_PROPERTY_TYPE",
121                               "Invalid property type: $0",
122                               instProperty.getName().getString());
123 chip     1.15 
124 a.dunfey 1.32             throw CIMException(CIM_ERR_FAILED, message);
125                       }
126 chip     1.15     }
127               
128 chip     1.17     // TODO: check array size?
129               
130                   CIMProperty normalizedProperty(
131                       referenceProperty.getName(),
132                       referenceProperty.getValue(),   // default value
133                       referenceProperty.getArraySize(),
134                       referenceProperty.getReferenceClassName(),
135                       CIMName(),
136                       false);
137 chip     1.1  
138                   // TODO: check override (especially for references)?
139               
140 chip     1.14     // update value
141 a.dunfey 1.32     if(!instProperty.getValue().isNull())
142 chip     1.17     {
143 a.dunfey 1.32 #ifdef PEGASUS_EMBEDDED_INSTANCE_SUPPORT
144                       // This happens ONLY when the referencePropType is CIMTYPE_INSTANCE
145                       // and the cimPropType is CIMTYPE_OBJECT, otherwise an exception
146                       // would have been thrown. Correct the mismatch here.
147                       if(referencePropType != instPropType)
148                       {
149                           CIMObject tmpObject;
150                           instProperty.getValue().get(tmpObject);
151                           normalizedProperty.setValue(CIMInstance(tmpObject));
152                       }
153                       else
154               #endif // PEGASUS_EMBEDDED_INSTANCE_SUPPORT
155                       {
156                           normalizedProperty.setValue(instProperty.getValue());
157                       }
158 chip     1.17     }
159 chip     1.6  
160 chip     1.17     // update class origin
161 chip     1.1      if(includeClassOrigin)
162                   {
163 chip     1.17         normalizedProperty.setClassOrigin(referenceProperty.getClassOrigin());
164 chip     1.1      }
165               
166                   // add qualifiers
167                   if(includeQualifiers)
168                   {
169 chip     1.17         // propagate class property qualifiers
170 chip     1.26         for(Uint32 i = 0, n = referenceProperty.getQualifierCount(); i < n; i++)
171 chip     1.1          {
172 chip     1.17             CIMConstQualifier referenceQualifier = referenceProperty.getQualifier(i);
173 chip     1.1  
174 a.dunfey 1.32             Uint32 pos = instProperty.findQualifier(referenceQualifier.getName());
175 chip     1.1  
176 chip     1.26             // update value if qualifier is present in the specified property
177                           if(pos != PEG_NOT_FOUND)
178                           {
179 a.dunfey 1.32                 CIMConstQualifier cimQualifier = instProperty.getQualifier(pos);
180 chip     1.14 
181 chip     1.26                 CIMQualifier normalizedQualifier =
182                                   _processQualifier(
183                                       referenceQualifier,
184                                       cimQualifier);
185 chip     1.14 
186 chip     1.26                 normalizedProperty.addQualifier(normalizedQualifier);
187 chip     1.14             }
188                           else
189                           {
190 chip     1.26                 normalizedProperty.addQualifier(referenceQualifier.clone());
191 chip     1.1              }
192                       }
193                   }
194 a.dunfey 1.32 #ifdef PEGASUS_EMBEDDED_INSTANCE_SUPPORT
195               #ifdef PEGASUS_SNIA_INTEROP_COMPATIBILITY
196                   else if(referenceProperty.getType() == CIMTYPE_INSTANCE)
197                   {
198                       Uin32 refPos = referenceProperty.findQualifier("EmbeddedInstance");
199                       Uin32 cimPos = instProperty.findQualifier("EmbeddedInstance");
200                       if(refPos != PEG_NOT_FOUND && cimPos == PEG_NOT_FOUND)
201                       {
202                           instProperty.addQualifier(refProperty.getQualifier(pos));
203                       }
204                   }
205               #endif
206               
207                   // Check the type of the embedded instance against the class specified by
208                   // the EmbeddedInstance qualifier. We can only do this if the context
209                   // is non-zero.
210                   if(context != 0)
211                   {
212                       if(referenceProperty.getType() == CIMTYPE_INSTANCE)
213                       {
214                           Uint32 pos = referenceProperty.findQualifier("EmbeddedInstance");
215 a.dunfey 1.32 
216                           PEGASUS_ASSERT(pos != PEG_NOT_FOUND);
217               
218                           String qualClassStr;
219                           referenceProperty.getQualifier(pos).getValue().get(
220                               qualClassStr);
221                           CIMName embedInstClassName(qualClassStr);
222                           Array<CIMName> embeddedInstSubclasses =
223                               context->enumerateClassNames(nameSpace, embedInstClassName,
224                                   true);
225                           embeddedInstSubclasses.append(embedInstClassName);
226               
227                           Array<CIMInstance> embeddedInstances;
228                           if(referenceProperty.isArray())
229                           {
230                               instProperty.getValue().get(embeddedInstances);
231                           }
232                           else
233                           {
234                               CIMInstance embeddedInst;
235                               instProperty.getValue().get(embeddedInst);
236 a.dunfey 1.32                 embeddedInstances.append(embeddedInst);
237                           }
238               
239                           Array<CIMClass> embeddedClassDefs;
240                           for(Uint32 i = 0, n = embeddedInstances.size(); i < n; ++i)
241                           {
242                               CIMInstance & currentInstance = embeddedInstances[i];
243                               CIMName currentClassName = currentInstance.getClassName();
244                               if(Contains(embeddedInstSubclasses, currentClassName))
245                               {
246                                   CIMClass embeddedClassDef;
247                                   bool found = false;
248                                   for(Uint32 j = 0, m = embeddedClassDefs.size(); j < m;
249                                       ++j)
250                                   {
251                                       CIMClass & tmpClassDef = embeddedClassDefs[j];
252                                       if(tmpClassDef.getClassName() == currentClassName)
253                                       {
254                                           embeddedClassDef = tmpClassDef;
255                                           found = true;
256                                       }
257 a.dunfey 1.32                     }
258               
259                                   if(!found)
260                                   {
261                                       embeddedClassDef = context->getClass(nameSpace,
262                                           currentClassName);
263                                       embeddedClassDefs.append(embeddedClassDef);
264                                   }
265               
266 gs.keenan 1.33                     AutoPtr<NormalizerContext> tmpContext(context->clone().release());
267 a.dunfey  1.32                     ObjectNormalizer tmpNormalizer(embeddedClassDef,
268                                        includeQualifiers, includeClassOrigin, nameSpace,
269                                        tmpContext);
270                                    if(currentInstance.getPath().getKeyBindings().size()==0)
271                                    {
272                                        currentInstance.setPath(
273                                            currentInstance.buildPath(embeddedClassDef));
274                                    }
275                                    embeddedInstances[i] = tmpNormalizer.processInstance(currentInstance);
276                                }
277                                else
278                                {
279                                    MessageLoaderParms message(
280                                        "Common.ObjectNormalizer.INVALID_EMBEDDED_INSTANCE_TYPE",
281                                        "Found embedded instance of type $0: was expecting $1 for property $2",
282                                        currentClassName.getString(),
283                                        qualClassStr,
284                                        instProperty.getName().getString());
285                
286                                    throw CIMException(CIM_ERR_FAILED, message);
287                                }
288 a.dunfey  1.32             }
289                
290                            if(referenceProperty.isArray())
291                            {
292                              normalizedProperty.setValue(CIMValue(embeddedInstances));
293                            }
294                            else
295                            {
296                              normalizedProperty.setValue(CIMValue(embeddedInstances[0]));
297                            }
298                        }
299                    }
300                #endif // PEGASUS_EMBEDDED_INSTANCE_SUPPORT
301 chip      1.1  
302 chip      1.17     return(normalizedProperty);
303 chip      1.1  }
304                
305 chip      1.20 ObjectNormalizer::ObjectNormalizer(void)
306 chip      1.24     : _includeQualifiers(false),
307 a.dunfey  1.32     _includeClassOrigin(false),
308                    _context(0)
309 chip      1.20 {
310                }
311                
312 chip      1.17 ObjectNormalizer::ObjectNormalizer(
313                    const CIMClass & cimClass,
314 chip      1.26     Boolean includeQualifiers,
315 a.dunfey  1.32     Boolean includeClassOrigin,
316                    const CIMNamespaceName & nameSpace,
317                    AutoPtr<NormalizerContext> & context)
318                  : _cimClass(cimClass),
319 chip      1.17     _includeQualifiers(includeQualifiers),
320 a.dunfey  1.32     _includeClassOrigin(includeClassOrigin),
321                    _context(context),
322                    _nameSpace(nameSpace)
323 chip      1.1  {
324 chip      1.26     if(!_cimClass.isUninitialized())
325                    {
326                        // ATTN: the following code is intended to expedite normalizing instances and instance object
327                        // paths by establishing the keys once now rather than multiple times later. it is biased
328                        // toward providers that return many instances with many properties.
329                
330                        // build a reference object path within the class
331                        Array<CIMKeyBinding> keys;
332                
333                        for(Uint32 i = 0, n = _cimClass.getPropertyCount(); i < n; i++)
334                        {
335                            CIMConstProperty referenceProperty = _cimClass.getProperty(i);
336                
337                            Uint32 pos = referenceProperty.findQualifier("key");
338                
339                            if((pos != PEG_NOT_FOUND) && (referenceProperty.getQualifier(pos).getValue().equal(CIMValue(true))))
340                            {
341 chip      1.30                 if(referenceProperty.getType() == CIMTYPE_REFERENCE)
342                                {
343                                    // ATTN: a fake reference is inserted in the key so that the _BubbleSort() method
344                                    // in CIMObjectPath does not throw and exception. It implicitly validates keys of
345                                    // type REFERENCE so just place a dummy value for now. The value will be replaced
346                                    // by the normalized object later.
347                                    keys.append(CIMKeyBinding(referenceProperty.getName(), "class.key=\"value\"", CIMKeyBinding::REFERENCE));
348                                }
349                                else
350                                {
351                                    keys.append(CIMKeyBinding(referenceProperty.getName(), referenceProperty.getValue()));
352                                }
353 chip      1.26             }
354                        }
355                
356                        // update class object path
357                        CIMObjectPath cimObjectPath(_cimClass.getPath());
358                
359                        cimObjectPath.setKeyBindings(keys);
360                
361                        _cimClass.setPath(cimObjectPath);
362                    }
363 chip      1.1  }
364                
365 chip      1.17 CIMObjectPath ObjectNormalizer::processClassObjectPath(const CIMObjectPath & cimObjectPath) const
366 chip      1.1  {
367 chip      1.17     // pre-check
368                    if(_cimClass.isUninitialized())
369                    {
370                        // do nothing
371                        return(cimObjectPath);
372                    }
373 chip      1.1  
374 chip      1.29     /*
375                    // ATTN: moving similar logic to the response handlers because this type of error should
376                    // be checked regardless with or without normalization enabled.
377 chip      1.17     if(cimObjectPath.getClassName().isNull())
378                    {
379                        throw CIMException(CIM_ERR_FAILED, "uninitialized object path");
380                    }
381 chip      1.29     */
382 chip      1.1  
383 chip      1.22     /*
384                    // ATTN: The following code is currently redundant because the CIMName object validates
385                    // legal names when it is constructed. It is included here for completeness.
386 chip      1.17     // check class name
387 chip      1.22     if(!CIMName(cimObjectPath.getClassName()).legal())
388                    {
389                        MessageLoaderParms message(
390                            "Common.ObjectNormalizer.INVALID_CLASS_NAME",
391 chip      1.23             "Invalid class name: $0",
392 chip      1.22             cimObjectPath.getClassName().getString());
393                
394                        throw CIMException(CIM_ERR_FAILED, message);
395                    }
396                    */
397                
398                    // check class type
399 chip      1.17     if(!_cimClass.getClassName().equal(cimObjectPath.getClassName()))
400 chip      1.1      {
401 chip      1.22         MessageLoaderParms message(
402                            "Common.ObjectNormalizer.INVALID_CLASS_TYPE",
403 chip      1.23             "Invalid class type: $0",
404 chip      1.22             cimObjectPath.getClassName().getString());
405 chip      1.1  
406 chip      1.17         throw CIMException(CIM_ERR_FAILED, message);
407                    }
408 chip      1.1  
409 chip      1.17     CIMObjectPath normalizedObjectPath(
410                        _cimClass.getPath().getHost(),
411                        _cimClass.getPath().getNameSpace(),
412 chip      1.26         _cimClass.getClassName());
413 chip      1.1  
414 chip      1.17     // ignore any keys, they are not part of a class object path
415 chip      1.6  
416 chip      1.17     return(normalizedObjectPath);
417                }
418 chip      1.1  
419 chip      1.17 CIMObjectPath ObjectNormalizer::processInstanceObjectPath(const CIMObjectPath & cimObjectPath) const
420                {
421                    // pre-check
422                    if(_cimClass.isUninitialized())
423                    {
424                        // do nothing
425                        return(cimObjectPath);
426                    }
427 chip      1.14 
428 chip      1.29     /*
429                    // ATTN: moving similar logic to the response handlers because this type of error should
430                    // be checked regardless with or without normalization enabled.
431 chip      1.17     if(cimObjectPath.getClassName().isNull())
432                    {
433                        throw CIMException(CIM_ERR_FAILED, "uninitialized object path");
434 chip      1.1      }
435 chip      1.29     */
436 chip      1.1  
437 chip      1.22     /*
438                    // ATTN: The following code is currently redundant because the CIMName object validates
439                    // legal names when it is constructed. It is included here for completeness.
440 chip      1.17     // check class name
441 chip      1.22     if(!CIMName(cimObjectPath.getClassName()).legal())
442                    {
443                        MessageLoaderParms message(
444                            "Common.ObjectNormalizer.INVALID_CLASS_NAME",
445 chip      1.23             "Invalid class name: $0",
446 chip      1.22             cimObjectPath.getClassName().getString());
447                
448                        throw CIMException(CIM_ERR_FAILED, message);
449                    }
450                    */
451                
452                    // check class type
453 chip      1.17     if(!_cimClass.getClassName().equal(cimObjectPath.getClassName()))
454 chip      1.1      {
455 chip      1.22         MessageLoaderParms message(
456                            "Common.ObjectNormalizer.INVALID_CLASS_TYPE",
457 chip      1.23             "Invalid class type: $0",
458 chip      1.22             cimObjectPath.getClassName().getString());
459 chip      1.1  
460 chip      1.17         throw CIMException(CIM_ERR_FAILED, message);
461                    }
462 chip      1.1  
463 chip      1.17     CIMObjectPath normalizedObjectPath(
464                        _cimClass.getPath().getHost(),
465                        _cimClass.getPath().getNameSpace(),
466 chip      1.26         _cimClass.getClassName());
467                
468                    Array<CIMKeyBinding> normalizedKeys;
469 chip      1.1  
470 chip      1.26     Array<CIMKeyBinding> referenceKeys = _cimClass.getPath().getKeyBindings();
471                    Array<CIMKeyBinding> cimKeys = cimObjectPath.getKeyBindings();
472 chip      1.1  
473 chip      1.26     for(Uint32 i = 0, n = referenceKeys.size(); i < n; i++)
474 chip      1.1      {
475 chip      1.26         CIMKeyBinding key;
476 chip      1.17 
477 chip      1.26         // override the value from the specified object
478                        for(Uint32 j = 0, m = cimKeys.size(); j < m; j++)
479 chip      1.17         {
480 chip      1.26             if(referenceKeys[i].getName().equal(cimKeys[j].getName()))
481 chip      1.17             {
482 chip      1.26                 // check type
483                                if(referenceKeys[i].getType() != cimKeys[j].getType())
484 chip      1.22                 {
485                                    MessageLoaderParms message(
486 chip      1.26                         "Common.ObjectNormalizer.INVALID_KEY_TYPE",
487                                        "Invalid key type: $0",
488                                        referenceKeys[i].getName().getString());
489 chip      1.22 
490                                    throw CIMException(CIM_ERR_FAILED, message);
491                                }
492                
493 chip      1.28                 key = CIMKeyBinding(referenceKeys[i].getName(), cimKeys[j].getValue(), referenceKeys[i].getType());
494 chip      1.26 
495 chip      1.17                 break;
496                            }
497 chip      1.26         }
498 chip      1.1  
499 chip      1.26         // key not found
500                        if(key.getName().isNull())
501                        {
502                            MessageLoaderParms message(
503                                "Common.ObjectNormalizer.MISSING_KEY",
504                                "Missing key: $0",
505                                referenceKeys[i].getName().getString());
506                
507                            throw CIMException(CIM_ERR_FAILED, message);
508 chip      1.1          }
509 chip      1.26 
510                        normalizedKeys.append(key);
511 chip      1.1      }
512                
513 chip      1.26     normalizedObjectPath.setKeyBindings(normalizedKeys);
514 chip      1.17 
515                    return(normalizedObjectPath);
516                }
517                
518                CIMInstance ObjectNormalizer::processInstance(const CIMInstance & cimInstance) const
519                {
520                    // pre-checks
521                    if(_cimClass.isUninitialized())
522 chip      1.1      {
523 chip      1.17         // do nothing
524                        return(cimInstance);
525                    }
526 chip      1.1  
527 chip      1.29     /*
528                    // ATTN: moving similar logic to the response handlers because this type of error should
529                    // be checked regardless with or without normalization enabled.
530 chip      1.17     if(cimInstance.isUninitialized())
531                    {
532                        throw CIMException(CIM_ERR_FAILED, "unintialized instance object.");
533 chip      1.1      }
534 chip      1.29     */
535 chip      1.1  
536 chip      1.26     CIMInstance normalizedInstance(_cimClass.getClassName());
537 chip      1.22 
538 chip      1.26     // proces object path
539                    normalizedInstance.setPath(processInstanceObjectPath(cimInstance.getPath()));
540 chip      1.1  
541 chip      1.17     // process instance qualifiers
542                    if(_includeQualifiers)
543 chip      1.1      {
544 chip      1.17         // propagate class qualifiers
545                        for(Uint32 i = 0, n = _cimClass.getQualifierCount(); i < n; i++)
546 chip      1.1          {
547 chip      1.17             CIMConstQualifier referenceQualifier = _cimClass.getQualifier(i);
548 chip      1.1  
549 chip      1.26             Uint32 pos = cimInstance.findQualifier(referenceQualifier.getName());
550 chip      1.1  
551 chip      1.26             // update value if qualifier is present in the specified property
552                            if(pos != PEG_NOT_FOUND)
553 chip      1.1              {
554 chip      1.26                 CIMConstQualifier cimQualifier = cimInstance.getQualifier(pos);
555 chip      1.12 
556 chip      1.26                 CIMQualifier normalizedQualifier =
557                                    _processQualifier(
558                                        referenceQualifier,
559                                        cimQualifier);
560 chip      1.12 
561 chip      1.26                 normalizedInstance.addQualifier(normalizedQualifier);
562 chip      1.1              }
563 chip      1.12             else
564                            {
565 chip      1.26                 normalizedInstance.addQualifier(referenceQualifier.clone());
566 chip      1.12             }
567 chip      1.1          }
568                    }
569                
570 chip      1.26     // check property names and types. any properties in the class but not in the instance
571                    // are implicitly dropped.
572                    for(Uint32 i = 0, n = _cimClass.getPropertyCount(); i < n; i++)
573 chip      1.1      {
574 chip      1.26         CIMConstProperty referenceProperty = _cimClass.getProperty(i);
575 chip      1.6  
576 chip      1.26         Uint32 pos = cimInstance.findProperty(referenceProperty.getName());
577 chip      1.1  
578 chip      1.17         if(pos != PEG_NOT_FOUND)
579 chip      1.1          {
580 chip      1.26             CIMConstProperty cimProperty = cimInstance.getProperty(pos);
581 chip      1.1  
582 chip      1.24             CIMProperty normalizedProperty =
583                                _processProperty(
584 chip      1.26                     referenceProperty,
585                                    cimProperty,
586 chip      1.24                     _includeQualifiers,
587 a.dunfey  1.32                     _includeClassOrigin,
588                                    _context.get(),
589                                    _nameSpace);
590 chip      1.1  
591 chip      1.24             normalizedInstance.addProperty(normalizedProperty);
592 chip      1.9          }
593 chip      1.1      }
594                
595 chip      1.17     return(normalizedInstance);
596 chip      1.1  }
597                
598                PEGASUS_NAMESPACE_END

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2