(file) Return to RepositoryUpgrade.cpp CVS log (file) (dir) Up to [Pegasus] / pegasus / src / Clients / repupgrade

Diff for /pegasus/src/Clients/repupgrade/RepositoryUpgrade.cpp between version 1.57 and 1.58

version 1.57, 2013/04/09 05:53:06 version 1.58, 2013/05/07 06:57:44
Line 127 
Line 127 
 */ */
 const char   RepositoryUpgrade::_OPTION_HELP         = 'h'; const char   RepositoryUpgrade::_OPTION_HELP         = 'h';
  
   #ifdef NS_INTEROP
   /**
       The constant representing that interop option has been specified
   */
   const Uint32 RepositoryUpgrade::_OPTION_TYPE_INTEROP = 5;
   
   /**
       The option character used to change root/PG_Interop to interop.
   */
   const char   RepositoryUpgrade::_OPTION_INTEROP         = 'i';
   #endif
   
 static const char   LONG_HELP []  = "help"; static const char   LONG_HELP []  = "help";
  
 /** /**
Line 362 
Line 374 
     _usage.append (" old_repository_path");     _usage.append (" old_repository_path");
     _usage.append (" -").append (_OPTION_NEW_REPOSITORY_PATH);     _usage.append (" -").append (_OPTION_NEW_REPOSITORY_PATH);
     _usage.append (" new_repository_path");     _usage.append (" new_repository_path");
   #ifdef NS_INTEROP
       _usage.append (" [-").append (_OPTION_INTEROP).append("]");
   #endif
 #endif #endif
  
     _usage.append("\n");     _usage.append("\n");
Line 394 
Line 409 
  
     _usage.append("    -n              ");     _usage.append("    -n              ");
     _usage.append("- Specify the fully qualified path of the new Repository\n");     _usage.append("- Specify the fully qualified path of the new Repository\n");
   
   #ifdef NS_INTEROP
       _usage.append("    -i              - Change root/PG_InterOp to interop\n");
   #endif
 #endif #endif
  
     _usage.append("    -h, --help      - Display this help message\n");     _usage.append("    -h, --help      - Display this help message\n");
Line 480 
Line 499 
     optString.append (getoopt::GETOPT_ARGUMENT_DESIGNATOR);     optString.append (getoopt::GETOPT_ARGUMENT_DESIGNATOR);
     optString.append (_OPTION_NEW_REPOSITORY_PATH);     optString.append (_OPTION_NEW_REPOSITORY_PATH);
     optString.append (getoopt::GETOPT_ARGUMENT_DESIGNATOR);     optString.append (getoopt::GETOPT_ARGUMENT_DESIGNATOR);
   #ifdef NS_INTEROP
       optString.append (_OPTION_INTEROP);
       optString.append (getoopt::NOARG);
   #endif
 #endif #endif
  
     optString.append (_OPTION_HELP);     optString.append (_OPTION_HELP);
Line 606 
Line 629 
                     _newRepositoryPathSet = true;                     _newRepositoryPathSet = true;
                     break;                     break;
                 }                 }
   #ifdef NS_INTEROP
                   case _OPTION_INTEROP:
                   {
                       if (getOpts.isSet (_OPTION_INTEROP) > 1)
                       {
                           //
                           // More than one version option was found
                           //
                           throw DuplicateOptionException(_OPTION_INTEROP);
                       }
   
                       _optionType = _OPTION_TYPE_INTEROP;
                       _optionInterop = true;
                       break;
                   }
   #endif
 #endif #endif
                 case _OPTION_HELP:                 case _OPTION_HELP:
                 {                 {
Line 1132 
Line 1171 
     _updateSystemNameKeyProperty();     _updateSystemNameKeyProperty();
     _removeInstances();     _removeInstances();
  
   #ifdef NS_INTEROP
       // Change "root/PG_InterOp" to "interop" in the new repository
       if ( (_optionInterop == true ) &&
           (_oldRepository->nameSpaceExists(PEGASUS_NAMESPACE_PGINTEROP)))
       {
   #ifdef REPUPGRADE_DEBUG
           cout << "Changing namespace name from " <<
                PEGASUS_NAMESPACE_PGINTEROP.getString() << " to "
                << PEGASUS_NAMESPACENAME_INTEROP.getString() << endl;
   #endif
           _newRepository->modifyNameSpaceName(PEGASUS_NAMESPACE_PGINTEROP,
               PEGASUS_NAMESPACENAME_INTEROP);
       }
   #endif
 } }
  
 Array<CIMNamespaceName> RepositoryUpgrade::_compareNamespaces( Array<CIMNamespaceName> RepositoryUpgrade::_compareNamespaces(
Line 1938 
Line 1991 
                 << (const char*)oldClassNames[ctr].getString().getCString()                 << (const char*)oldClassNames[ctr].getString().getCString()
                 << endl;                 << endl;
 #endif #endif
   
   #ifdef NS_INTEROP
                       CIMClass oldClass = _oldRepository->getClass(
                                               oldNamespaces[i],
                                               oldClassNames[ctr]);
                       Uint32 pCnt = oldClass.getPropertyCount();
                       Boolean hasReference = false;
                       Array<CIMName> refProp;
                       for ( Uint32 j = 0; j < pCnt; j++)
                       {
                           CIMProperty prop = oldClass.getProperty(j);
                           if(prop.getType() == CIMTYPE_REFERENCE)
                           {
                               refProp.append(prop.getName());
                               hasReference = true;
                           }
                       }
   #endif
   
                     Array<CIMInstance>         instances;                     Array<CIMInstance>         instances;
                     Uint32                     ictr = 0;                     Uint32                     ictr = 0;
  
Line 1986 
Line 2058 
 #ifdef REPUPGRADE_DEBUG #ifdef REPUPGRADE_DEBUG
                                 cout << "Creating instance" << endl;                                 cout << "Creating instance" << endl;
 #endif #endif
   
   #ifdef NS_INTEROP
                                   if( hasReference == true)
                                   {
   #ifdef REPUPGRADE_DEBUG
                                      cout << "Calling _processInstance()" << endl;
   #endif
                                      _processInstance(processedInstance, refProp);
                                   }
   #endif
                                     _newRepository->createInstance(                                     _newRepository->createInstance(
                                                          oldNamespaces[i],                                                          oldNamespaces[i],
                                                          processedInstance);                                                          processedInstance);
Line 2031 
Line 2113 
     }     }
 } }
  
   #ifdef NS_INTEROP
   void RepositoryUpgrade::_processInstance(CIMInstance& instance,
                          Array<CIMName> a)
   {
       for(Uint32 k = 0; k < a.size(); k++)
       {
           try
           {
               Uint32 propIndex = instance.findProperty(a[k]);
               CIMProperty prop = instance.getProperty(propIndex);
               CIMObjectPath objPath;
               prop.getValue().get(objPath);
               if ( objPath.getNameSpace() == PEGASUS_NAMESPACE_PGINTEROP )
               {
                   objPath.setNameSpace(PEGASUS_NAMESPACENAME_INTEROP);
                   instance.removeProperty(propIndex);
                   prop.setValue(objPath);
                   instance.addProperty(prop);
               }
           }
           catch(...)
           {
   #ifdef REPUPGRADE_DEBUG
               cout << "Execption occured in _processInstance()" << endl;
   #endif
               throw;
           }
       }
   }
   #endif
   
 void RepositoryUpgrade::_removeInstances(void) void RepositoryUpgrade::_removeInstances(void)
 { {
     Array<CIMInstance> instances;     Array<CIMInstance> instances;


Legend:
Removed from v.1.57  
changed lines
  Added in v.1.58

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2