⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 repositoryupgrade.cpp

📁 Pegasus is an open-source implementationof the DMTF CIM and WBEM standards. It is designed to be por
💻 CPP
📖 第 1 页 / 共 5 页
字号:
    _usage.append (" -").append (_OPTION_HELP)         .append(" |");    _usage.append (" --").append (LONG_HELP)         .append("\n");    //    // Options description    //    _usage.append("Options : \n");#if !(defined(REPUPGRADE_USE_RELEASE_DIRS))    _usage.append("    -o              ");    _usage.append("- Specifies the old repository path\n");    _usage.append("    -n              ");    _usage.append("- Specifies the new repository path\n");#endif    _usage.append("    -h, --help      - Display this help message\n");    _usage.append("    -v, --version   - Display CIM Server version number\n");    //l10n localize usage#if (defined(REPUPGRADE_USE_RELEASE_DIRS))    MessageLoaderParms menuparms(        "Clients.repupgrade.RepositoryUpgradeRelease.MENU.STANDARD", _usage);# else    MessageLoaderParms menuparms(        "Clients.repupgrade.RepositoryUpgrade.MENU.STANDARD", _usage);#endif    menuparms.msg_src_path = MSG_PATH;    _usage = MessageLoader::getMessage(menuparms);    setUsage (_usage);   _oldRepositoryPathSet = false;   _newRepositoryPathSet = false;   //   // If the PEGASUS_USE_RELEASE_DIRS is set make the old and new   // repository paths fixed.   //#if (defined(REPUPGRADE_USE_RELEASE_DIRS))       _oldRepositoryPath = OLD_REPOSITORY_PATH;       _newRepositoryPath = NEW_REPOSITORY_PATH;       _oldRepositoryPathSet = true;       _newRepositoryPathSet = true;#endif   _oldRepository = 0;   _newRepository = 0;    // Construct the ignore class list.    _interopIgnoreClasses.append ( "PG_IndicationFilter" );    _interopIgnoreClasses.append ( "PG_IndicationHandler" );    _interopIgnoreClasses.append ( "PG_IndicationHandlerCIMXML" );    _interopIgnoreClasses.append ( "PG_IndicationHandlerSNMPMapper" );    _interopIgnoreClasses.append ( "PG_IndicationSubscription" ); }RepositoryUpgrade::~RepositoryUpgrade (){    delete _requestEncoder;    delete _oldRepository;    delete _newRepository;#ifdef ENABLE_MODULE_PROCESSING    if (_modulesInitialized)    {        _cleanupSSPModule();    }#endif}#ifdef PEGASUS_OS_OS400Uint32 RepositoryUpgrade::invokeRepositoryUpgrade(Uint32 argc, char* argv[]){    RepositoryUpgrade 	command;    Uint32		retCode;    try    {        command.setCommand (argc, argv);    }    catch (CommandFormatException& cfe)    {        throw cfe;      }      ofstream logFile(logFileName.getCString(), ios::app, PEGASUS_STD(_CCSID_T(1208)));    retCode = command.execute (logFile, logFile);    return (retCode);}#endif/**    Parses the command line, validates the options, and sets instance    variables based on the option arguments.    @param   argc  the number of command line arguments    @param   argv  the string vector of command line arguments    @exception  CommandFormatException  if an error is encountered in parsing                                        the command line */void RepositoryUpgrade::setCommand (Uint32 argc, char* argv []){    Uint32         i               = 0;    Uint32         c               = 0;    String         optString       = String ();    getoopt        getOpts;    //    //  Construct optString    //#if !(defined(REPUPGRADE_USE_RELEASE_DIRS))    optString.append (_OPTION_OLD_REPOSITORY_PATH);    optString.append (getoopt::GETOPT_ARGUMENT_DESIGNATOR);    optString.append (_OPTION_NEW_REPOSITORY_PATH);    optString.append (getoopt::GETOPT_ARGUMENT_DESIGNATOR);#endif    optString.append (_OPTION_HELP);    optString.append (getoopt::NOARG);    optString.append (_OPTION_VERSION);    optString.append (getoopt::NOARG);#ifdef PEGASUS_OS_OS400    optString.append (_OPTION_QUIET);    optString.append (getoopt::NOARG);#endif    //    //  Initialize and parse getOpts    //    getOpts = getoopt ();    getOpts.addFlagspec (optString);    //    // Add long flag options for 'help' and 'version'    //    getOpts.addLongFlagspec (LONG_HELP, getoopt::NOARG);    getOpts.addLongFlagspec (LONG_VERSION, getoopt::NOARG);    getOpts.parse (argc, argv);    if (getOpts.hasErrors ())    {        CommandFormatException e (getOpts.getErrorStrings () [0]);        throw e;    }    _optionType = _OPTION_TYPE_UNINITIALIZED;    //    //  Get options and arguments from the command line    //    for (i =  getOpts.first (); i <  getOpts.last (); i++)    {        if (getOpts [i].getType () == Optarg::LONGFLAG)        {            if (getOpts [i].getopt () == LONG_HELP)            {                if (_optionType != _OPTION_TYPE_UNINITIALIZED)                {                    String param = String (LONG_HELP);                    //                    // More than one operation option was found                    //                    UnexpectedOptionException e (param);                    throw e;                }               _optionType = _OPTION_TYPE_HELP;            }            else if (getOpts [i].getopt () == LONG_VERSION)            {                if (_optionType != _OPTION_TYPE_UNINITIALIZED)                {                    String param = String (LONG_VERSION);                    //                    // More than one operation option was found                    //                    UnexpectedOptionException e (param);                    throw e;                }               _optionType = _OPTION_TYPE_VERSION;            }        }        else if (getOpts [i].getType () == Optarg::REGULAR)        {            //            //  The repupgrade command has no non-option argument options            //            UnexpectedArgumentException e (getOpts [i].Value ());            throw e;        }        else /* getOpts [i].getType () == FLAG */        {            c = getOpts [i].getopt () [0];            switch (c)            {#if !(defined(REPUPGRADE_USE_RELEASE_DIRS))                case _OPTION_OLD_REPOSITORY_PATH:                {                    if (getOpts.isSet (_OPTION_OLD_REPOSITORY_PATH) > 1)                    {                        //                        // More than one old repository path option was found                        //                        DuplicateOptionException                             e (_OPTION_OLD_REPOSITORY_PATH);                        throw e;                    }                    if (_optionType != _OPTION_TYPE_UNINITIALIZED &&                        _optionType != _OPTION_TYPE_NEW_REPOSITORY_PATH)                    {                        //                        // More than one operation option was found                        //                        UnexpectedOptionException                             e (_OPTION_OLD_REPOSITORY_PATH);                        throw e;                    }                    _optionType = _OPTION_TYPE_OLD_REPOSITORY_PATH;                    _oldRepositoryPath = getOpts [i].Value ();                    _oldRepositoryPathSet = true;                    break;                }                case _OPTION_NEW_REPOSITORY_PATH:                {                    if (getOpts.isSet (_OPTION_NEW_REPOSITORY_PATH) > 1)                    {                        //                        // More than one new repository option was found                        //                        DuplicateOptionException                              e (_OPTION_NEW_REPOSITORY_PATH);                        throw e;                    }                    if (_optionType != _OPTION_TYPE_UNINITIALIZED &&                        _optionType != _OPTION_TYPE_OLD_REPOSITORY_PATH)                    {                        //                        // More than one operation option was found                        //                        UnexpectedOptionException                             e (_OPTION_NEW_REPOSITORY_PATH);                        throw e;                    }                    _optionType = _OPTION_TYPE_NEW_REPOSITORY_PATH;                    _newRepositoryPath = getOpts [i].Value ();                    _newRepositoryPathSet = true;                    break;                }#endif                case _OPTION_HELP:                {                    if (getOpts.isSet (_OPTION_HELP) > 1)                    {                        //                        // More than one help option was found                        //                        DuplicateOptionException e (_OPTION_HELP);                        throw e;                    }                    if (_optionType != _OPTION_TYPE_UNINITIALIZED)                    {                        //                        // More than one operation option was found                        //                        UnexpectedOptionException e (_OPTION_HELP);                        throw e;                    }                    _optionType = _OPTION_TYPE_HELP;                    break;                }                case _OPTION_VERSION:                {                    if (getOpts.isSet (_OPTION_VERSION) > 1)                    {                        //                        // More than one version option was found                        //                        DuplicateOptionException e (_OPTION_VERSION);                        throw e;                    }                    if (_optionType != _OPTION_TYPE_UNINITIALIZED)                    {                        //                        // More than one operation option was found                        //                        UnexpectedOptionException e (_OPTION_VERSION);                        throw e;                    }                    _optionType = _OPTION_TYPE_VERSION;                    break;                }#ifdef PEGASUS_OS_OS400		case _OPTION_QUIET:		{			// Suppress output. Redirect to /dev/null.			freopen(logFileName.getCString(),"a",stdout);			freopen(logFileName.getCString(),"a",stderr);		}#endif                default:                {                    //                    //  This path should not be hit                    //                    break;                }            }        }    }    // Check if an operation type was not specified.#if !(defined(REPUPGRADE_USE_RELEASE_DIRS))    if ( _optionType == _OPTION_TYPE_UNINITIALIZED )    {        //        // No operation type was specified        // Show the usage        //        CommandFormatException e ( localizeMessage ( MSG_PATH,            REQUIRED_ARGS_MISSING_KEY, REQUIRED_ARGS_MISSING ) );        throw e;    }#endif}/**    Executes the command and writes the results to the PrintWriters.    @param   outPrintWriter     the ostream to which output should be                                written    @param   errPrintWriter     the ostream to which error output should be                                written    @return  0                  if the command is successful             1                  if an error occurs in executing the command */Uint32 RepositoryUpgrade::execute (    ostream& outPrintWriter,    ostream& errPrintWriter){    //    // Check if the old and new repository paths exist.    //    if ( _oldRepositoryPathSet && !FileSystem::exists (_oldRepositoryPath))    {        cerr << localizeMessage ( MSG_PATH,                                  REPOSITORY_DOES_NOT_EXIST_KEY,                                  REPOSITORY_DOES_NOT_EXIST,                                  _oldRepositoryPath ) << endl;#ifdef PEGASUS_OS_OS400        Logger::put(Logger::STANDARD_LOG,"cimserver repupgrade",Logger::SEVERE,	           localizeMessage ( MSG_PATH,                                  REPOSITORY_DOES_NOT_EXIST_KEY,                                  REPOSITORY_DOES_NOT_EXIST,                                  _oldRepositoryPath )                   );	throw RepositoryUpgradeException("");#endif        return 1;    }    if ( _newRepositoryPathSet && !FileSystem::exists (_newRepositoryPath))    {        cerr << localizeMessage (MSG_PATH,                                 REPOSITORY_DOES_NOT_EXIST_KEY,                                 REPOSITORY_DOES_NOT_EXIST,                                 _newRepositoryPath ) << endl;#ifdef PEGASUS_OS_OS400	Logger::put(Logger::STANDARD_LOG,"cimserver repupgrade",Logger::SEVERE,

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -