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

   1 karl  1.157 //%2006////////////////////////////////////////////////////////////////////////
   2 mike  1.48  //
   3 karl  1.129 // 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 karl  1.100 // IBM Corp.; EMC Corporation, The Open Group.
   7 karl  1.129 // 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.132 // Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.;
  10             // EMC Corporation; VERITAS Software Corporation; The Open Group.
  11 karl  1.157 // Copyright (c) 2006 Hewlett-Packard Development Company, L.P.; IBM Corp.;
  12             // EMC Corporation; Symantec Corporation; The Open Group.
  13 mike  1.48  //
  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.177 //
  21 mike  1.48  // 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             //%/////////////////////////////////////////////////////////////////////////////
  33             
  34 mike  1.51  #include <Pegasus/Common/Config.h>
  35 mike  1.48  #include <cctype>
  36             #include <cstdio>
  37             #include <fstream>
  38 kumpf 1.82  #include <Pegasus/Common/InternalException.h>
  39 schuur 1.114 
  40 mike   1.48  #include <Pegasus/Common/DeclContext.h>
  41 kumpf  1.76  #include <Pegasus/Common/Resolver.h>
  42 mike   1.48  #include <Pegasus/Common/System.h>
  43 kumpf  1.52  #include <Pegasus/Common/Tracer.h>
  44 kumpf  1.63  #include <Pegasus/Common/PegasusVersion.h>
  45 kumpf  1.169 #include <Pegasus/Common/MessageLoader.h>
  46 mike   1.159 #include <Pegasus/Common/ReadWriteSem.h>
  47 kumpf  1.63  
  48 schuur 1.114 #include <Pegasus/Common/XmlStreamer.h>
  49              #include <Pegasus/Common/BinaryStreamer.h>
  50              #include <Pegasus/Common/AutoStreamer.h>
  51              
  52 mike   1.48  #include "CIMRepository.h"
  53              #include "RepositoryDeclContext.h"
  54 mike   1.151 #include "ObjectCache.h"
  55 mike   1.48  
  56 kumpf  1.201 #include "PersistentStore.h"
  57 jim.wunderlich 1.136 
  58 schuur         1.112 #if 0
  59                      #undef PEG_METHOD_ENTER
  60                      #undef PEG_METHOD_EXIT
  61                      #define PEG_METHOD_ENTER(x,y)  cout<<"--- Enter: "<<y<<endl;
  62                      #define PEG_METHOD_EXIT()
  63                      #endif
  64                      
  65 jim.wunderlich 1.138 
  66 kumpf          1.204 //==============================================================================
  67                      //
  68                      // The class cache caches up PEGASUS_CLASS_CACHE_SIZE fully resolved class
  69                      // definitions in memory.  To override the default, define
  70                      // PEGASUS_CLASS_CACHE_SIZE in your build environment.  To suppress the cache
  71                      // (and not compile it in at all), set PEGASUS_CLASS_CACHE_SIZE to 0.
  72                      //
  73                      //==============================================================================
  74                      
  75                      #if !defined(PEGASUS_CLASS_CACHE_SIZE)
  76                      # define PEGASUS_CLASS_CACHE_SIZE 8
  77                      #endif
  78                      
  79                      #if (PEGASUS_CLASS_CACHE_SIZE != 0)
  80                      # define PEGASUS_USE_CLASS_CACHE
  81                      #endif
  82                      
  83                      #define PEGASUS_QUALIFIER_CACHE_SIZE 80
  84                      
  85                      
  86 mike           1.48  PEGASUS_USING_STD;
  87                      
  88                      PEGASUS_NAMESPACE_BEGIN
  89                      
  90 mike           1.184 class CIMRepositoryRep
  91                      {
  92                      public:
  93                      
  94 kumpf          1.204     CIMRepositoryRep()
  95                              :
  96                      #ifdef PEGASUS_USE_CLASS_CACHE
  97                                _classCache(PEGASUS_CLASS_CACHE_SIZE),
  98                      #endif /* PEGASUS_USE_CLASS_CACHE */
  99                                _qualifierCache(PEGASUS_QUALIFIER_CACHE_SIZE)
 100                          {
 101                          }
 102                      
 103 mike           1.184     /**
 104                              Checks whether an instance with the specified key values exists in the
 105                              class hierarchy of the specified class.
 106                      
 107                              @param   nameSpace      the namespace of the instance
 108                              @param   instanceName   the name of the instance
 109                      
 110                              @return  true           if the instance is found
 111                                       false          if the instance cannot be found
 112                           */
 113                          Boolean _checkInstanceAlreadyExists(
 114                              const CIMNamespaceName& nameSpace,
 115                              const CIMObjectPath& instanceName) const;
 116                      
 117                          // This must be initialized in the constructor using values from the
 118                          // ConfigManager.
 119                          Boolean _isDefaultInstanceProvider;
 120                      
 121 kumpf          1.189     AutoPtr<ObjectStreamer> _streamer;
 122                      
 123 kumpf          1.201     AutoPtr<PersistentStore> _persistentStore;
 124 kumpf          1.189 
 125 kumpf          1.195     /**
 126                              Indicates whether the class definitions in the persistent store are
 127                              complete (contain propagated elements).
 128                          */
 129                          Boolean _storeCompleteClassDefinitions;
 130                      
 131 kumpf          1.192     NameSpaceManager _nameSpaceManager;
 132 mike           1.184 
 133                          ReadWriteSem _lock;
 134                      
 135                          RepositoryDeclContext* _context;
 136                      
 137                          CString _lockFile;
 138 mike           1.151 
 139                      #ifdef PEGASUS_USE_CLASS_CACHE
 140 kumpf          1.204     ObjectCache<CIMClass> _classCache;
 141 mike           1.151 #endif /* PEGASUS_USE_CLASS_CACHE */
 142                      
 143 kumpf          1.204     ObjectCache<CIMQualifierDecl> _qualifierCache;
 144                      };
 145 mike           1.153 
 146 kumpf          1.189 static String _getCacheKey(
 147                          const CIMNamespaceName& nameSpace,
 148                          const CIMName& entryName)
 149 jim.wunderlich 1.136 {
 150 kumpf          1.204     String key = nameSpace.getString();
 151                          key.append(':');
 152                          key.append(entryName.getString());
 153                          return key;
 154 jim.wunderlich 1.136 }
 155                      
 156                      
 157 karl           1.101 //
 158                      //  The following _xx functions are local to the repository implementation
 159                      //
 160 mike           1.48  ////////////////////////////////////////////////////////////////////////////////
 161                      //
 162 kumpf          1.104 //   _containsProperty
 163 karl           1.97  //
 164                      ////////////////////////////////////////////////////////////////////////////////
 165 karl           1.101 
 166                      /** Check to see if the specified property is in the property list
 167 kumpf          1.104     @param property the specified property
 168 karl           1.101     @param propertyList the property list
 169 kumpf          1.104     @return true if the property is in the list otherwise false.
 170 karl           1.101 */
 171 kumpf          1.189 static Boolean _containsProperty(
 172 kumpf          1.195     const CIMProperty& property,
 173 kumpf          1.169     const CIMPropertyList& propertyList)
 174 karl           1.97  {
 175 kumpf          1.104     //  For each property in the propertly list
 176                          for (Uint32 p=0; p<propertyList.size(); p++)
 177                          {
 178                              if (propertyList[p].equal(property.getName()))
 179                                  return true;
 180                          }
 181                          return false;
 182 karl           1.97  }
 183                      
 184 karl           1.98  ////////////////////////////////////////////////////////////////////////////////
 185                      //
 186                      // removeAllQualifiers - Remove all of the qualifiers from a class
 187                      //
 188                      ////////////////////////////////////////////////////////////////////////////////
 189 karl           1.101 
 190                      /* removes all Qualifiers from a CIMClass.  This function removes all
 191                         of the qualifiers from the class, from all of the properties,
 192                         from the methods, and from the parameters attached to the methods.
 193                         @param cimClass reference to the class from which qualifiers are to
 194                         be removed.
 195 kumpf          1.169    NOTE: This would be logical to be moved to CIMClass since it may be
 196                         more general than this usage.
 197 karl           1.101 */
 198 kumpf          1.189 static void _removeAllQualifiers(CIMClass& cimClass)
 199 karl           1.98  {
 200 kumpf          1.104     // remove qualifiers of the class
 201                          Uint32 count = 0;
 202 kumpf          1.169     while ((count = cimClass.getQualifierCount()) > 0)
 203 kumpf          1.104         cimClass.removeQualifier(count - 1);
 204                      
 205                          // remove qualifiers from the properties
 206                          for (Uint32 i = 0; i < cimClass.getPropertyCount(); i++)
 207                          {
 208                              CIMProperty p = cimClass.getProperty(i);
 209 kumpf          1.169         count = 0;
 210                              while ((count = p.getQualifierCount()) > 0)
 211 kumpf          1.104             p.removeQualifier(count - 1);
 212                          }
 213 kumpf          1.169 
 214 kumpf          1.104     // remove qualifiers from the methods
 215                          for (Uint32 i = 0; i < cimClass.getMethodCount(); i++)
 216                          {
 217                              CIMMethod m = cimClass.getMethod(i);
 218                              for (Uint32 j = 0 ; j < m.getParameterCount(); j++)
 219                              {
 220                                  CIMParameter p = m.getParameter(j);
 221                                  count = 0;
 222                                  while ((count = p.getQualifierCount()) > 0)
 223                                      p.removeQualifier(count - 1);
 224                              }
 225 kumpf          1.169         count = 0;
 226                              while ((count = m.getQualifierCount()) > 0)
 227 kumpf          1.104             m.removeQualifier(count - 1);
 228                          }
 229 karl           1.98  }
 230                      
 231                      /////////////////////////////////////////////////////////////////////////
 232                      //
 233 kumpf          1.195 // _stripPropagatedElements
 234 karl           1.98  //
 235                      /////////////////////////////////////////////////////////////////////////
 236 karl           1.101 
 237 kumpf          1.195 /* Removes propagated elements from the CIMClass, including properties,
 238                         methods, and qualifiers attached to the class, properties, methods, and
 239                         parameters.
 240 karl           1.101 */
 241 kumpf          1.195 static void _stripPropagatedElements(CIMClass& cimClass)
 242 karl           1.98  {
 243 kumpf          1.195     // Remove the propagated qualifiers from the class.
 244                          // Work backwards because removal may be cheaper. Sint32 covers count=0
 245                          for (Sint32 i = cimClass.getQualifierCount() - 1; i >= 0; i--)
 246 kumpf          1.104     {
 247 kumpf          1.195         if (cimClass.getQualifier(i).getPropagated())
 248 kumpf          1.104         {
 249                                  cimClass.removeQualifier(i);
 250                              }
 251                          }
 252                      
 253 kumpf          1.195     // Remove the propagated properties.
 254                          for (Sint32 i = cimClass.getPropertyCount() - 1; i >= 0; i--)
 255 kumpf          1.104     {
 256                              CIMProperty p = cimClass.getProperty(i);
 257 kumpf          1.195         if (p.getPropagated())
 258                              {
 259                                  cimClass.removeProperty(i);
 260                              }
 261                              else
 262 kumpf          1.104         {
 263 kumpf          1.195             // Remove the propagated qualifiers from the property.
 264                                  for (Sint32 j = p.getQualifierCount() - 1; j >= 0; j--)
 265 kumpf          1.104             {
 266 kumpf          1.195                 if (p.getQualifier(j).getPropagated())
 267                                      {
 268                                          p.removeQualifier(j);
 269                                      }
 270 kumpf          1.104             }
 271                              }
 272                          }
 273 kumpf          1.169 
 274 kumpf          1.195     // Remove the propagated methods.
 275                          for (Sint32 i = cimClass.getMethodCount() - 1; i >= 0; i--)
 276 kumpf          1.104     {
 277                              CIMMethod m = cimClass.getMethod(i);
 278 kumpf          1.195         if (m.getPropagated())
 279                              {
 280                                  cimClass.removeMethod(i);
 281                              }
 282                              else
 283 kumpf          1.104         {
 284 kumpf          1.195             // Remove the propagated qualifiers from the method.
 285                                  for (Sint32 j = m.getQualifierCount() - 1; j >= 0; j--)
 286 kumpf          1.104             {
 287 kumpf          1.195                 if (m.getQualifier(j).getPropagated())
 288 kumpf          1.104                 {
 289 kumpf          1.195                     m.removeQualifier(j);
 290 kumpf          1.104                 }
 291                                  }
 292                      
 293 kumpf          1.195             // Remove the propagated qualifiers from the method parameters.
 294                                  for (Sint32 j = m.getParameterCount() - 1; j >= 0; j--)
 295 kumpf          1.104             {
 296 kumpf          1.195                 CIMParameter p = m.getParameter(j);
 297                                      for (Sint32 k = p.getQualifierCount() - 1; k >= 0; k--)
 298                                      {
 299                                          if (p.getQualifier(k).getPropagated())
 300                                          {
 301                                              p.removeQualifier(k);
 302                                          }
 303                                      }
 304 kumpf          1.104             }
 305                              }
 306                          }
 307 karl           1.98  }
 308 karl           1.97  
 309 karl           1.103 /* remove the properties from an instance based on attributes.
 310 karl           1.101     @param Instance from which properties will be removed.
 311                          @param propertyList PropertyList is used in the removal algorithm
 312                          @param localOnly - Boolean used in the removal.
 313                          NOTE: This could be logical to move to CIMInstance since the
 314                          usage is more general than just in the repository
 315                      */
 316 kumpf          1.189 static void _removeProperties(
 317 kumpf          1.169     CIMInstance& cimInstance,
 318                          const CIMPropertyList& propertyList,
 319                          Boolean localOnly)
 320 karl           1.101 {
 321                          Boolean propertyListNull = propertyList.isNull();
 322                          if ((!propertyListNull) || localOnly)
 323                          {
 324                              // Loop through properties to remove those that do not filter through
 325                              // local only attribute and are not in the property list.
 326                              Uint32 count = cimInstance.getPropertyCount();
 327                              // Work backwards because removal may be cheaper. Sint32 covers count=0
 328                              for (Sint32 i = (count - 1); i >= 0; i--)
 329                              {
 330                                  CIMProperty p = cimInstance.getProperty(i);
 331                      
 332 kumpf          1.169             // if localOnly == true, ignore properties defined in super class
 333 karl           1.101             if (localOnly && (p.getPropagated()))
 334                                  {
 335                                      cimInstance.removeProperty(i);
 336                                      continue;
 337                                  }
 338                      
 339 kumpf          1.169             // propertyList NULL means deliver properties.  PropertyList
 340                                  // empty, none.
 341 karl           1.101             // Test for removal if propertyList not NULL. The empty list option
 342                                  // is covered by fact that property is not in the list.
 343                                  if (!propertyListNull)
 344 kumpf          1.169                 if (!_containsProperty(p, propertyList))
 345 karl           1.101                     cimInstance.removeProperty(i);
 346                              }
 347                          }
 348                      }
 349                      
 350                      /* remove all Qualifiers from a single CIMInstance. Removes
 351                          all of the qualifiers from the instance and from properties
 352                          within the instance.
 353                          @param instance from which parameters are removed.
 354                          NOTE: This could be logical to be moved to CIMInstance since
 355                          the usage may be more general than just in the repository.
 356                      */
 357 kumpf          1.189 static void _removeAllQualifiers(CIMInstance& cimInstance)
 358 karl           1.101 {
 359 kumpf          1.169     // remove qualifiers from the instance
 360                          Uint32 count = 0;
 361                          while ((count = cimInstance.getQualifierCount()) > 0)
 362                              cimInstance.removeQualifier(count - 1);
 363 karl           1.101 
 364 kumpf          1.169     // remove qualifiers from the properties
 365                          for (Uint32 i = 0; i < cimInstance.getPropertyCount(); i++)
 366                          {
 367                              CIMProperty p = cimInstance.getProperty(i);
 368                              count = 0;
 369                              while ((count = p.getQualifierCount()) > 0)
 370                                  p.removeQualifier(count - 1);
 371                          }
 372 karl           1.101 }
 373 kumpf          1.169 
 374 karl           1.101 /* removes all ClassOrigin attributes from a single CIMInstance. Removes
 375                          the classOrigin attribute from each property in the Instance.
 376                         @param Instance from which the ClassOrigin Properties will be removed.
 377                         NOTE: Logical to be moved to CIMInstance since it may be more general
 378                         than just the repositoryl
 379                      */
 380 kumpf          1.189 static void _removeClassOrigins(CIMInstance& cimInstance)
 381 karl           1.101 {
 382 marek          1.174     PEG_TRACE_CSTRING(TRC_REPOSITORY, Tracer::LEVEL4, "Remove Class Origins");
 383 kumpf          1.104 
 384 kumpf          1.169     Uint32 propertyCount = cimInstance.getPropertyCount();
 385                          for (Uint32 i = 0; i < propertyCount ; i++)
 386                              cimInstance.getProperty(i).setClassOrigin(CIMName());
 387 karl           1.101 }
 388                      
 389 karl           1.103 /* Filters the properties, qualifiers, and classorigin out of a single instance.
 390 karl           1.101     Based on the parameters provided for localOnly, includeQualifiers,
 391                          and includeClassOrigin, this function simply filters the properties
 392                          qualifiers, and classOrigins out of a single instance.  This function
 393                          was created to have a single piece of code that processes getinstance
 394                          and enumerateInstances returns.
 395                          @param cimInstance reference to instance to be processed.
 396                          @param localOnly defines if request is for localOnly parameters.
 397                          @param includeQualifiers Boolean defining if qualifiers to be returned.
 398                          @param includeClassOrigin Boolean defining if ClassOrigin attribute to
 399                          be removed from properties.
 400                      */
 401 kumpf          1.189 static void _filterInstance(
 402 kumpf          1.169     CIMInstance& cimInstance,
 403                          const CIMPropertyList& propertyList,
 404                          Boolean localOnly,
 405                          Boolean includeQualifiers,
 406                          Boolean includeClassOrigin)
 407 karl           1.101 {
 408 kumpf          1.164     // Remove properties based on propertyList and localOnly flag
 409 karl           1.101     _removeProperties(cimInstance, propertyList, localOnly);
 410 kumpf          1.164 
 411 karl           1.101     // If includequalifiers false, remove all qualifiers from
 412                          // properties.
 413                      
 414 kumpf          1.169     if (!includeQualifiers)
 415 karl           1.101     {
 416                              _removeAllQualifiers(cimInstance);
 417                          }
 418 kumpf          1.164 
 419 karl           1.103     // if ClassOrigin Flag false, remove classOrigin info from Instance object
 420                          // by setting the classOrigin to Null.
 421 kumpf          1.164 
 422 karl           1.101     if (!includeClassOrigin)
 423                          {
 424                              _removeClassOrigins(cimInstance);
 425                          }
 426                      }
 427 kumpf          1.164 
 428 kumpf          1.190 static Array<ClassAssociation> _buildClassAssociationEntries(
 429                          const CIMConstClass& assocClass)
 430                      {
 431                          PEG_METHOD_ENTER(TRC_REPOSITORY, "_buildClassAssociationEntries");
 432                      
 433                          Array<ClassAssociation> classAssocEntries;
 434                      
 435                          // Get the association's class name:
 436                      
 437                          CIMName assocClassName = assocClass.getClassName();
 438                      
 439                          // For each property:
 440                      
 441                          Uint32 n = assocClass.getPropertyCount();
 442                      
 443                          for (Uint32 i = 0; i < n; i++)
 444                          {
 445                              CIMConstProperty fromProp = assocClass.getProperty(i);
 446                      
 447                              if (fromProp.getType() == CIMTYPE_REFERENCE)
 448                              {
 449 kumpf          1.190             for (Uint32 j = 0; j < n; j++)
 450                                  {
 451                                      CIMConstProperty toProp = assocClass.getProperty(j);
 452                      
 453                                      if (toProp.getType() == CIMTYPE_REFERENCE &&
 454                                          (!fromProp.getName().equal(toProp.getName())))
 455                                      {
 456                                          classAssocEntries.append(ClassAssociation(
 457                                              assocClassName,
 458                                              fromProp.getReferenceClassName(),
 459                                              fromProp.getName(),
 460                                              toProp.getReferenceClassName(),
 461                                              toProp.getName()));
 462                                      }
 463                                  }
 464                              }
 465                          }
 466                      
 467                          PEG_METHOD_EXIT();
 468                          return classAssocEntries;
 469                      }
 470 kumpf          1.190 
 471                      /*
 472                          This routine does the following:
 473                      
 474                              1.  Creates two entries in the association file for each relationship
 475                                  formed by this new association instance. A binary association
 476                                  (one with two references) ties two instances together. Suppose
 477                                  there are two instances: I1 and I2. Then two entries are created:
 478                      
 479                                      I2 -> I1
 480                                      I1 -> I2
 481                      
 482                                  For a ternary relationship, six entries will be created. Suppose
 483                                  there are three instances: I1, I2, and I3:
 484                      
 485                                      I1 -> I2
 486                                      I1 -> I3
 487                                      I2 -> I1
 488                                      I2 -> I3
 489                                      I3 -> I1
 490                                      I3 -> I2
 491 kumpf          1.190 
 492                                  So for an N-ary relationship, there will be N! entries created.
 493                      
 494                              2.  Verifies that the association instance refers to real objects.
 495                                  (note that an association reference may refer to either an instance
 496                                  or a class). Throws an exception if one of the references does not
 497                                  refer to a valid object.
 498                      */
 499                      static Array<InstanceAssociation> _buildInstanceAssociationEntries(
 500                          const CIMNamespaceName& nameSpace,
 501                          const CIMConstClass& cimClass,
 502                          const CIMInstance& cimInstance,
 503                          const CIMObjectPath& instanceName)
 504                      {
 505                          PEG_METHOD_ENTER(TRC_REPOSITORY, "_buildInstanceAssociationEntries");
 506                      
 507                          Array<InstanceAssociation> instanceAssocEntries;
 508                      
 509                          // Get the association's instance name and class name:
 510                      
 511                          String assocInstanceName = instanceName.toString();
 512 kumpf          1.190     CIMName assocClassName = instanceName.getClassName();
 513                      
 514                          // For each property:
 515                      
 516                          for (Uint32 i = 0, n = cimInstance.getPropertyCount(); i < n; i++)
 517                          {
 518                              CIMConstProperty fromProp = cimInstance.getProperty(i);
 519                      
 520                              // If a reference property:
 521                      
 522                              if (fromProp.getType() == CIMTYPE_REFERENCE)
 523                              {
 524                                  // For each property:
 525                      
 526                                  for (Uint32 j = 0, m = cimInstance.getPropertyCount(); j < m; j++)
 527                                  {
 528                                      CIMConstProperty toProp = cimInstance.getProperty(j);
 529                      
 530                                      // If a reference property and not the same property:
 531                      
 532                                      if (toProp.getType() == CIMTYPE_REFERENCE &&
 533 kumpf          1.190                     (!fromProp.getName().equal (toProp.getName())))
 534                                      {
 535                                          CIMObjectPath fromRef;
 536                                          fromProp.getValue().get(fromRef);
 537                      
 538                                          CIMObjectPath toRef;
 539                                          toProp.getValue().get(toRef);
 540                      
 541                      
 542                                          // Fix for bugzilla 667:
 543                                          // Strip off the hostname if it is the same as the
 544                                          // local host
 545                                          if ((fromRef.getHost() != String::EMPTY) &&
 546                                              (System::isLocalHost(fromRef.getHost())))
 547                                          {
 548                                              PEG_TRACE_CSTRING(TRC_REPOSITORY, Tracer::LEVEL4,
 549                                                  "Stripping off local hostName from fromRef");
 550                                              fromRef.setHost(String::EMPTY);
 551                                          }
 552                      
 553                                          // Strip off the namespace when it is the same as the
 554 kumpf          1.190                     // one this instance is created in.
 555                                          if ((fromRef.getHost() == String::EMPTY) &&
 556                                              (fromRef.getNameSpace() == nameSpace))
 557                                          {
 558                                              PEG_TRACE_CSTRING(TRC_REPOSITORY, Tracer::LEVEL4,
 559                                                  "Stripping off local nameSpace from fromRef");
 560                                              fromRef.setNameSpace(CIMNamespaceName());
 561                                          }
 562                      
 563                                          // Strip off the hostname if it is the same as the
 564                                          // local host
 565                                          if ((toRef.getHost() != String::EMPTY) &&
 566                                              (System::isLocalHost(toRef.getHost())))
 567                                          {
 568                                              PEG_TRACE_CSTRING(TRC_REPOSITORY, Tracer::LEVEL4,
 569                                                  "Stripping off local hostName from toRef");
 570                                              toRef.setHost(String::EMPTY);
 571                                          }
 572                      
 573                                          // Strip off the namespace when it is the same as the
 574                                          // one this instance is created in.
 575 kumpf          1.190                     if ((toRef.getHost() == String::EMPTY) &&
 576                                              (toRef.getNameSpace() == nameSpace))
 577                                          {
 578                                              PEG_TRACE_CSTRING(TRC_REPOSITORY, Tracer::LEVEL4,
 579                                                  "Stripping off local nameSpace from toRef");
 580                                              toRef.setNameSpace(CIMNamespaceName());
 581                                          }
 582                      
 583                                          instanceAssocEntries.append(InstanceAssociation(
 584                                              assocInstanceName,
 585                                              assocClassName,
 586                                              fromRef.toString(),
 587                                              fromRef.getClassName(),
 588                                              fromProp.getName(),
 589                                              toRef.toString(),
 590                                              toRef.getClassName(),
 591                                              toProp.getName()));
 592                                      }
 593                                  }
 594                              }
 595                          }
 596 kumpf          1.190 
 597                          PEG_METHOD_EXIT();
 598                          return instanceAssocEntries;
 599                      }
 600                      
 601 kumpf          1.189 /**
 602                          Converts an object path to an instance name.  The host name is set to the
 603                          empty string.  The namespace is set to null if it matches the specified
 604                          namespace.  Otherwise, if it is not null, a CIM_ERR_NOT_FOUND exception is
 605                          thrown.
 606 mike           1.48  
 607 kumpf          1.189     This function allows the repository to store instance names with
 608                          consistent contents to facilitate equality tests.  (See Bug 1508.)
 609 david          1.96  
 610 kumpf          1.189 */
 611                      static CIMObjectPath _stripInstanceName(
 612                          const CIMNamespaceName& nameSpace,
 613                          const CIMObjectPath& instanceName)
 614 kumpf          1.165 {
 615 kumpf          1.189     CIMObjectPath normalizedInstanceName = instanceName;
 616                          normalizedInstanceName.setHost(String::EMPTY);
 617 kumpf          1.165 
 618 kumpf          1.189     if (instanceName.getNameSpace() == nameSpace)
 619 kumpf          1.165     {
 620 kumpf          1.189         normalizedInstanceName.setNameSpace(CIMNamespaceName());
 621 kumpf          1.165     }
 622 kumpf          1.189     else if (!instanceName.getNameSpace().isNull())
 623 kumpf          1.165     {
 624 kumpf          1.189         throw PEGASUS_CIM_EXCEPTION(CIM_ERR_NOT_FOUND, instanceName.toString());
 625 kumpf          1.165     }
 626                      
 627 kumpf          1.189     return normalizedInstanceName;
 628 kumpf          1.168 }
 629                      
 630                      ////////////////////////////////////////////////////////////////////////////////
 631                      //
 632 mike           1.48  // CIMRepository
 633                      //
 634                      //     The following are not implemented:
 635                      //
 636                      //         CIMRepository::execQuery()
 637                      //         CIMRepository::invokeMethod()
 638                      //
 639                      //     Note that invokeMethod() will not never implemented since it is not
 640                      //     meaningful for a repository.
 641                      //
 642 dmitry.mikulin 1.181 //     Note that if declContext is passed to the CIMRepository constructor,
 643                      //     the repository object will own it and will delete it when appropriate.
 644                      //
 645 mike           1.48  ////////////////////////////////////////////////////////////////////////////////
 646                      
 647 kumpf          1.166 CIMRepository::CIMRepository(
 648                          const String& repositoryRoot,
 649 dmitry.mikulin 1.181     Uint32 mode,
 650                          RepositoryDeclContext* declContext)
 651 jim.wunderlich 1.134 {
 652                          PEG_METHOD_ENTER(TRC_REPOSITORY, "CIMRepository::CIMRepository");
 653                      
 654 kumpf          1.166     Boolean binaryMode = mode & CIMRepository::MODE_BIN;
 655 kumpf          1.142 
 656 kumpf          1.166     if (mode == CIMRepository::MODE_DEFAULT)
 657 kumpf          1.142     {
 658 kumpf          1.158         binaryMode = ConfigManager::parseBooleanValue(
 659                                  ConfigManager::getInstance()->getCurrentValue(
 660                                      "enableBinaryRepository"));
 661 schuur         1.114     }
 662                      
 663 kumpf          1.166     // FUTURE?? -  compressMode = mode & CIMRepository::MODE_COMPRESSED;
 664 kumpf          1.189     Boolean compressMode = false;
 665 jim.wunderlich 1.136 
 666 kumpf          1.189 #ifdef PEGASUS_ENABLE_COMPRESSED_REPOSITORY    // PEP214
 667 kumpf          1.196     compressMode = true;
 668 kumpf          1.169     char* s = getenv("PEGASUS_ENABLE_COMPRESSED_REPOSITORY");
 669 jim.wunderlich 1.136     if (s && (strcmp(s, "build_non_compressed") == 0))
 670 kumpf          1.142     {
 671 kumpf          1.189         compressMode = false;
 672 kumpf          1.142 #ifdef TEST_OUTPUT
 673                              cout << "In Compress mode: build_non_compresed found" << endl;
 674 jim.wunderlich 1.136 #endif /* TEST_OUTPUT */
 675 kumpf          1.142     }
 676                      #endif /* PEGASUS_ENABLE_COMPRESSED_REPOSITORY */
 677 jim.wunderlich 1.136 
 678 kumpf          1.142 #ifdef TEST_OUTPUT
 679                          cout << "repositoryRoot = " << repositoryRoot << endl;
 680 kumpf          1.166     cout << "CIMRepository: binaryMode="  << binaryMode <<
 681                              ", mode=" << mode << endl;
 682 jim.wunderlich 1.136     cout << "CIMRepository: compressMode= " << compressMode << endl;
 683                      #endif /* TEST_OUTPUT */
 684 jim.wunderlich 1.134 
 685 kumpf          1.189     _rep = new CIMRepositoryRep();
 686                      
 687 marek          1.183     if (binaryMode)
 688 kumpf          1.169     {
 689                              // BUILD BINARY
 690 kumpf          1.189         _rep->_streamer.reset(
 691                                  new AutoStreamer(new BinaryStreamer(), BINREP_MARKER));
 692                              ((AutoStreamer*)_rep->_streamer.get())->addReader(new XmlStreamer(), 0);
 693 kumpf          1.169     }
 694                          else
 695                          {
 696                              // BUILD XML
 697 kumpf          1.189         _rep->_streamer.reset(new AutoStreamer(new XmlStreamer(), 0xff));
 698                              ((AutoStreamer*)_rep->_streamer.get())->addReader(
 699 kumpf          1.169             new BinaryStreamer(), BINREP_MARKER);
 700 kumpf          1.189         ((AutoStreamer*)_rep->_streamer.get())->addReader(new XmlStreamer(), 0);
 701 schuur         1.116     }
 702 schuur         1.114 
 703 dmitry.mikulin 1.181     // If declContext is supplied by the caller, don't allocate it.
 704                          // CIMRepository will take ownership and will be responsible for 
 705                          // deleting it.
 706                          if (declContext)
 707 mike           1.184         _rep->_context = declContext;
 708 dmitry.mikulin 1.181     else
 709 mike           1.184         _rep->_context = new RepositoryDeclContext();
 710                          _rep->_context->setRepository(this);
 711 dmitry.mikulin 1.181 
 712 mike           1.184     _rep->_isDefaultInstanceProvider = ConfigManager::parseBooleanValue(
 713 kumpf          1.158         ConfigManager::getInstance()->getCurrentValue(
 714                                  "repositoryIsDefaultInstanceProvider"));
 715 kumpf          1.58  
 716 mike           1.184     _rep->_lockFile = ConfigManager::getInstance()->getHomedPath(
 717 kumpf          1.160         PEGASUS_REPOSITORY_LOCK_FILE).getCString();
 718                      
 719 kumpf          1.201     _rep->_persistentStore.reset(PersistentStore::createPersistentStore(
 720 kumpf          1.192         repositoryRoot,
 721                              _rep->_streamer.get(),
 722                              compressMode));
 723                      
 724 kumpf          1.195     _rep->_storeCompleteClassDefinitions =
 725                              _rep->_persistentStore->storeCompleteClassDefinitions();
 726                      
 727 kumpf          1.192     // Initialize the NameSpaceManager
 728                      
 729                          Array<NamespaceDefinition> nameSpaces =
 730                              _rep->_persistentStore->enumerateNameSpaces();
 731                      
 732                          Uint32 i = 0;
 733                          while (i < nameSpaces.size())
 734                          {
 735                              if (nameSpaces[i].parentNameSpace.isNull() ||
 736                                  _rep->_nameSpaceManager.nameSpaceExists(
 737                                      nameSpaces[i].parentNameSpace))
 738                              {
 739                                  // Parent namespace exists; go ahead and initialize this namespace
 740                                  _rep->_nameSpaceManager.initializeNameSpace(
 741                                      nameSpaces[i],
 742                                      _rep->_persistentStore->enumerateClassNames(
 743                                          nameSpaces[i].name));
 744                                  i++;
 745                              }
 746                              else
 747                              {
 748 kumpf          1.192             // If the parent namespace appears later in the list, swap the
 749                                  // entries and repeat this iteration
 750                                  Boolean swapped = false;
 751                                  for (Uint32 j = i + 1; j < nameSpaces.size(); j++)
 752                                  {
 753                                      if (nameSpaces[i].parentNameSpace == nameSpaces[j].name)
 754                                      {
 755                                          NamespaceDefinition tmp = nameSpaces[j];
 756                                          nameSpaces[j] = nameSpaces[i];
 757                                          nameSpaces[i] = tmp;
 758                                          swapped = true;
 759                                          break;
 760                                      }
 761                                  }
 762 kumpf          1.189 
 763 kumpf          1.192             if (!swapped)
 764                                  {
 765                                      PEG_TRACE((TRC_DISCARDED_DATA, Tracer::LEVEL1,
 766                                          "Namespace: %s ignored - parent namespace %s not found",
 767                                          (const char*)nameSpaces[i].name.getString().getCString(),
 768                                          (const char*)nameSpaces[i].parentNameSpace.getString().
 769                                              getCString()));
 770                                      nameSpaces.remove(i);
 771                                  }
 772                              }
 773 kumpf          1.189     }
 774                      
 775 kumpf          1.192     if (!_rep->_nameSpaceManager.nameSpaceExists("root"))
 776 kumpf          1.189     {
 777                              // Create a root namespace per ...
 778                              // Specification for CIM Operations over HTTP
 779                              // Version 1.0
 780                              // 2.5 Namespace Manipulation
 781                              //
 782                              // There are no intrinsic methods defined specifically for the
 783                              // purpose of manipulating CIM Namespaces.  However, the
 784                              // modelling of the a CIM Namespace using the class
 785                              // __Namespace, together with the requirement that that
 786                              // root Namespace MUST be supported by all CIM Servers,
 787                              // implies that all Namespace operations can be supported.
 788                      
 789                              createNameSpace("root");
 790                          }
 791 kumpf          1.168 
 792 kumpf          1.58      PEG_METHOD_EXIT();
 793 mike           1.48  }
 794                      
 795                      CIMRepository::~CIMRepository()
 796                      {
 797 kumpf          1.58      PEG_METHOD_ENTER(TRC_REPOSITORY, "CIMRepository::~CIMRepository");
 798                      
 799 mike           1.184     delete _rep->_context;
 800 kumpf          1.58  
 801 mike           1.184     delete _rep;
 802                      
 803 kumpf          1.58      PEG_METHOD_EXIT();
 804 mike           1.48  }
 805                      
 806 kumpf          1.104 String _toString(Boolean x)
 807 mike           1.51  {
 808 kumpf          1.104     return(x ? "true" : "false");
 809 mike           1.51  }
 810                      
 811 kumpf          1.104 CIMClass CIMRepository::getClass(
 812                          const CIMNamespaceName& nameSpace,
 813                          const CIMName& className,
 814                          Boolean localOnly,
 815                          Boolean includeQualifiers,
 816                          Boolean includeClassOrigin,
 817                          const CIMPropertyList& propertyList)
 818 mike           1.51  {
 819 kumpf          1.104     PEG_METHOD_ENTER(TRC_REPOSITORY, "CIMRepository::getClass");
 820 kumpf          1.58  
 821 mike           1.184     ReadLock lock(_rep->_lock);
 822 kumpf          1.104     CIMClass cimClass = _getClass(nameSpace,
 823                                                        className,
 824                                                        localOnly,
 825                                                        includeQualifiers,
 826                                                        includeClassOrigin,
 827                                                        propertyList);
 828 kumpf          1.58  
 829                          PEG_METHOD_EXIT();
 830 kumpf          1.104     return cimClass;
 831 mike           1.51  }
 832                      
 833 kumpf          1.104 CIMClass CIMRepository::_getClass(
 834 kumpf          1.85      const CIMNamespaceName& nameSpace,
 835                          const CIMName& className,
 836 mike           1.48      Boolean localOnly,
 837                          Boolean includeQualifiers,
 838                          Boolean includeClassOrigin,
 839 mike           1.205     const CIMPropertyList& propertyList,
 840                          Boolean clone)
 841 mike           1.48  {
 842 kumpf          1.104     PEG_METHOD_ENTER(TRC_REPOSITORY, "CIMRepository::_getClass");
 843 kumpf          1.58  
 844 thilo.boehm    1.193     PEG_TRACE((TRC_REPOSITORY, Tracer::LEVEL4,
 845                                 "nameSpace= %s, className= %s, localOnly= %s"
 846                                 ", includeQualifiers=  %s, includeClassOrigin= %s",
 847                                 (const char*)nameSpace.getString().getCString(),
 848                                 (const char*)className.getString().getCString(),
 849                                 (localOnly?"true":"false"),
 850                                 (includeQualifiers?"true":"false"),
 851                                 (includeClassOrigin?"true":"false")));
 852 kumpf          1.104 
 853                          CIMClass cimClass;
 854 kumpf          1.203     // The class cache contains complete class definitions
 855                          Boolean classIncludesPropagatedElements = true;
 856 mike           1.51  
 857 mike           1.151 #ifdef PEGASUS_USE_CLASS_CACHE
 858 kumpf          1.203     // Check the cache first.  Note that the cache contains complete class
 859                          // definitions including propagated elements.
 860 mike           1.151 
 861 kumpf          1.189     String cacheKey = _getCacheKey(nameSpace, className);
 862 mike           1.151 
 863 mike           1.205     if (!_rep->_classCache.get(cacheKey, cimClass, clone))
 864 kumpf          1.189     {
 865                              // Not in cache so load from disk:
 866                      #endif
 867 mike           1.151 
 868 kumpf          1.189         CIMNamespaceName actualNameSpaceName;
 869                              CIMName superClassName;
 870 kumpf          1.192         _rep->_nameSpaceManager.locateClass(
 871 kumpf          1.189             nameSpace, className, actualNameSpaceName, superClassName);
 872 mike           1.151 
 873 kumpf          1.189         cimClass = _rep->_persistentStore->getClass(
 874                                  actualNameSpaceName, className, superClassName);
 875 kumpf          1.203         classIncludesPropagatedElements = _rep->_storeCompleteClassDefinitions;
 876                      
 877                              if (!localOnly && !classIncludesPropagatedElements)
 878                              {
 879                                  // Propagate the superclass elements to this class.
 880                                  Resolver::resolveClass(cimClass, _rep->_context, nameSpace);
 881                                  classIncludesPropagatedElements = true;
 882                              }
 883 mike           1.151 
 884 kumpf          1.189 #ifdef PEGASUS_USE_CLASS_CACHE
 885 kumpf          1.203         if (classIncludesPropagatedElements)
 886                              {
 887                                  // Put in cache:
 888 mike           1.151 
 889 mike           1.205             _rep->_classCache.put(cacheKey, cimClass, clone);
 890 kumpf          1.203         }
 891 mike           1.51      }
 892 kumpf          1.189 #endif
 893 mike           1.48  
 894 mike           1.205 #if !defined(PEGASUS_USE_CLASS_CACHE)
 895                          // This flag must be true if caching is disabled, otherwise, an unecessary
 896                          // copy could be created below.
 897                          clone = true;
 898                      #endif
 899                      
 900                          // If clone is true, then cimClass is a clone (not shared with cache).
 901                          // Else, it refers to the same one in the cache and any code below that
 902                          // changes it, will need to clone it first.
 903                      
 904 kumpf          1.203     if (localOnly && classIncludesPropagatedElements)
 905 kumpf          1.195     {
 906 mike           1.205         // We must clone after all since object is modified below.
 907                              if (!clone)
 908                                  cimClass = cimClass.clone();
 909                      
 910 kumpf          1.203         _stripPropagatedElements(cimClass);
 911 kumpf          1.195     }
 912 kumpf          1.104 
 913 kumpf          1.195     // Remove properties based on propertyList
 914                          if (!propertyList.isNull())
 915 karl           1.97      {
 916 mike           1.205         // We must clone after all since object is modified below.
 917                              if (!clone)
 918                                  cimClass = cimClass.clone();
 919                      
 920 kumpf          1.195         // Remove properties that are not in the property list.
 921 kumpf          1.104         // Work backwards because removal may be cheaper. Sint32 covers count=0
 922 kumpf          1.195         for (Sint32 i = cimClass.getPropertyCount() - 1; i >= 0; i--)
 923 kumpf          1.104         {
 924 kumpf          1.195             if (!_containsProperty(cimClass.getProperty(i), propertyList))
 925 kumpf          1.104             {
 926                                      cimClass.removeProperty(i);
 927                                  }
 928                              }
 929                          }
 930                      
 931                          // If includequalifiers false, remove all qualifiers from
 932                          // properties, methods and parameters.
 933 kumpf          1.169     if (!includeQualifiers)
 934 kumpf          1.104     {
 935 mike           1.205         // We must clone after all since object is modified below.
 936                              if (!clone)
 937                                  cimClass = cimClass.clone();
 938                      
 939 kumpf          1.104         _removeAllQualifiers(cimClass);
 940                          }
 941 kumpf          1.169 
 942 kumpf          1.104     // if ClassOrigin Flag false, remove classOrigin info from class object
 943                          // by setting the property to Null.
 944                          if (!includeClassOrigin)
 945                          {
 946 mike           1.205         // We must clone after all since object is modified below.
 947                              if (!clone)
 948                                  cimClass = cimClass.clone();
 949                      
 950 marek          1.174         PEG_TRACE_CSTRING(TRC_REPOSITORY, Tracer::LEVEL4,
 951 kumpf          1.169             "Remove Class Origins");
 952 kumpf          1.104 
 953                              Uint32 propertyCount = cimClass.getPropertyCount();
 954                              for (Uint32 i = 0; i < propertyCount ; i++)
 955                                  cimClass.getProperty(i).setClassOrigin(CIMName());
 956                      
 957                              Uint32 methodCount =  cimClass.getMethodCount();
 958                              for (Uint32 i=0; i < methodCount ; i++)
 959                                  cimClass.getMethod(i).setClassOrigin(CIMName());
 960                          }
 961 karl           1.97  
 962 kumpf          1.58      PEG_METHOD_EXIT();
 963 mike           1.48      return cimClass;
 964                      }
 965                      
 966 mike           1.184 Boolean CIMRepositoryRep::_checkInstanceAlreadyExists(
 967 kumpf          1.85      const CIMNamespaceName& nameSpace,
 968 kumpf          1.162     const CIMObjectPath& instanceName) const
 969 mike           1.48  {
 970 kumpf          1.162     PEG_METHOD_ENTER(TRC_REPOSITORY,
 971                              "CIMRepository::_checkInstanceAlreadyExists");
 972 kumpf          1.58  
 973 mike           1.53      //
 974 kumpf          1.162     // Get the names of all superclasses and subclasses of this class
 975 mike           1.53      //
 976 mike           1.51  
 977 kumpf          1.85      Array<CIMName> classNames;
 978 kumpf          1.162     CIMName className = instanceName.getClassName();
 979 kumpf          1.94      classNames.append(className);
 980 kumpf          1.192     _nameSpaceManager.getSubClassNames(nameSpace, className, true, classNames);
 981                          _nameSpaceManager.getSuperClassNames(nameSpace, className, classNames);
 982 mike           1.48  
 983 mike           1.53      //
 984 kumpf          1.162     // Search for an instance with the specified key values
 985 mike           1.53      //
 986 mike           1.48  
 987                          for (Uint32 i = 0; i < classNames.size(); i++)
 988                          {
 989 kumpf          1.189         CIMObjectPath tmpInstanceName = CIMObjectPath(
 990                                  String::EMPTY,
 991                                  CIMNamespaceName(),
 992                                  classNames[i],
 993                                  instanceName.getKeyBindings());
 994 mike           1.48  
 995 kumpf          1.189         if (_persistentStore->instanceExists(nameSpace, tmpInstanceName))
 996 mike           1.51          {
 997 kumpf          1.58              PEG_METHOD_EXIT();
 998 mike           1.51              return true;
 999                              }
1000 mike           1.48      }
1001                      
1002 kumpf          1.58      PEG_METHOD_EXIT();
1003 mike           1.48      return false;
1004                      }
1005                      
1006                      CIMInstance CIMRepository::getInstance(
1007 kumpf          1.85      const CIMNamespaceName& nameSpace,
1008 kumpf          1.68      const CIMObjectPath& instanceName,
1009 mike           1.48      Boolean localOnly,
1010                          Boolean includeQualifiers,
1011                          Boolean includeClassOrigin,
1012 mike           1.55      const CIMPropertyList& propertyList)
1013 mike           1.48  {
1014 kumpf          1.58      PEG_METHOD_ENTER(TRC_REPOSITORY, "CIMRepository::getInstance");
1015                      
1016 mike           1.184     ReadLock lock(_rep->_lock);
1017 kumpf          1.165 
1018 kumpf          1.169     CIMInstance cimInstance = _getInstance(
1019                              nameSpace,
1020                              instanceName,
1021                              localOnly,
1022                              includeQualifiers,
1023                              includeClassOrigin,
1024 kumpf          1.191         propertyList,
1025                              true);
1026 kumpf          1.104 
1027                          PEG_METHOD_EXIT();
1028                          return cimInstance;
1029                      }
1030                      
1031                      CIMInstance CIMRepository::_getInstance(
1032                          const CIMNamespaceName& nameSpace,
1033                          const CIMObjectPath& instanceName,
1034                          Boolean localOnly,
1035                          Boolean includeQualifiers,
1036                          Boolean includeClassOrigin,
1037 kumpf          1.191     const CIMPropertyList& propertyList,
1038                          Boolean resolveInstance)
1039 kumpf          1.104 {
1040                          PEG_METHOD_ENTER(TRC_REPOSITORY, "CIMRepository::_getInstance");
1041                      
1042 kumpf          1.189     CIMObjectPath normalizedInstanceName =
1043                              _stripInstanceName(nameSpace, instanceName);
1044 r.kieninger    1.125 
1045 kumpf          1.192     if (!_rep->_nameSpaceManager.classExists(
1046 mike           1.184         nameSpace, instanceName.getClassName()))
1047 kumpf          1.162     {
1048                              throw PEGASUS_CIM_EXCEPTION(
1049                                  CIM_ERR_INVALID_CLASS, instanceName.getClassName().getString());
1050                          }
1051                      
1052 kumpf          1.189     CIMInstance cimInstance =
1053                              _rep->_persistentStore->getInstance(nameSpace, normalizedInstanceName);
1054 mike           1.51  
1055 mike           1.54      //
1056                          // Resolve the instance (if requested):
1057                          //
1058                      
1059 kumpf          1.198     if (resolveInstance && includeQualifiers)
1060 mike           1.54      {
1061 kumpf          1.198         // Instances are resolved in persistent storage by the
1062                              // createInstance and modifyInstance operations, but qualifiers
1063                              // are not propagated.  The only reason to perform resolution
1064                              // here is if qualifiers are requested in the instance.
1065                      
1066 kumpf          1.104         CIMConstClass cimClass;
1067 mike           1.184         Resolver::resolveInstance (
1068                                  cimInstance, _rep->_context, nameSpace, cimClass, true);
1069 mike           1.54      }
1070 kumpf          1.99  
1071 kumpf          1.165     _filterInstance(
1072                              cimInstance,
1073                              propertyList,
1074                              localOnly,
1075                              includeQualifiers,
1076                              includeClassOrigin);
1077 kumpf          1.104 
1078 kumpf          1.52      PEG_METHOD_EXIT();
1079 mike           1.48      return cimInstance;
1080                      }
1081                      
1082                      void CIMRepository::deleteClass(
1083 kumpf          1.85      const CIMNamespaceName& nameSpace,
1084                          const CIMName& className)
1085 mike           1.48  {
1086 kumpf          1.61      PEG_METHOD_ENTER(TRC_REPOSITORY,"CIMRepository::deleteClass");
1087 kumpf          1.58  
1088 mike           1.184     WriteLock lock(_rep->_lock);
1089                          AutoFileLock fileLock(_rep->_lockFile);
1090 kumpf          1.104 
1091 mike           1.53      //
1092 kumpf          1.189     // Get the class and check to see if it is an association class.
1093 mike           1.53      //
1094 mike           1.51  
1095 kumpf          1.104     CIMClass cimClass = _getClass(
1096                              nameSpace, className, false, true, false, CIMPropertyList());
1097 mike           1.48      Boolean isAssociation = cimClass.isAssociation();
1098                      
1099 kumpf          1.192     _rep->_nameSpaceManager.checkDeleteClass(nameSpace, className);
1100 kumpf          1.189 
1101                          Array<CIMNamespaceName> dependentNameSpaceNames =
1102 kumpf          1.192         _rep->_nameSpaceManager.getDependentSchemaNameSpaceNames(nameSpace);
1103 kumpf          1.189 
1104 mike           1.53      //
1105 kumpf          1.189     // Ensure no instances of this class exist in the repository.
1106 mike           1.53      //
1107 mike           1.151 
1108 kumpf          1.189     for (Uint32 i = 0; i < dependentNameSpaceNames.size(); i++)
1109                          {
1110                              Array<CIMObjectPath> instanceNames =
1111                                  _rep->_persistentStore->enumerateInstanceNamesForClass(
1112                                      dependentNameSpaceNames[i], className);
1113 mike           1.151 
1114 kumpf          1.189         if (instanceNames.size())
1115                              {
1116                                  throw PEGASUS_CIM_EXCEPTION(
1117                                      CIM_ERR_CLASS_HAS_INSTANCES, className.getString());
1118                              }
1119                          }
1120 mike           1.48  
1121 kumpf          1.189 #ifdef PEGASUS_USE_CLASS_CACHE
1122 kumpf          1.104 
1123 kumpf          1.204     _rep->_classCache.evict(_getCacheKey(nameSpace, className));
1124 mike           1.48  
1125 kumpf          1.189 #endif /* PEGASUS_USE_CLASS_CACHE */
1126 kumpf          1.58  
1127 mike           1.53      //
1128 kumpf          1.189     // Delete the class. The NameSpaceManager::deleteClass() method throws
1129                          // an exception if the class has subclasses.
1130 mike           1.53      //
1131                      
1132 kumpf          1.189     CIMName superClassName =
1133 kumpf          1.192         _rep->_nameSpaceManager.getSuperClassName(nameSpace, className);
1134 mike           1.53  
1135 kumpf          1.192     _rep->_nameSpaceManager.deleteClass(nameSpace, className);
1136 mike           1.53  
1137 kumpf          1.190     _rep->_persistentStore->deleteClass(
1138                              nameSpace,
1139                              className,
1140                              superClassName,
1141                              isAssociation,
1142                              dependentNameSpaceNames);
1143 kumpf          1.58  
1144                          PEG_METHOD_EXIT();
1145 mike           1.53  }
1146                      
1147 mike           1.48  void CIMRepository::deleteInstance(
1148 kumpf          1.85      const CIMNamespaceName& nameSpace,
1149 kumpf          1.68      const CIMObjectPath& instanceName)
1150 mike           1.48  {
1151 mike           1.53      PEG_METHOD_ENTER(TRC_REPOSITORY, "CIMRepository::deleteInstance");
1152 mike           1.51  
1153 kumpf          1.192     _rep->_nameSpaceManager.validateClass(
1154 kumpf          1.189         nameSpace, instanceName.getClassName());
1155                      
1156                          CIMObjectPath normalizedInstanceName =
1157                              _stripInstanceName(nameSpace, instanceName);
1158 r.kieninger    1.125 
1159 mike           1.184     WriteLock lock(_rep->_lock);
1160                          AutoFileLock fileLock(_rep->_lockFile);
1161 kumpf          1.104 
1162 kumpf          1.189     _rep->_persistentStore->deleteInstance(nameSpace, normalizedInstanceName);
1163 mike           1.53  
1164 kumpf          1.58      PEG_METHOD_EXIT();
1165 mike           1.48  }
1166                      
1167                      void CIMRepository::createClass(
1168 kumpf          1.85      const CIMNamespaceName& nameSpace,
1169 kumpf          1.199     const CIMClass& newClass)
1170 mike           1.48  {
1171 kumpf          1.58      PEG_METHOD_ENTER(TRC_REPOSITORY, "CIMRepository::createClass");
1172                      
1173 mike           1.184     WriteLock lock(_rep->_lock);
1174                          AutoFileLock fileLock(_rep->_lockFile);
1175 kumpf          1.104     _createClass(nameSpace, newClass);
1176                      
1177                          PEG_METHOD_EXIT();
1178                      }
1179                      
1180                      void CIMRepository::_createClass(
1181                          const CIMNamespaceName& nameSpace,
1182                          const CIMClass& newClass)
1183                      {
1184                          PEG_METHOD_ENTER(TRC_REPOSITORY, "CIMRepository::_createClass");
1185                      
1186 kumpf          1.197     // -- Check whether the class may be created:
1187                      
1188                          _rep->_nameSpaceManager.checkCreateClass(
1189                              nameSpace, newClass.getClassName(), newClass.getSuperClassName());
1190                      
1191 mike           1.48      // -- Resolve the class:
1192 kumpf          1.104 
1193 kumpf          1.194     CIMClass cimClass(newClass.clone());
1194                          Resolver::resolveClass(cimClass, _rep->_context, nameSpace);
1195 mike           1.48  
1196 kumpf          1.190     // -- If an association class, build association entries:
1197 kumpf          1.189 
1198 kumpf          1.190     Array<ClassAssociation> classAssocEntries;
1199 kumpf          1.189 
1200 kumpf          1.190     if (cimClass.isAssociation())
1201                          {
1202                              classAssocEntries = _buildClassAssociationEntries(cimClass);
1203                          }
1204 mike           1.48  
1205 kumpf          1.195     // -- Strip the propagated elements, if required
1206                      
1207                          if (!_rep->_storeCompleteClassDefinitions)
1208                          {
1209                              _stripPropagatedElements(cimClass);
1210                          }
1211                      
1212 kumpf          1.190     // -- Create the class declaration:
1213                      
1214                          _rep->_persistentStore->createClass(nameSpace, cimClass, classAssocEntries);
1215 mike           1.48  
1216                          // -- Create namespace manager entry:
1217                      
1218 kumpf          1.192     _rep->_nameSpaceManager.createClass(
1219 kumpf          1.189         nameSpace, cimClass.getClassName(), cimClass.getSuperClassName());
1220 kumpf          1.58  
1221                          PEG_METHOD_EXIT();
1222 mike           1.48  }
1223                      
1224 kumpf          1.68  CIMObjectPath CIMRepository::createInstance(
1225 kumpf          1.85      const CIMNamespaceName& nameSpace,
1226 kumpf          1.199     const CIMInstance& newInstance)
1227 mike           1.48  {
1228 kumpf          1.61      PEG_METHOD_ENTER(TRC_REPOSITORY, "CIMRepository::createInstance");
1229 mike           1.51  
1230 mike           1.184     WriteLock lock(_rep->_lock);
1231                          AutoFileLock fileLock(_rep->_lockFile);
1232 kumpf          1.104     CIMObjectPath instanceName = _createInstance(nameSpace, newInstance);
1233                      
1234                          PEG_METHOD_EXIT();
1235                          return instanceName;
1236                      }
1237                      
1238                      CIMObjectPath CIMRepository::_createInstance(
1239                          const CIMNamespaceName& nameSpace,
1240                          const CIMInstance& newInstance)
1241                      {
1242                          PEG_METHOD_ENTER(TRC_REPOSITORY, "CIMRepository::_createInstance");
1243                      
1244 mike           1.53      //
1245 mike           1.54      // Resolve the instance. Looks up class and fills out properties but
1246                          // not the qualifiers.
1247 mike           1.53      //
1248                      
1249 kumpf          1.200     CIMInstance cimInstance(newInstance.clone());
1250 mike           1.48      CIMConstClass cimClass;
1251 mike           1.184     Resolver::resolveInstance (cimInstance, _rep->_context, nameSpace, cimClass,
1252 kumpf          1.76          false);
1253 kumpf          1.81      CIMObjectPath instanceName = cimInstance.buildPath(cimClass);
1254 mike           1.48  
1255 mike           1.53      //
1256                          // Make sure the class has keys (otherwise it will be impossible to
1257                          // create the instance).
1258                          //
1259 mike           1.48  
1260                          if (!cimClass.hasKeys())
1261                          {
1262 humberto       1.88          PEG_METHOD_EXIT();
1263 kumpf          1.99          throw PEGASUS_CIM_EXCEPTION_L(CIM_ERR_FAILED,
1264                                  MessageLoaderParms("Repository.CIMRepository.CLASS_HAS_NO_KEYS",
1265 kumpf          1.104                 "class has no keys: $0",
1266 kumpf          1.99                  cimClass.getClassName().getString()));
1267 mike           1.48      }
1268                      
1269 mike           1.53      //
1270                          // Be sure instance does not already exist:
1271                          //
1272 mike           1.48  
1273 mike           1.184     if (_rep->_checkInstanceAlreadyExists(nameSpace, instanceName))
1274 mike           1.48      {
1275 kumpf          1.52          PEG_METHOD_EXIT();
1276 kumpf          1.104         throw PEGASUS_CIM_EXCEPTION(CIM_ERR_ALREADY_EXISTS,
1277 mike           1.51              instanceName.toString());
1278 mike           1.48      }
1279                      
1280 mike           1.53      //
1281 kumpf          1.190     // Build association entries if an association instance.
1282 mike           1.53      //
1283 mike           1.48  
1284 kumpf          1.190     Array<InstanceAssociation> instAssocEntries;
1285                      
1286 mike           1.48      if (cimClass.isAssociation())
1287 kumpf          1.190     {
1288                              instAssocEntries = _buildInstanceAssociationEntries(
1289                                  nameSpace, cimClass, cimInstance, instanceName);
1290                          }
1291                      
1292                          //
1293                          // Create the instance
1294                          //
1295 mike           1.53  
1296 kumpf          1.189     _rep->_persistentStore->createInstance(
1297 kumpf          1.190         nameSpace, instanceName, cimInstance, instAssocEntries);
1298 mike           1.53  
1299 kumpf          1.52      PEG_METHOD_EXIT();
1300 mike           1.53      return instanceName;
1301 mike           1.48  }
1302                      
1303                      void CIMRepository::modifyClass(
1304 kumpf          1.85      const CIMNamespaceName& nameSpace,
1305 kumpf          1.199     const CIMClass& modifiedClass)
1306 mike           1.48  {
1307 kumpf          1.58      PEG_METHOD_ENTER(TRC_REPOSITORY, "CIMRepository::modifyClass");
1308                      
1309 mike           1.184     WriteLock lock(_rep->_lock);
1310                          AutoFileLock fileLock(_rep->_lockFile);
1311 kumpf          1.104     _modifyClass(nameSpace, modifiedClass);
1312                      
1313                          PEG_METHOD_EXIT();
1314                      }
1315                      
1316                      void CIMRepository::_modifyClass(
1317                          const CIMNamespaceName& nameSpace,
1318                          const CIMClass& modifiedClass)
1319                      {
1320                          PEG_METHOD_ENTER(TRC_REPOSITORY, "CIMRepository::_modifyClass");
1321                      
1322 mike           1.53      //
1323                          // Check to see if it is okay to modify this class:
1324                          //
1325 mike           1.48  
1326 kumpf          1.195     CIMName oldSuperClassName;
1327                      
1328 kumpf          1.192     _rep->_nameSpaceManager.checkModifyClass(
1329 kumpf          1.195         nameSpace,
1330                              modifiedClass.getClassName(),
1331                              modifiedClass.getSuperClassName(),
1332                              oldSuperClassName,
1333                              !_rep->_storeCompleteClassDefinitions);
1334 mike           1.48  
1335 mike           1.53      //
1336 kumpf          1.197     // Resolve the class:
1337                          //
1338                      
1339                          CIMClass cimClass(modifiedClass.clone());
1340                          Resolver::resolveClass(cimClass, _rep->_context, nameSpace);
1341                      
1342                          //
1343 mike           1.53      // ATTN: KS
1344                          // Disallow modification of classes which have instances (that are
1345                          // in the repository). And we have no idea whether the class has
1346                          // instances in other repositories or in providers. We should do
1347                          // an enumerate instance names at a higher level (above the repository).
1348                          //
1349 chip           1.118 
1350 mike           1.151 #ifdef PEGASUS_USE_CLASS_CACHE
1351                      
1352 kumpf          1.203     // Modifying this class may invalidate subclass definitions in the cache.
1353                          // Since class modification is relatively rare, we just flush the entire
1354                          // cache rather than specifically evicting subclass definitions.
1355 kumpf          1.204     _rep->_classCache.clear();
1356 mike           1.151 
1357                      #endif /* PEGASUS_USE_CLASS_CACHE */
1358 mike           1.53  
1359 kumpf          1.190     Boolean isAssociation = cimClass.isAssociation();
1360                          Array<ClassAssociation> classAssocEntries;
1361 kumpf          1.58  
1362 kumpf          1.190     if (isAssociation)
1363 kumpf          1.169     {
1364 kumpf          1.190         classAssocEntries = _buildClassAssociationEntries(cimClass);
1365 konrad.r       1.111     }
1366                      
1367 kumpf          1.195     // Strip the propagated elements, if required
1368                      
1369                          if (!_rep->_storeCompleteClassDefinitions)
1370                          {
1371                              _stripPropagatedElements(cimClass);
1372                          }
1373                      
1374 kumpf          1.190     _rep->_persistentStore->modifyClass(
1375 kumpf          1.195         nameSpace,
1376                              cimClass,
1377                              oldSuperClassName,
1378                              isAssociation,
1379                              classAssocEntries);
1380 mike           1.151 
1381 kumpf          1.58      PEG_METHOD_EXIT();
1382 mike           1.48  }
1383                      
1384                      void CIMRepository::modifyInstance(
1385 kumpf          1.85      const CIMNamespaceName& nameSpace,
1386 kumpf          1.70      const CIMInstance& modifiedInstance,
1387 mike           1.51      Boolean includeQualifiers,
1388 kumpf          1.199     const CIMPropertyList& propertyList)
1389 mike           1.48  {
1390 kumpf          1.58      PEG_METHOD_ENTER(TRC_REPOSITORY, "CIMRepository::modifyInstance");
1391                      
1392 mike           1.184     WriteLock lock(_rep->_lock);
1393                          AutoFileLock fileLock(_rep->_lockFile);
1394 kumpf          1.104 
1395 mike           1.53      //
1396                          // Do this:
1397                          //
1398 mike           1.51  
1399 mike           1.53      CIMInstance cimInstance;   // The instance that replaces the original
1400 mike           1.51  
1401                          if (propertyList.isNull())
1402                          {
1403                              //
1404                              // Replace all the properties in the instance
1405                              //
1406                              if (includeQualifiers)
1407                              {
1408                                  //
1409                                  // Replace the entire instance with the given instance
1410                                  // (this is the default behavior)
1411                                  //
1412 kumpf          1.200             cimInstance = modifiedInstance.clone();
1413 mike           1.51          }
1414                              else
1415                              {
1416                                  //
1417                                  // Replace all the properties in the instance, but keep the
1418                                  // original qualifiers on the instance and on the properties
1419                                  //
1420                      
1421 kumpf          1.104             cimInstance = _getInstance(
1422                                      nameSpace,
1423                                      modifiedInstance.getPath (),
1424                                      false,
1425                                      true,
1426                                      true,
1427 kumpf          1.191                 CIMPropertyList(),
1428                                      false);
1429 mike           1.54  
1430 mike           1.51              CIMInstance newInstance(
1431 kumpf          1.70                  modifiedInstance.getPath ().getClassName());
1432 mike           1.54  
1433 kumpf          1.200             CIMConstInstance givenInstance = modifiedInstance;
1434 mike           1.51  
1435                                  //
1436                                  // Copy over the original instance qualifiers
1437                                  //
1438 mike           1.54  
1439                                  for (Uint32 i = 0; i < cimInstance.getQualifierCount(); i++)
1440 mike           1.51              {
1441                                      newInstance.addQualifier(cimInstance.getQualifier(i));
1442                                  }
1443                      
1444                                  //
1445                                  // Loop through the properties replacing each property in the
1446                                  // original with a new value, but keeping the original qualifiers
1447                                  //
1448                                  for (Uint32 i=0; i<givenInstance.getPropertyCount(); i++)
1449                                  {
1450                                      // Copy the given property value (not qualifiers)
1451 kumpf          1.200                 CIMConstProperty givenProperty = givenInstance.getProperty(i);
1452 mike           1.51                  CIMProperty newProperty(
1453                                          givenProperty.getName(),
1454                                          givenProperty.getValue(),
1455                                          givenProperty.getArraySize(),
1456                                          givenProperty.getReferenceClassName(),
1457                                          givenProperty.getClassOrigin(),
1458                                          givenProperty.getPropagated());
1459                      
1460                                      // Copy the original property qualifiers
1461                                      Uint32 origPos =
1462                                          cimInstance.findProperty(newProperty.getName());
1463                                      if (origPos != PEG_NOT_FOUND)
1464                                      {
1465                                          CIMProperty origProperty = cimInstance.getProperty(origPos);
1466                                          for (Uint32 j=0; j<origProperty.getQualifierCount(); j++)
1467                                          {
1468 r.kieninger    1.133                         newProperty.addQualifier(origProperty.getQualifier(j));
1469 mike           1.51                      }
1470                                      }
1471                      
1472                                      // Add the newly constructed property to the new instance
1473                                      newInstance.addProperty(newProperty);
1474                                  }
1475                      
1476                                  // Use the newly merged instance to replace the original instance
1477                                  cimInstance = newInstance;
1478                              }
1479                          }
1480                          else
1481                          {
1482                              //
1483                              // Replace only the properties specified in the given instance
1484                              //
1485                      
1486 kumpf          1.191         cimInstance = _getInstance(
1487                                  nameSpace,
1488                                  modifiedInstance.getPath(),
1489                                  false,
1490                                  true,
1491                                  true,
1492                                  CIMPropertyList(),
1493                                  false);
1494 mike           1.55  
1495 kumpf          1.200         CIMConstInstance givenInstance = modifiedInstance;
1496 mike           1.51  
1497                              // NOTE: Instance qualifiers are not changed when a property list
1498                              // is specified.  Property qualifiers are replaced with the
1499                              // corresponding property values.
1500                      
1501                              //
1502                              // Loop through the propertyList replacing each property in the original
1503                              //
1504 mike           1.53  
1505 kumpf          1.74          for (Uint32 i=0; i<propertyList.size(); i++)
1506 mike           1.51          {
1507 kumpf          1.74              Uint32 origPropPos = cimInstance.findProperty(propertyList[i]);
1508 mike           1.51              if (origPropPos != PEG_NOT_FOUND)
1509                                  {
1510                                      // Case: Property set in original
1511                                      CIMProperty origProperty =
1512                                          cimInstance.getProperty(origPropPos);
1513                      
1514                                      // Get the given property value
1515                                      Uint32 givenPropPos =
1516 kumpf          1.74                      givenInstance.findProperty(propertyList[i]);
1517 mike           1.51                  if (givenPropPos != PEG_NOT_FOUND)
1518                                      {
1519                                          // Case: Property set in original and given
1520 kumpf          1.200                     CIMConstProperty givenProperty =
1521 mike           1.51                          givenInstance.getProperty(givenPropPos);
1522                      
1523                                          // Copy over the property from the given to the original
1524                                          if (includeQualifiers)
1525                                          {
1526                                              // Case: Total property replacement
1527                                              cimInstance.removeProperty(origPropPos);
1528 kumpf          1.200                         cimInstance.addProperty(givenProperty.clone());
1529 mike           1.51                      }
1530                                          else
1531                                          {
1532                                              // Case: Replace only the property value (not quals)
1533                                              origProperty.setValue(givenProperty.getValue());
1534                                              cimInstance.removeProperty(origPropPos);
1535                                              cimInstance.addProperty(origProperty);
1536                                          }
1537                                      }
1538                                      else
1539                                      {
1540                                          // Case: Property set in original and not in given
1541                                          // Just remove the property (set to null)
1542                                          cimInstance.removeProperty(origPropPos);
1543                                      }
1544                                  }
1545                                  else
1546                                  {
1547                                      // Case: Property not set in original
1548                      
1549                                      // Get the given property value
1550 mike           1.51                  Uint32 givenPropPos =
1551 kumpf          1.74                      givenInstance.findProperty(propertyList[i]);
1552 mike           1.51                  if (givenPropPos != PEG_NOT_FOUND)
1553                                      {
1554                                          // Case: Property set in given and not in original
1555 kumpf          1.200                     CIMConstProperty givenProperty =
1556 mike           1.51                          givenInstance.getProperty(givenPropPos);
1557                      
1558                                          // Copy over the property from the given to the original
1559                                          if (includeQualifiers)
1560                                          {
1561                                              // Case: Total property copy
1562 kumpf          1.200                         cimInstance.addProperty(givenProperty.clone());
1563 mike           1.51                      }
1564                                          else
1565                                          {
1566                                              // Case: Copy only the property value (not qualifiers)
1567                                              CIMProperty newProperty(
1568                                                  givenProperty.getName(),
1569                                                  givenProperty.getValue(),
1570                                                  givenProperty.getArraySize(),
1571                                                  givenProperty.getReferenceClassName(),
1572                                                  givenProperty.getClassOrigin(),
1573                                                  givenProperty.getPropagated());
1574                                              cimInstance.addProperty(newProperty);
1575                                          }
1576                                      }
1577                                      else
1578                                      {
1579                                          // Case: Property not set in original or in given
1580                      
1581                                          // Nothing to do; just make sure the property name is valid
1582                                          // ATTN: This is not the most efficient solution
1583                                          CIMClass cimClass = getClass(
1584 mike           1.51                          nameSpace, cimInstance.getClassName(), false);
1585 kumpf          1.74                      if (cimClass.findProperty(propertyList[i]) == PEG_NOT_FOUND)
1586 mike           1.51                      {
1587                                              // ATTN: This exception may be returned by setProperty
1588 kumpf          1.58                          PEG_METHOD_EXIT();
1589 mike           1.51                          throw PEGASUS_CIM_EXCEPTION(
1590                                                  CIM_ERR_NO_SUCH_PROPERTY, "modifyInstance()");
1591                                          }
1592                                      }
1593                                  }
1594                              }
1595                          }
1596                      
1597 kumpf          1.189     CIMObjectPath normalizedInstanceName =
1598                              _stripInstanceName(nameSpace, modifiedInstance.getPath());
1599 kumpf          1.168 
1600                          //
1601 kumpf          1.189     // Resolve the instance (do not propagate qualifiers from class since
1602                          // this will bloat the instance).
1603 mike           1.53      //
1604                      
1605 kumpf          1.189     CIMConstClass cimClass;
1606                          Resolver::resolveInstance(
1607                              cimInstance, _rep->_context, nameSpace, cimClass, false);
1608 mike           1.48  
1609 mike           1.53      //
1610 kumpf          1.189     // Disallow operation if the instance name was changed:
1611 mike           1.53      //
1612                      
1613 kumpf          1.189     if (cimInstance.buildPath(cimClass) != normalizedInstanceName)
1614 mike           1.51      {
1615 kumpf          1.104         PEG_METHOD_EXIT();
1616                              throw PEGASUS_CIM_EXCEPTION_L(CIM_ERR_FAILED,
1617                                  MessageLoaderParms(
1618 kumpf          1.189                 "Repository.CIMRepository.ATTEMPT_TO_MODIFY_KEY_PROPERTY",
1619                                      "Attempted to modify a key property"));
1620 dmitry.mikulin 1.179     }
1621                      
1622 kumpf          1.189     _rep->_persistentStore->modifyInstance(
1623                              nameSpace, normalizedInstanceName, cimInstance);
1624 mike           1.54  
1625 kumpf          1.58      PEG_METHOD_EXIT();
1626 mike           1.48  }
1627                      
1628                      Array<CIMClass> CIMRepository::enumerateClasses(
1629 kumpf          1.85      const CIMNamespaceName& nameSpace,
1630                          const CIMName& className,
1631 mike           1.48      Boolean deepInheritance,
1632                          Boolean localOnly,
1633                          Boolean includeQualifiers,
1634                          Boolean includeClassOrigin)
1635                      {
1636 kumpf          1.58      PEG_METHOD_ENTER(TRC_REPOSITORY, "CIMRepository::enumerateClasses");
1637 mike           1.51  
1638 mike           1.184     ReadLock lock(_rep->_lock);
1639 kumpf          1.104 
1640 kumpf          1.85      Array<CIMName> classNames;
1641 mike           1.48  
1642 kumpf          1.192     _rep->_nameSpaceManager.getSubClassNames(
1643 mike           1.51          nameSpace, className, deepInheritance, classNames);
1644 mike           1.48  
1645                          Array<CIMClass> result;
1646                      
1647                          for (Uint32 i = 0; i < classNames.size(); i++)
1648                          {
1649 kumpf          1.104         result.append(_getClass(nameSpace, classNames[i], localOnly,
1650                                  includeQualifiers, includeClassOrigin, CIMPropertyList()));
1651 mike           1.48      }
1652                      
1653 kumpf          1.58      PEG_METHOD_EXIT();
1654 mike           1.48      return result;
1655                      }
1656                      
1657 kumpf          1.85  Array<CIMName> CIMRepository::enumerateClassNames(
1658                          const CIMNamespaceName& nameSpace,
1659                          const CIMName& className,
1660 mike           1.48      Boolean deepInheritance)
1661                      {
1662 kumpf          1.59      PEG_METHOD_ENTER(TRC_REPOSITORY, "CIMRepository::enumerateClassNames");
1663 kumpf          1.58  
1664 mike           1.184     ReadLock lock(_rep->_lock);
1665 kumpf          1.104 
1666 kumpf          1.85      Array<CIMName> classNames;
1667 mike           1.48  
1668 kumpf          1.192     _rep->_nameSpaceManager.getSubClassNames(
1669 schuur         1.112         nameSpace, className, deepInheritance, classNames,true);
1670 mike           1.48  
1671 kumpf          1.58      PEG_METHOD_EXIT();
1672 mike           1.48      return classNames;
1673                      }
1674                      
1675 kumpf          1.163 Array<CIMInstance> CIMRepository::enumerateInstancesForSubtree(
1676 kumpf          1.85      const CIMNamespaceName& nameSpace,
1677                          const CIMName& className,
1678 mike           1.48      Boolean deepInheritance,
1679                          Boolean localOnly,
1680                          Boolean includeQualifiers,
1681                          Boolean includeClassOrigin,
1682 mike           1.51      const CIMPropertyList& propertyList)
1683 mike           1.48  {
1684 kumpf          1.163     PEG_METHOD_ENTER(TRC_REPOSITORY,
1685                              "CIMRepository::enumerateInstancesForSubtree");
1686 kumpf          1.104 
1687 mike           1.184     // It is not necessary to control access to the ReadWriteSem lock here.
1688 kumpf          1.104     // This method calls enumerateInstancesForClass, which does its own
1689                          // access control.
1690                      
1691 karl           1.69      //
1692                          // Get all descendent classes of this class:
1693                          //
1694                      
1695 kumpf          1.85      Array<CIMName> classNames;
1696 kumpf          1.94      classNames.append(className);
1697 kumpf          1.192     _rep->_nameSpaceManager.getSubClassNames(
1698 mike           1.184         nameSpace, className, true, classNames);
1699 karl           1.69  
1700                          //
1701                          // Get all instances for this class and all its descendent classes
1702                          //
1703 kumpf          1.58  
1704 kumpf          1.70      Array<CIMInstance> namedInstances;
1705 kumpf          1.104 
1706 karl           1.69      for (Uint32 i = 0; i < classNames.size(); i++)
1707 karl           1.65      {
1708 karl           1.101         Array<CIMInstance> localNamedInstances =
1709 kumpf          1.163             enumerateInstancesForClass(nameSpace, classNames[i],
1710                                      false, includeQualifiers, includeClassOrigin, propertyList);
1711                      
1712 kumpf          1.198         // The propertyList, includeQualifiers, and includeClassOrigin 
1713                              // filtering is done in enumerateInstancesForClass.  localOnly
1714                              // filtering is not performed, since this flag is deprecated and
1715                              // is not supported for instance operations.
1716                              // ATTN: deepInheritance filtering is not performed.
1717                      
1718 karl           1.101         namedInstances.appendArray(localNamedInstances);
1719 karl           1.65      }
1720 karl           1.98  
1721 karl           1.65      PEG_METHOD_EXIT();
1722                          return namedInstances;
1723 karl           1.69  }
1724 karl           1.65  
1725 kumpf          1.70  Array<CIMInstance> CIMRepository::enumerateInstancesForClass(
1726 kumpf          1.85      const CIMNamespaceName& nameSpace,
1727                          const CIMName& className,
1728 karl           1.69      Boolean localOnly,
1729                          Boolean includeQualifiers,
1730                          Boolean includeClassOrigin,
1731                          const CIMPropertyList& propertyList)
1732                      {
1733 kumpf          1.104     PEG_METHOD_ENTER(TRC_REPOSITORY,
1734 kumpf          1.163         "CIMRepository::enumerateInstancesForClass");
1735 kumpf          1.104 
1736 mike           1.184     ReadLock lock(_rep->_lock);
1737 kumpf          1.104 
1738 kumpf          1.192     _rep->_nameSpaceManager.validateClass(nameSpace, className);
1739 kumpf          1.189 
1740 mike           1.53      //
1741 kumpf          1.163     // Get all instances for this class
1742 mike           1.53      //
1743 mike           1.48  
1744 kumpf          1.189     Array<CIMInstance> namedInstances =
1745                              _rep->_persistentStore->enumerateInstancesForClass(
1746                                  nameSpace, className);
1747 mike           1.48  
1748 kumpf          1.163     // Do any required filtering of properties, qualifiers, classorigin
1749                          // on the returned instances.
1750                          for (Uint32 i = 0 ; i < namedInstances.size(); i++)
1751                          {
1752 kumpf          1.198         if (includeQualifiers)
1753                              {
1754                                  // Instances are resolved in persistent storage by the
1755                                  // createInstance and modifyInstance operations, but qualifiers
1756                                  // are not propagated.  The only reason to perform resolution
1757                                  // here is if qualifiers are requested in the instance.
1758                                  Resolver::resolveInstance(
1759                                      namedInstances[i], _rep->_context, nameSpace, true);
1760                              }
1761 kumpf          1.189 
1762 kumpf          1.163         _filterInstance(namedInstances[i],
1763                                  propertyList,
1764                                  localOnly,
1765                                  includeQualifiers,
1766                                  includeClassOrigin);
1767                          }
1768                      
1769 kumpf          1.58      PEG_METHOD_EXIT();
1770 mike           1.51      return namedInstances;
1771 mike           1.48  }
1772 kumpf          1.104 
1773 kumpf          1.163 Array<CIMObjectPath> CIMRepository::enumerateInstanceNamesForSubtree(
1774 kumpf          1.85      const CIMNamespaceName& nameSpace,
1775                          const CIMName& className)
1776 mike           1.48  {
1777 kumpf          1.163     PEG_METHOD_ENTER(TRC_REPOSITORY,
1778                              "CIMRepository::enumerateInstanceNamesForSubtree");
1779 mike           1.51  
1780 mike           1.184     // It is not necessary to control access to the ReadWriteSem lock here.
1781 kumpf          1.165     // This method calls enumerateInstanceNamesForClass, which does its own
1782                          // access control.
1783 kumpf          1.104 
1784 karl           1.65      //
1785 karl           1.69      // Get names of descendent classes:
1786 karl           1.65      //
1787 kumpf          1.165 
1788 kumpf          1.85      Array<CIMName> classNames;
1789 kumpf          1.94      classNames.append(className);
1790 kumpf          1.192     _rep->_nameSpaceManager.getSubClassNames(
1791 mike           1.184         nameSpace, className, true, classNames);
1792 karl           1.65  
1793                          //
1794 kumpf          1.165     // Enumerate instance names for each of the subclasses
1795 karl           1.65      //
1796 karl           1.69      Array<CIMObjectPath> instanceNames;
1797 karl           1.65  
1798 karl           1.69      for (Uint32 i = 0; i < classNames.size(); i++)
1799                          {
1800 kumpf          1.165         instanceNames.appendArray(
1801                                  enumerateInstanceNamesForClass(nameSpace, classNames[i]));
1802 karl           1.65      }
1803                      
1804 karl           1.69      PEG_METHOD_EXIT();
1805                          return instanceNames;
1806                      }
1807                      
1808                      Array<CIMObjectPath> CIMRepository::enumerateInstanceNamesForClass(
1809 kumpf          1.85      const CIMNamespaceName& nameSpace,
1810 kumpf          1.163     const CIMName& className)
1811 karl           1.69  {
1812 kumpf          1.104     PEG_METHOD_ENTER(TRC_REPOSITORY,
1813 kumpf          1.163         "CIMRepository::enumerateInstanceNamesForClass");
1814 kumpf          1.104 
1815 mike           1.184     ReadLock lock(_rep->_lock);
1816 karl           1.69  
1817 kumpf          1.192     _rep->_nameSpaceManager.validateClass(nameSpace, className);
1818 mike           1.48  
1819 kumpf          1.189     Array<CIMObjectPath> instanceNames =
1820                              _rep->_persistentStore->enumerateInstanceNamesForClass(
1821                                  nameSpace, className);
1822 mike           1.53  
1823 kumpf          1.52      PEG_METHOD_EXIT();
1824 mike           1.48      return instanceNames;
1825                      }
1826 karl           1.69  
1827 mike           1.48  
1828 kumpf          1.71  Array<CIMObject> CIMRepository::associators(
1829 kumpf          1.85      const CIMNamespaceName& nameSpace,
1830 kumpf          1.68      const CIMObjectPath& objectName,
1831 kumpf          1.85      const CIMName& assocClass,
1832                          const CIMName& resultClass,
1833 mike           1.48      const String& role,
1834                          const String& resultRole,
1835                          Boolean includeQualifiers,
1836                          Boolean includeClassOrigin,
1837 mike           1.51      const CIMPropertyList& propertyList)
1838 mike           1.48  {
1839 kumpf          1.58      PEG_METHOD_ENTER(TRC_REPOSITORY, "CIMRepository::associators");
1840                      
1841 mike           1.184     ReadLock lock(_rep->_lock);
1842 kumpf          1.104 
1843                          Array<CIMObjectPath> names = _associatorNames(
1844 mike           1.51          nameSpace,
1845                              objectName,
1846                              assocClass,
1847                              resultClass,
1848                              role,
1849                              resultRole);
1850 mike           1.48  
1851 kumpf          1.71      Array<CIMObject> result;
1852 mike           1.48  
1853                          for (Uint32 i = 0, n = names.size(); i < n; i++)
1854                          {
1855 kumpf          1.85          CIMNamespaceName tmpNameSpace = names[i].getNameSpace();
1856 mike           1.48  
1857 kumpf          1.85          if (tmpNameSpace.isNull())
1858 mike           1.51              tmpNameSpace = nameSpace;
1859 mike           1.48  
1860 kumpf          1.80          //
1861                              //  ATTN-CAKG-P2-20020726:  The following condition does not correctly
1862                              //  distinguish instanceNames from classNames in every case
1863                              //  The instanceName of a singleton instance of a keyless class also
1864                              //  has no key bindings
1865                              //
1866                              if (names[i].getKeyBindings ().size () == 0)
1867 mike           1.51          {
1868 kumpf          1.68              CIMObjectPath tmpRef = names[i];
1869 mike           1.51              tmpRef.setHost(String());
1870 kumpf          1.95              tmpRef.setNameSpace(CIMNamespaceName());
1871 mike           1.51  
1872 kumpf          1.104             CIMClass cimClass = _getClass(
1873 mike           1.51                  tmpNameSpace,
1874                                      tmpRef.getClassName(),
1875                                      false,
1876                                      includeQualifiers,
1877                                      includeClassOrigin,
1878                                      propertyList);
1879                      
1880                                  CIMObject cimObject(cimClass);
1881 kumpf          1.71              cimObject.setPath (names[i]);
1882                                  result.append(cimObject);
1883 mike           1.51          }
1884                              else
1885                              {
1886 kumpf          1.68              CIMObjectPath tmpRef = names[i];
1887 mike           1.51              tmpRef.setHost(String());
1888 kumpf          1.95              tmpRef.setNameSpace(CIMNamespaceName());
1889 mike           1.51  
1890 kumpf          1.104             CIMInstance cimInstance = _getInstance(
1891 mike           1.51                  tmpNameSpace,
1892                                      tmpRef,
1893                                      false,
1894                                      includeQualifiers,
1895                                      includeClassOrigin,
1896 kumpf          1.191                 propertyList,
1897                                      true);
1898 mike           1.51  
1899                                  CIMObject cimObject(cimInstance);
1900 kumpf          1.71              cimObject.setPath (names[i]);
1901                                  result.append(cimObject);
1902 mike           1.51          }
1903 mike           1.48      }
1904                      
1905 kumpf          1.58      PEG_METHOD_EXIT();
1906 mike           1.48      return result;
1907                      }
1908                      
1909 kumpf          1.68  Array<CIMObjectPath> CIMRepository::associatorNames(
1910 kumpf          1.85      const CIMNamespaceName& nameSpace,
1911 kumpf          1.68      const CIMObjectPath& objectName,
1912 kumpf          1.85      const CIMName& assocClass,
1913                          const CIMName& resultClass,
1914 mike           1.48      const String& role,
1915                          const String& resultRole)
1916                      {
1917 kumpf          1.58      PEG_METHOD_ENTER(TRC_REPOSITORY, "CIMRepository::associatorNames");
1918 mike           1.51  
1919 mike           1.184     ReadLock lock(_rep->_lock);
1920 kumpf          1.104     Array<CIMObjectPath> result = _associatorNames(
1921                              nameSpace, objectName, assocClass, resultClass, role, resultRole);
1922                      
1923                          PEG_METHOD_EXIT();
1924                          return result;
1925                      }
1926                      
1927                      Array<CIMObjectPath> CIMRepository::_associatorNames(
1928                          const CIMNamespaceName& nameSpace,
1929                          const CIMObjectPath& objectName,
1930                          const CIMName& assocClass,
1931                          const CIMName& resultClass,
1932                          const String& role,
1933                          const String& resultRole)
1934                      {
1935                          PEG_METHOD_ENTER(TRC_REPOSITORY, "CIMRepository::_associatorNames");
1936                      
1937 mike           1.48      Array<String> associatorNames;
1938                      
1939 kumpf          1.93      // The assocClass parameter implies subclasses, so retrieve them
1940                          Array<CIMName> assocClassList;
1941                          if (!assocClass.isNull())
1942                          {
1943 kumpf          1.192         _rep->_nameSpaceManager.getSubClassNames(
1944 kumpf          1.93              nameSpace, assocClass, true, assocClassList);
1945                              assocClassList.append(assocClass);
1946                          }
1947                      
1948                          // The resultClass parameter implies subclasses, so retrieve them
1949                          Array<CIMName> resultClassList;
1950                          if (!resultClass.isNull())
1951                          {
1952 kumpf          1.192         _rep->_nameSpaceManager.getSubClassNames(
1953 kumpf          1.93              nameSpace, resultClass, true, resultClassList);
1954                              resultClassList.append(resultClass);
1955                          }
1956                      
1957 kumpf          1.80      //
1958                          //  ATTN-CAKG-P2-20020726:  The following condition does not correctly
1959                          //  distinguish instanceNames from classNames in every case
1960                          //  The instanceName of a singleton instance of a keyless class also
1961                          //  has no key bindings
1962                          //
1963                          if (objectName.getKeyBindings ().size () == 0)
1964 mike           1.48      {
1965 kumpf          1.93          CIMName className = objectName.getClassName();
1966                      
1967                              Array<CIMName> classList;
1968 kumpf          1.192         _rep->_nameSpaceManager.getSuperClassNames(
1969 mike           1.184             nameSpace, className, classList);
1970 kumpf          1.93          classList.append(className);
1971                      
1972 kumpf          1.189         Array<CIMNamespaceName> nameSpaceList =
1973 kumpf          1.192             _rep->_nameSpaceManager.getSchemaNameSpaceNames(nameSpace);
1974 mike           1.48  
1975 kumpf          1.189         for (Uint32 i = 0; i < nameSpaceList.size(); i++)
1976 kumpf          1.169         {
1977 kumpf          1.189             Array<String> associatorNamesForNameSpace;
1978                      
1979                                  _rep->_persistentStore->getClassAssociatorNames(
1980                                      nameSpaceList[i],
1981 kumpf          1.169                 classList,
1982                                      assocClassList,
1983                                      resultClassList,
1984                                      role,
1985                                      resultRole,
1986 kumpf          1.189                 associatorNamesForNameSpace);
1987                      
1988                                  associatorNames.appendArray(associatorNamesForNameSpace);
1989 kumpf          1.169         }
1990 mike           1.48      }
1991 kumpf          1.169     else
1992                          {
1993 kumpf          1.192         _rep->_nameSpaceManager.validateClass(
1994 kumpf          1.189             nameSpace, objectName.getClassName());
1995 mike           1.48  
1996 kumpf          1.189         _rep->_persistentStore->getInstanceAssociatorNames(
1997                                  nameSpace,
1998 mike           1.51              objectName,
1999 kumpf          1.93              assocClassList,
2000                                  resultClassList,
2001 mike           1.51              role,
2002                                  resultRole,
2003                                  associatorNames);
2004 mike           1.48      }
2005                      
2006 kumpf          1.68      Array<CIMObjectPath> result;
2007 mike           1.48  
2008                          for (Uint32 i = 0, n = associatorNames.size(); i < n; i++)
2009                          {
2010 kumpf          1.68          CIMObjectPath r = associatorNames[i];
2011 mike           1.48  
2012                              if (r.getHost().size() == 0)
2013                                  r.setHost(System::getHostName());
2014                      
2015 kumpf          1.79          if (r.getNameSpace().isNull())
2016 mike           1.48              r.setNameSpace(nameSpace);
2017                      
2018 mike           1.51          result.append(r);
2019 mike           1.48      }
2020                      
2021 kumpf          1.58      PEG_METHOD_EXIT();
2022 mike           1.48      return result;
2023                      }
2024                      
2025 kumpf          1.71  Array<CIMObject> CIMRepository::references(
2026 kumpf          1.85      const CIMNamespaceName& nameSpace,
2027 kumpf          1.68      const CIMObjectPath& objectName,
2028 kumpf          1.85      const CIMName& resultClass,
2029 mike           1.48      const String& role,
2030                          Boolean includeQualifiers,
2031                          Boolean includeClassOrigin,
2032 mike           1.51      const CIMPropertyList& propertyList)
2033 mike           1.48  {
2034 kumpf          1.58      PEG_METHOD_ENTER(TRC_REPOSITORY, "CIMRepository::references");
2035                      
2036 mike           1.184     ReadLock lock(_rep->_lock);
2037 kumpf          1.104 
2038                          Array<CIMObjectPath> names = _referenceNames(
2039 mike           1.51          nameSpace,
2040                              objectName,
2041                              resultClass,
2042                              role);
2043 mike           1.48  
2044 kumpf          1.71      Array<CIMObject> result;
2045 mike           1.48  
2046                          for (Uint32 i = 0, n = names.size(); i < n; i++)
2047                          {
2048 kumpf          1.85          CIMNamespaceName tmpNameSpace = names[i].getNameSpace();
2049 mike           1.48  
2050 kumpf          1.85          if (tmpNameSpace.isNull())
2051 mike           1.51              tmpNameSpace = nameSpace;
2052 mike           1.48  
2053 mike           1.51          // ATTN: getInstance() should this be able to handle instance names
2054                              // with host names and namespaces?
2055 mike           1.48  
2056 kumpf          1.68          CIMObjectPath tmpRef = names[i];
2057 mike           1.51          tmpRef.setHost(String());
2058 kumpf          1.95          tmpRef.setNameSpace(CIMNamespaceName());
2059 mike           1.51  
2060 kumpf          1.80          //
2061                              //  ATTN-CAKG-P2-20020726:  The following condition does not correctly
2062                              //  distinguish instanceNames from classNames in every case
2063                              //  The instanceName of a singleton instance of a keyless class also
2064                              //  has no key bindings
2065                              //
2066                              if (objectName.getKeyBindings ().size () == 0)
2067 mike           1.51          {
2068 kumpf          1.104             CIMClass cimClass = _getClass(
2069 mike           1.51                  tmpNameSpace,
2070                                      tmpRef.getClassName(),
2071                                      false,
2072                                      includeQualifiers,
2073                                      includeClassOrigin,
2074                                      propertyList);
2075                      
2076 kumpf          1.71              CIMObject cimObject = CIMObject (cimClass);
2077                                  cimObject.setPath (names[i]);
2078                                  result.append (cimObject);
2079 mike           1.51          }
2080                              else
2081                              {
2082 kumpf          1.104             CIMInstance instance = _getInstance(
2083 mike           1.51                  tmpNameSpace,
2084                                      tmpRef,
2085                                      false,
2086                                      includeQualifiers,
2087                                      includeClassOrigin,
2088 kumpf          1.191                 propertyList,
2089                                      true);
2090 mike           1.48  
2091 kumpf          1.71              CIMObject cimObject = CIMObject (instance);
2092                                  cimObject.setPath (names[i]);
2093                                  result.append (cimObject);
2094 mike           1.51          }
2095 mike           1.48      }
2096                      
2097 kumpf          1.58      PEG_METHOD_EXIT();
2098 mike           1.48      return result;
2099                      }
2100                      
2101 kumpf          1.68  Array<CIMObjectPath> CIMRepository::referenceNames(
2102 kumpf          1.85      const CIMNamespaceName& nameSpace,
2103 kumpf          1.68      const CIMObjectPath& objectName,
2104 kumpf          1.85      const CIMName& resultClass,
2105 mike           1.48      const String& role)
2106                      {
2107 kumpf          1.58      PEG_METHOD_ENTER(TRC_REPOSITORY, "CIMRepository::referenceNames");
2108                      
2109 mike           1.184     ReadLock lock(_rep->_lock);
2110 kumpf          1.104     Array<CIMObjectPath> result = _referenceNames(
2111                              nameSpace, objectName, resultClass, role);
2112                      
2113                          PEG_METHOD_EXIT();
2114                          return result;
2115                      }
2116                      
2117                      Array<CIMObjectPath> CIMRepository::_referenceNames(
2118                          const CIMNamespaceName& nameSpace,
2119                          const CIMObjectPath& objectName,
2120                          const CIMName& resultClass,
2121                          const String& role)
2122                      {
2123                          PEG_METHOD_ENTER(TRC_REPOSITORY, "CIMRepository::_referenceNames");
2124                      
2125 mike           1.48      Array<String> tmpReferenceNames;
2126                      
2127 kumpf          1.93      // The resultClass parameter implies subclasses, so retrieve them
2128                          Array<CIMName> resultClassList;
2129 a.dunfey       1.120 
2130 kumpf          1.169     try
2131 kumpf          1.93      {
2132 kumpf          1.169         if (!resultClass.isNull())
2133                              {
2134 kumpf          1.192             _rep->_nameSpaceManager.getSubClassNames(
2135 kumpf          1.169                 nameSpace, resultClass, true, resultClassList);
2136                                  resultClassList.append(resultClass);
2137                              }
2138 karl           1.86  
2139 kumpf          1.169         //  ATTN-CAKG-P2-20020726:  The following condition does not correctly
2140                              //  distinguish instanceNames from classNames in every case
2141                              //  The instanceName of a singleton instance of a keyless class also
2142                              //  has no key bindings
2143                              //
2144                              if (objectName.getKeyBindings ().size () == 0)
2145                              {
2146                                  CIMName className = objectName.getClassName();
2147 kumpf          1.93  
2148 kumpf          1.169             Array<CIMName> classList;
2149 kumpf          1.192             _rep->_nameSpaceManager.getSuperClassNames(
2150 kumpf          1.169                 nameSpace, className, classList);
2151                                  classList.append(className);
2152 kumpf          1.93  
2153 kumpf          1.189             Array<CIMNamespaceName> nameSpaceList =
2154 kumpf          1.192                 _rep->_nameSpaceManager.getSchemaNameSpaceNames(nameSpace);
2155 mike           1.48  
2156 kumpf          1.189             for (Uint32 i = 0; i < nameSpaceList.size(); i++)
2157 kumpf          1.169             {
2158 kumpf          1.189                 Array<String> referenceNamesForNameSpace;
2159                      
2160                                      _rep->_persistentStore->getClassReferenceNames(
2161                                          nameSpaceList[i],
2162                                          classList,
2163                                          resultClassList,
2164                                          role,
2165                                          referenceNamesForNameSpace);
2166 schuur         1.112 
2167 kumpf          1.189                 tmpReferenceNames.appendArray(referenceNamesForNameSpace);
2168 kumpf          1.169             }
2169 mike           1.51          }
2170 kumpf          1.169         else
2171                              {
2172 kumpf          1.192             _rep->_nameSpaceManager.validateClass(
2173 kumpf          1.189                 nameSpace, objectName.getClassName());
2174 schuur         1.112 
2175 kumpf          1.189             _rep->_persistentStore->getInstanceReferenceNames(
2176                                      nameSpace,
2177 kumpf          1.169                 objectName,
2178                                      resultClassList,
2179                                      role,
2180 kumpf          1.189                 tmpReferenceNames);
2181 mike           1.51          }
2182 mike           1.48      }
2183 kumpf          1.169     catch (const CIMException& exception)
2184 kumpf          1.142     {
2185 kumpf          1.169         if (exception.getCode() == CIM_ERR_INVALID_CLASS)
2186                              {
2187                                  throw PEGASUS_CIM_EXCEPTION(
2188                                      CIM_ERR_INVALID_PARAMETER, exception.getMessage());
2189                              }
2190                              else
2191                              {
2192                                  throw;
2193                              }
2194 kumpf          1.142     }
2195 mike           1.48  
2196 kumpf          1.68      Array<CIMObjectPath> result;
2197 mike           1.48  
2198                          for (Uint32 i = 0, n = tmpReferenceNames.size(); i < n; i++)
2199                          {
2200 kumpf          1.68          CIMObjectPath r = tmpReferenceNames[i];
2201 mike           1.48  
2202                              if (r.getHost().size() == 0)
2203                                  r.setHost(System::getHostName());
2204                      
2205 kumpf          1.79          if (r.getNameSpace().isNull())
2206 mike           1.48              r.setNameSpace(nameSpace);
2207                      
2208 mike           1.51          result.append(r);
2209 mike           1.48      }
2210                      
2211 kumpf          1.58      PEG_METHOD_EXIT();
2212 mike           1.48      return result;
2213                      }
2214                      
2215                      CIMValue CIMRepository::getProperty(
2216 kumpf          1.85      const CIMNamespaceName& nameSpace,
2217 kumpf          1.68      const CIMObjectPath& instanceName,
2218 kumpf          1.85      const CIMName& propertyName)
2219 mike           1.48  {
2220 kumpf          1.58      PEG_METHOD_ENTER(TRC_REPOSITORY, "CIMRepository::getProperty");
2221                      
2222 mike           1.184     ReadLock lock(_rep->_lock);
2223 kumpf          1.104 
2224 mike           1.53      //
2225 kumpf          1.165     // Retrieve the specified instance
2226 mike           1.53      //
2227 mike           1.48  
2228 kumpf          1.165     CIMInstance cimInstance = _getInstance(
2229 kumpf          1.198         nameSpace, instanceName, false, true, true, CIMPropertyList(), false);
2230 mike           1.48  
2231 mike           1.53      //
2232 kumpf          1.165     // Get the requested property from the instance
2233 mike           1.53      //
2234 mike           1.48  
2235                          Uint32 pos = cimInstance.findProperty(propertyName);
2236                      
2237 mike           1.51      // ATTN: This breaks if the property is simply null
2238 kumpf          1.77      if (pos == PEG_NOT_FOUND)
2239 kumpf          1.58      {
2240                              PEG_METHOD_EXIT();
2241 kumpf          1.149         throw PEGASUS_CIM_EXCEPTION(
2242                                  CIM_ERR_NO_SUCH_PROPERTY,
2243                                  propertyName.getString());
2244 kumpf          1.58      }
2245 mike           1.48  
2246                          CIMProperty prop = cimInstance.getProperty(pos);
2247                      
2248 mike           1.53      //
2249                          // Return the value:
2250                          //
2251 mike           1.48  
2252 kumpf          1.58      PEG_METHOD_EXIT();
2253 mike           1.48      return prop.getValue();
2254                      }
2255                      
2256                      void CIMRepository::setProperty(
2257 kumpf          1.85      const CIMNamespaceName& nameSpace,
2258 kumpf          1.68      const CIMObjectPath& instanceName,
2259 kumpf          1.85      const CIMName& propertyName,
2260 kumpf          1.199     const CIMValue& newValue)
2261 mike           1.48  {
2262 kumpf          1.58      PEG_METHOD_ENTER(TRC_REPOSITORY, "CIMRepository::setProperty");
2263                      
2264 mike           1.184     // It is not necessary to control access to the ReadWriteSem lock here.
2265 kumpf          1.104     // This method calls modifyInstance, which does its own access control.
2266                      
2267 mike           1.51      //
2268                          // Create the instance to pass to modifyInstance()
2269                          //
2270 mike           1.53  
2271 mike           1.51      CIMInstance instance(instanceName.getClassName());
2272                          instance.addProperty(CIMProperty(propertyName, newValue));
2273 kumpf          1.70      instance.setPath (instanceName);
2274 mike           1.51  
2275                          //
2276                          // Create the propertyList to pass to modifyInstance()
2277                          //
2278 mike           1.53  
2279 kumpf          1.79      Array<CIMName> propertyListArray;
2280 mike           1.51      propertyListArray.append(propertyName);
2281                          CIMPropertyList propertyList(propertyListArray);
2282                      
2283                          //
2284                          // Modify the instance to set the value of the given property
2285                          //
2286 kumpf          1.70      modifyInstance(nameSpace, instance, false, propertyList);
2287 kumpf          1.58  
2288                          PEG_METHOD_EXIT();
2289 mike           1.48  }
2290                      
2291                      CIMQualifierDecl CIMRepository::getQualifier(
2292 kumpf          1.85      const CIMNamespaceName& nameSpace,
2293                          const CIMName& qualifierName)
2294 mike           1.48  {
2295 kumpf          1.58      PEG_METHOD_ENTER(TRC_REPOSITORY, "CIMRepository::getQualifier");
2296                      
2297 mike           1.184     ReadLock lock(_rep->_lock);
2298 kumpf          1.104     CIMQualifierDecl qualifierDecl = _getQualifier(nameSpace, qualifierName);
2299                      
2300                          PEG_METHOD_EXIT();
2301                          return qualifierDecl;
2302                      }
2303                      
2304                      CIMQualifierDecl CIMRepository::_getQualifier(
2305                          const CIMNamespaceName& nameSpace,
2306                          const CIMName& qualifierName)
2307                      {
2308                          PEG_METHOD_ENTER(TRC_REPOSITORY, "CIMRepository::_getQualifier");
2309                      
2310 kumpf          1.189     CIMQualifierDecl qualifierDecl;
2311 mike           1.48  
2312 kumpf          1.189     String qualifierCacheKey = _getCacheKey(nameSpace, qualifierName);
2313 mike           1.48  
2314 kumpf          1.189     // Check the cache first:
2315 mike           1.48  
2316 kumpf          1.204     if (!_rep->_qualifierCache.get(qualifierCacheKey, qualifierDecl))
2317 mike           1.48      {
2318 kumpf          1.189         // Not in cache so load from disk:
2319                      
2320                              Array<CIMNamespaceName> nameSpaceList =
2321 kumpf          1.192             _rep->_nameSpaceManager.getSchemaNameSpaceNames(nameSpace);
2322 mike           1.153 
2323 kumpf          1.189         for (Uint32 i = 0; i < nameSpaceList.size(); i++)
2324 mike           1.153         {
2325 kumpf          1.189             qualifierDecl = _rep->_persistentStore->getQualifier(
2326                                      nameSpaceList[i], qualifierName);
2327 mike           1.153 
2328 kumpf          1.189             if (!qualifierDecl.isUninitialized())
2329                                  {
2330                                      // Put in cache
2331 kumpf          1.204                 _rep->_qualifierCache.put(qualifierCacheKey, qualifierDecl);
2332 mike           1.153 
2333 kumpf          1.189                 PEG_METHOD_EXIT();
2334                                      return qualifierDecl;
2335                                  }
2336                              }
2337 mike           1.153 
2338 kumpf          1.58          PEG_METHOD_EXIT();
2339 kumpf          1.189         throw PEGASUS_CIM_EXCEPTION(
2340                                  CIM_ERR_NOT_FOUND, qualifierName.getString());
2341 mike           1.48      }
2342                      
2343 kumpf          1.58      PEG_METHOD_EXIT();
2344 mike           1.48      return qualifierDecl;
2345                      }
2346                      
2347                      void CIMRepository::setQualifier(
2348 kumpf          1.85      const CIMNamespaceName& nameSpace,
2349 kumpf          1.199     const CIMQualifierDecl& qualifierDecl)
2350 mike           1.48  {
2351 kumpf          1.58      PEG_METHOD_ENTER(TRC_REPOSITORY, "CIMRepository::setQualifier");
2352 chuck          1.110 
2353 mike           1.184     WriteLock lock(_rep->_lock);
2354                          AutoFileLock fileLock(_rep->_lockFile);
2355 kumpf          1.104     _setQualifier(nameSpace, qualifierDecl);
2356                      
2357                          PEG_METHOD_EXIT();
2358                      }
2359                      
2360                      void CIMRepository::_setQualifier(
2361                          const CIMNamespaceName& nameSpace,
2362                          const CIMQualifierDecl& qualifierDecl)
2363                      {
2364                          PEG_METHOD_ENTER(TRC_REPOSITORY, "CIMRepository::_setQualifier");
2365                      
2366 kumpf          1.192     _rep->_nameSpaceManager.checkSetOrDeleteQualifier(
2367 kumpf          1.189         nameSpace, qualifierDecl.getName());
2368 mike           1.48  
2369 kumpf          1.189     _rep->_persistentStore->setQualifier(nameSpace, qualifierDecl);
2370 mike           1.48  
2371 kumpf          1.189     String qualifierCacheKey =
2372                              _getCacheKey(nameSpace, qualifierDecl.getName());
2373 kumpf          1.204     _rep->_qualifierCache.put(
2374                              qualifierCacheKey, (CIMQualifierDecl&)qualifierDecl);
2375 jim.wunderlich 1.136 
2376 kumpf          1.58      PEG_METHOD_EXIT();
2377 mike           1.48  }
2378                      
2379                      void CIMRepository::deleteQualifier(
2380 kumpf          1.85      const CIMNamespaceName& nameSpace,
2381                          const CIMName& qualifierName)
2382 mike           1.48  {
2383 kumpf          1.58      PEG_METHOD_ENTER(TRC_REPOSITORY, "CIMRepository::deleteQualifier");
2384                      
2385 mike           1.184     WriteLock lock(_rep->_lock);
2386                          AutoFileLock fileLock(_rep->_lockFile);
2387 kumpf          1.104 
2388 kumpf          1.192     _rep->_nameSpaceManager.checkSetOrDeleteQualifier(
2389 kumpf          1.189         nameSpace, qualifierName);
2390 mike           1.48  
2391 kumpf          1.189     _rep->_persistentStore->deleteQualifier(nameSpace, qualifierName);
2392 mike           1.48  
2393 kumpf          1.189     String qualifierCacheKey = _getCacheKey(nameSpace, qualifierName);
2394 kumpf          1.204     _rep->_qualifierCache.evict(qualifierCacheKey);
2395 mike           1.153 
2396 kumpf          1.58      PEG_METHOD_EXIT();
2397 mike           1.48  }
2398                      
2399                      Array<CIMQualifierDecl> CIMRepository::enumerateQualifiers(
2400 kumpf          1.85      const CIMNamespaceName& nameSpace)
2401 mike           1.48  {
2402 kumpf          1.58      PEG_METHOD_ENTER(TRC_REPOSITORY, "CIMRepository::enumerateQualifiers");
2403                      
2404 mike           1.184     ReadLock lock(_rep->_lock);
2405 kumpf          1.104 
2406 kumpf          1.189     Array<CIMQualifierDecl> qualifiers;
2407 mike           1.48  
2408 kumpf          1.192     _rep->_nameSpaceManager.validateNameSpace(nameSpace);
2409 mike           1.48  
2410 kumpf          1.189     qualifiers = _rep->_persistentStore->enumerateQualifiers(nameSpace);
2411 mike           1.48  
2412 kumpf          1.58      PEG_METHOD_EXIT();
2413 mike           1.48      return qualifiers;
2414                      }
2415                      
2416 kumpf          1.189 void CIMRepository::createNameSpace(
2417                          const CIMNamespaceName& nameSpace,
2418                          const NameSpaceAttributes& attributes)
2419 mike           1.48  {
2420 kumpf          1.58      PEG_METHOD_ENTER(TRC_REPOSITORY, "CIMRepository::createNameSpace");
2421                      
2422 mike           1.184     WriteLock lock(_rep->_lock);
2423                          AutoFileLock fileLock(_rep->_lockFile);
2424 kumpf          1.189 
2425                          Boolean shareable = false;
2426                          Boolean updatesAllowed = true;
2427                          String parentNameSpace;
2428 venkat.puvvada 1.202     String remoteInfo;
2429 kumpf          1.189 
2430                          for (NameSpaceAttributes::Iterator i = attributes.start(); i; i++)
2431                          {
2432                              String key = i.key();
2433                              if (String::equalNoCase(key, "shareable"))
2434                              {
2435                                  if (String::equalNoCase(i.value(), "true"))
2436                                      shareable = true;
2437                              }
2438                              else if (String::equalNoCase(key, "updatesAllowed"))
2439                              {
2440                                  if (String::equalNoCase(i.value(), "false"))
2441                                      updatesAllowed = false;
2442                              }
2443                              else if (String::equalNoCase(key, "parent"))
2444                              {
2445                                  parentNameSpace = i.value();
2446                              }
2447 venkat.puvvada 1.202         else if (String::equalNoCase(key, "remoteInfo"))
2448                              {
2449                                  remoteInfo = i.value();
2450                              }
2451 kumpf          1.189         else
2452                              {
2453                                  PEG_METHOD_EXIT();
2454                                  throw PEGASUS_CIM_EXCEPTION(
2455                                      CIM_ERR_NOT_SUPPORTED,
2456                                      nameSpace.getString() + " option not supported: " + key);
2457                              }
2458                          }
2459                      
2460 kumpf          1.192     _rep->_nameSpaceManager.createNameSpace(
2461 venkat.puvvada 1.202         nameSpace, shareable, updatesAllowed, parentNameSpace, remoteInfo);
2462 kumpf          1.189 
2463                          try
2464                          {
2465                              _rep->_persistentStore->createNameSpace(
2466 venkat.puvvada 1.202             nameSpace, shareable, updatesAllowed, parentNameSpace, remoteInfo);
2467 kumpf          1.189     }
2468                          catch (...)
2469                          {
2470 kumpf          1.192         _rep->_nameSpaceManager.deleteNameSpace(nameSpace);
2471 kumpf          1.189         throw;
2472                          }
2473 schuur         1.112 
2474                          PEG_METHOD_EXIT();
2475                      }
2476                      
2477 kumpf          1.189 void CIMRepository::modifyNameSpace(
2478                          const CIMNamespaceName& nameSpace,
2479                          const NameSpaceAttributes& attributes)
2480 schuur         1.112 {
2481                          PEG_METHOD_ENTER(TRC_REPOSITORY, "CIMRepository::modifyNameSpace");
2482                      
2483 mike           1.184     WriteLock lock(_rep->_lock);
2484                          AutoFileLock fileLock(_rep->_lockFile);
2485 kumpf          1.189 
2486                          Boolean shareable = false;
2487                          Boolean updatesAllowed = true;
2488                      
2489                          for (NameSpaceAttributes::Iterator i = attributes.start(); i; i++)
2490                          {
2491                              String key = i.key();
2492                              if (String::equalNoCase(key, "shareable"))
2493                              {
2494                                  if (String::equalNoCase(i.value(), "true"))
2495                                      shareable = true;
2496                              }
2497                              else if (String::equalNoCase(key, "updatesAllowed"))
2498                              {
2499                                  if (String::equalNoCase(i.value(),"false"))
2500                                      updatesAllowed = false;
2501                              }
2502                              else
2503                              {
2504                                  PEG_METHOD_EXIT();
2505                                  throw PEGASUS_CIM_EXCEPTION(CIM_ERR_NOT_SUPPORTED,
2506 kumpf          1.189                 nameSpace.getString() + " option not supported: " + key);
2507                              }
2508                          }
2509                      
2510 kumpf          1.192     _rep->_nameSpaceManager.validateNameSpace(nameSpace);
2511 kumpf          1.189 
2512                          if (!shareable)
2513                          {
2514                              // Check for dependent namespaces
2515                      
2516                              CIMNamespaceName dependentNameSpaceName;
2517                      
2518 kumpf          1.192         if (_rep->_nameSpaceManager.hasDependentNameSpace(
2519 kumpf          1.189                 nameSpace, dependentNameSpaceName))
2520                              {
2521                                  PEG_METHOD_EXIT();
2522                                  throw PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED,
2523                                      "Namespace " + nameSpace.getString() +
2524                                          " has dependent namespace " +
2525                                          dependentNameSpaceName.getString());
2526                              }
2527                          }
2528                      
2529                          _rep->_persistentStore->modifyNameSpace(
2530                              nameSpace, shareable, updatesAllowed);
2531                      
2532 kumpf          1.192     _rep->_nameSpaceManager.modifyNameSpace(
2533 kumpf          1.189         nameSpace, shareable, updatesAllowed);
2534 kumpf          1.58  
2535                          PEG_METHOD_EXIT();
2536 mike           1.48  }
2537                      
2538 kumpf          1.85  Array<CIMNamespaceName> CIMRepository::enumerateNameSpaces() const
2539 mike           1.48  {
2540 kumpf          1.58      PEG_METHOD_ENTER(TRC_REPOSITORY, "CIMRepository::enumerateNameSpaces");
2541                      
2542 mike           1.184     ReadLock lock(const_cast<ReadWriteSem&>(_rep->_lock));
2543 kumpf          1.104 
2544 kumpf          1.85      Array<CIMNamespaceName> nameSpaceNames;
2545 kumpf          1.192     _rep->_nameSpaceManager.getNameSpaceNames(nameSpaceNames);
2546 kumpf          1.58  
2547                          PEG_METHOD_EXIT();
2548 mike           1.48      return nameSpaceNames;
2549                      }
2550                      
2551 kumpf          1.85  void CIMRepository::deleteNameSpace(const CIMNamespaceName& nameSpace)
2552 mike           1.48  {
2553 kumpf          1.58      PEG_METHOD_ENTER(TRC_REPOSITORY, "CIMRepository::deleteNameSpace");
2554                      
2555 mike           1.184     WriteLock lock(_rep->_lock);
2556                          AutoFileLock fileLock(_rep->_lockFile);
2557 kumpf          1.58  
2558 kumpf          1.189     // Check for dependent namespaces
2559 mike           1.48  
2560 kumpf          1.189     CIMNamespaceName dependentNameSpaceName;
2561 schuur         1.112 
2562 kumpf          1.192     if (_rep->_nameSpaceManager.hasDependentNameSpace(
2563 kumpf          1.189             nameSpace, dependentNameSpaceName))
2564                          {
2565                              PEG_METHOD_EXIT();
2566                              throw PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED,
2567                                  "Namespace " + nameSpace.getString() +
2568                                      " has dependent namespace " +
2569                                      dependentNameSpaceName.getString());
2570                          }
2571 schuur         1.115 
2572 kumpf          1.189     // Make sure the namespace is empty
2573 mike           1.51  
2574 kumpf          1.189     if (!_rep->_persistentStore->isNameSpaceEmpty(nameSpace))
2575                          {
2576                              PEG_METHOD_EXIT();
2577                              throw NonEmptyNameSpace(nameSpace.getString());
2578                          }
2579 kumpf          1.58  
2580 kumpf          1.189     _rep->_persistentStore->deleteNameSpace(nameSpace);
2581 mike           1.53  
2582 kumpf          1.192     _rep->_nameSpaceManager.deleteNameSpace(nameSpace);
2583 kumpf          1.58  
2584                          PEG_METHOD_EXIT();
2585 mike           1.48  }
2586                      
2587 kumpf          1.189 Boolean CIMRepository::getNameSpaceAttributes(const CIMNamespaceName& nameSpace,
2588                              NameSpaceAttributes& attributes)
2589 mike           1.48  {
2590 kumpf          1.189     PEG_METHOD_ENTER(TRC_REPOSITORY, "CIMRepository::deleteNameSpace");
2591 kumpf          1.58  
2592 kumpf          1.189     ReadLock lock(const_cast<ReadWriteSem&>(_rep->_lock));
2593                          attributes.clear();
2594 mike           1.51  
2595 kumpf          1.189     Boolean shareable;
2596                          Boolean updatesAllowed;
2597                          String parent;
2598 venkat.puvvada 1.202     String remoteInfo;
2599 mike           1.51  
2600 kumpf          1.192     if (!_rep->_nameSpaceManager.getNameSpaceAttributes(
2601 venkat.puvvada 1.202         nameSpace, shareable, updatesAllowed, parent, remoteInfo))
2602 kumpf          1.58      {
2603                              PEG_METHOD_EXIT();
2604 mike           1.51          return false;
2605 kumpf          1.58      }
2606 mike           1.51  
2607 kumpf          1.189     attributes.insert("name", nameSpace.getString());
2608                      
2609                          if (shareable)
2610                              attributes.insert("shareable", "true");
2611                          else
2612                              attributes.insert("shareable", "false");
2613                      
2614                          if (updatesAllowed)
2615                              attributes.insert("updatesAllowed", "true");
2616                          else
2617                              attributes.insert("updatesAllowed", "false");
2618 mike           1.51  
2619 kumpf          1.189     if (parent.size())
2620                              attributes.insert("parent", parent);
2621 mike           1.51  
2622 venkat.puvvada 1.202     if (remoteInfo.size())
2623                              attributes.insert("remoteInfo", remoteInfo);
2624                      
2625 kumpf          1.58      PEG_METHOD_EXIT();
2626 mike           1.51      return true;
2627 mike           1.48  }
2628                      
2629 kumpf          1.189 Boolean CIMRepository::isRemoteNameSpace(
2630                          const CIMNamespaceName& nameSpaceName,
2631                          String& remoteInfo)
2632                      {
2633                          PEG_METHOD_ENTER(TRC_REPOSITORY, "CIMRepository::isRemoteNamespace");
2634                          ReadLock lock(const_cast<ReadWriteSem&>(_rep->_lock));
2635                          PEG_METHOD_EXIT();
2636 kumpf          1.192     return _rep->_nameSpaceManager.isRemoteNameSpace(
2637 kumpf          1.189         nameSpaceName, remoteInfo);
2638                      }
2639 bob            1.49  
2640 dave.sudlik    1.154 #ifdef PEGASUS_DEBUG
2641 kumpf          1.169     void CIMRepository::DisplayCacheStatistics()
2642 dave.sudlik    1.154     {
2643                      #ifdef PEGASUS_USE_CLASS_CACHE
2644                              cout << "Repository Class Cache Statistics:" << endl;
2645 kumpf          1.204         _rep->_classCache.DisplayCacheStatistics();
2646 dave.sudlik    1.154 #endif
2647                              cout << "Repository Qualifier Cache Statistics:" << endl;
2648 kumpf          1.204         _rep->_qualifierCache.DisplayCacheStatistics();
2649 dave.sudlik    1.154     }
2650                      #endif
2651                      
2652 mike           1.184 void CIMRepository::getSubClassNames(
2653                          const CIMNamespaceName& nameSpaceName,
2654                          const CIMName& className,
2655                          Boolean deepInheritance,
2656                          Array<CIMName>& subClassNames) const
2657                      {
2658                          ReadLock lock(const_cast<ReadWriteSem&>(_rep->_lock));
2659 kumpf          1.192     _rep->_nameSpaceManager.getSubClassNames(
2660 kumpf          1.189         nameSpaceName, className, deepInheritance, subClassNames);
2661 mike           1.184 }
2662                      
2663                      void CIMRepository::getSuperClassNames(
2664                          const CIMNamespaceName& nameSpaceName,
2665                          const CIMName& className,
2666                          Array<CIMName>& subClassNames) const
2667                      {
2668                          ReadLock lock(const_cast<ReadWriteSem&>(_rep->_lock));
2669 kumpf          1.192     _rep->_nameSpaceManager.getSuperClassNames(
2670 mike           1.184         nameSpaceName, className, subClassNames);
2671                      }
2672                      
2673                      Boolean CIMRepository::isDefaultInstanceProvider()
2674                      {
2675                          return _rep->_isDefaultInstanceProvider;
2676                      }
2677                      
2678 mike           1.205 CIMConstClass CIMRepository::getFullConstClass(
2679                          const CIMNamespaceName& nameSpace,
2680                          const CIMName& className)
2681                      {
2682                          PEG_METHOD_ENTER(TRC_REPOSITORY, "CIMRepository::getFullConstClass");
2683                      
2684                          ReadLock lock(_rep->_lock);
2685                          CIMClass cimClass = _getClass(nameSpace, className, false, true, true,
2686                              CIMPropertyList(), false);
2687                      
2688                          PEG_METHOD_EXIT();
2689                          return cimClass;
2690                      }
2691                      
2692 mike           1.48  PEGASUS_NAMESPACE_END

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2