From: <bni...@us...> - 2006-11-16 18:29:10
|
Revision: 400 http://svn.sourceforge.net/omc/?rev=400&view=rev Author: bnicholes Date: 2006-11-16 10:29:03 -0800 (Thu, 16 Nov 2006) Log Message: ----------- Fix a segfault in start up when the environment can not be initialized. This includes making sure that the client thread is not started if the server thread is not running. Modified Paths: -------------- clp/trunk/src/omcclp.cpp clp/trunk/src/omcclp.h Modified: clp/trunk/src/omcclp.cpp =================================================================== --- clp/trunk/src/omcclp.cpp 2006-11-15 21:38:54 UTC (rev 399) +++ clp/trunk/src/omcclp.cpp 2006-11-16 18:29:03 UTC (rev 400) @@ -142,6 +142,7 @@ Int32 OMCCLPServerThread::run() { int cc; + bool initialized = false; OMCClpdEnvRef env = OMCClpdEnv::instance(); LoggerRef logger(new CerrLogger); NonRecursiveMutexLock localLock(m_guard); @@ -157,51 +158,78 @@ env->init(); m_logger = env->getLogger(OMCClpdEnv::COMPONENT_NAME); - - OW_LOG_DEBUG(m_logger, "clpd Environment initialized"); - - int sig; - env->startServices(); - m_running = true; - OW_LOG_INFO(m_logger, "clpd is now running"); - - m_condition.notifyAll(); - - while(!m_shuttingDown) - { - // runSelectEngine will only return once something has been put into - // the signal pipe or an error has happened - env->runSelectEngine(); - if ((cc = sigPipe->readInt(&sig)) == -1) - { - continue; - } - - OW_LOG_INFO(m_logger, "clp server received shutdown notification." - " Initiating shutdown."); - env->shutdown(); - } + initialized = true; } catch (Exception& e) { - OW_LOG_FATAL_ERROR(m_logger, "* EXCEPTION CAUGHT IN clpd MAIN!"); - OW_LOG_FATAL_ERROR(m_logger, Format("* %1", e)); + cerr << "* EXCEPTION CAUGHT IN clp server startup!" << endl; + cerr << Format("* %1", e) << endl; } catch (std::exception& e) { - OW_LOG_FATAL_ERROR(m_logger, "* std::exception CAUGHT IN clpd MAIN!"); - OW_LOG_FATAL_ERROR(m_logger, Format("* Message: %1", e.what())); + cerr << "* EXCEPTION CAUGHT IN clp server startup!" << endl; + cerr << Format("* Message: %1", e.what()) << endl; } catch (...) { - OW_LOG_FATAL_ERROR(m_logger, "* UNKNOWN EXCEPTION CAUGHT IN clpd MAIN!"); + cerr << "* UNKNOWN EXCEPTION CAUGHT IN clpd MAIN!" << endl; } - m_running = false; - OW_LOG_DEBUG(m_logger, "OMCCLPServer::run waiting on thread barrier"); - m_threadBarrier.wait(); - OW_LOG_DEBUG(m_logger, "Exiting CLP server thread"); + if (initialized) + { + OW_LOG_DEBUG(m_logger, "clpd Environment initialized"); + + try + { + int sig; + env->startServices(); + m_running = true; + OW_LOG_INFO(m_logger, "clpd is now running"); + + m_condition.notifyAll(); + + while(!m_shuttingDown) + { + // runSelectEngine will only return once something has been put into + // the signal pipe or an error has happened + env->runSelectEngine(); + if ((cc = sigPipe->readInt(&sig)) == -1) + { + continue; + } + + OW_LOG_INFO(m_logger, "clp server received shutdown notification." + " Initiating shutdown."); + env->shutdown(); + } + } + catch (Exception& e) + { + OW_LOG_FATAL_ERROR(m_logger, "* EXCEPTION CAUGHT IN clpd MAIN!"); + OW_LOG_FATAL_ERROR(m_logger, Format("* %1", e)); + } + catch (std::exception& e) + { + OW_LOG_FATAL_ERROR(m_logger, "* std::exception CAUGHT IN clpd MAIN!"); + OW_LOG_FATAL_ERROR(m_logger, Format("* Message: %1", e.what())); + } + catch (...) + { + OW_LOG_FATAL_ERROR(m_logger, "* UNKNOWN EXCEPTION CAUGHT IN clpd MAIN!"); + } + m_running = false; + OW_LOG_DEBUG(m_logger, "OMCCLPServer::run waiting on thread barrier"); + m_threadBarrier.wait(); + OW_LOG_DEBUG(m_logger, "Exiting CLP server thread"); + } + else + { + cerr << "Exiting CLP server thread" << endl; + m_condition.notifyAll(); + return -1; + } + return 0; } @@ -330,7 +358,6 @@ { Condition cond; NonRecursiveMutex lock; - OMCCLPClientThread clpt; OMCCLPServerThread clpsvrt(cond, lock); int cc, c; @@ -338,48 +365,94 @@ try { + NonRecursiveMutexLock localLock(lock); + // parse command line, and build the urlList CmdLineParser parser(argc, argv, g_options, CmdLineParser::E_NON_OPTION_ARGS_ALLOWED); - if (parser.isSet(E_CMDOPT_HELP)) { usage(); return 0; } - - if (parser.isSet(E_CMDOPT_URL)) - { - String val = parser.getOptionValue(E_CMDOPT_URL); - clpt.setCIMURL(val); - } - if (parser.isSet(E_CMDOPT_NS)) - { - String val = parser.getOptionValue(E_CMDOPT_NS); - clpt.setCIMNamespace(val); - } if (parser.isSet(E_CMDOPT_CONFIG)) { String val = parser.getOptionValue(E_CMDOPT_CONFIG); - clpt.setConfFilename(val); clpsvrt.setConfFilename(val); } - if (parser.isSet(E_CMDOPT_CMD)) - { - String val = parser.getOptionValue(E_CMDOPT_CMD); - clpt.setExecCmd(val); - } if (parser.isSet(E_CMDOPT_DEBUG)) { clpsvrt.setDebugMode(true); } - clpt.setScriptFilenames(parser.getNonOptionArgs()); + /* Start the server and wait for it to initialize. */ + clpsvrt.start(); + cond.wait(localLock); + localLock.release(); + + if (clpsvrt.running()) + { + OMCCLPClientThread clpt; + + if (parser.isSet(E_CMDOPT_URL)) + { + String val = parser.getOptionValue(E_CMDOPT_URL); + clpt.setCIMURL(val); + } + if (parser.isSet(E_CMDOPT_NS)) + { + String val = parser.getOptionValue(E_CMDOPT_NS); + clpt.setCIMNamespace(val); + } + if (parser.isSet(E_CMDOPT_CONFIG)) + { + String val = parser.getOptionValue(E_CMDOPT_CONFIG); + clpt.setConfFilename(val); + } + if (parser.isSet(E_CMDOPT_CMD)) + { + String val = parser.getOptionValue(E_CMDOPT_CMD); + clpt.setExecCmd(val); + } + clpt.setScriptFilenames(parser.getNonOptionArgs()); + + /* Start the client after the server has completed its startup. */ + clpt.start(); + + setupSigHandler(true); + + SelectTypeArray selArray; + selArray.push_back(sigPipe->getSelectObj()); + sigPipe->setBlocking(UnnamedPipe::E_NONBLOCKING); + + /* This select loop will only return if a signal + has been recieved and the sigpipe has been + written to. */ + do { + Select::select(selArray); + + if ((cc = sigPipe->readInt(&c)) == -1) + { + continue; + } + break; + } while (true); + + /* Call the server and client shutdown to make sure + that everything has been cleaned up. */ + clpt.shutdown(); + clpsvrt.shutdown(); + return 0; + } } catch (CmdLineParserException& e) { printCmdLineParserExceptionMessage(e); usage(); } + catch (AssertionException& a) + { + cerr << "Caught Assertion: " << a << endl; + } catch (CIMException& e) { cerr << "ERROR: CIMException:" << e.getMessage() << endl; @@ -397,52 +470,6 @@ cerr << "ERROR: UnknownException." << endl; } - try - { - NonRecursiveMutexLock localLock(lock); - - /* Start the server and wait for it to initialize. */ - clpsvrt.start(); - cond.wait(localLock); - localLock.release(); - - /* Start the client after the server has completed its startup. */ - clpt.start(); - - setupSigHandler(true); - - SelectTypeArray selArray; - selArray.push_back(sigPipe->getSelectObj()); - sigPipe->setBlocking(UnnamedPipe::E_NONBLOCKING); - - /* This select loop will only return if a signal - has been recieved and the sigpipe has been - written to. */ - do { - Select::select(selArray); - - if ((cc = sigPipe->readInt(&c)) == -1) - { - continue; - } - break; - } while (true); - - /* Call the server and client shutdown to make sure - that everything has been cleaned up. */ - clpt.shutdown(); - clpsvrt.shutdown(); - return 0; - } - catch (AssertionException& a) - { - cerr << "Caught Assertion: " << a << endl; - } - catch (Exception& e) - { - cerr << e << endl; - } - return 1; } Modified: clp/trunk/src/omcclp.h =================================================================== --- clp/trunk/src/omcclp.h 2006-11-15 21:38:54 UTC (rev 399) +++ clp/trunk/src/omcclp.h 2006-11-16 18:29:03 UTC (rev 400) @@ -79,6 +79,7 @@ virtual void shutdown(); virtual Int32 run (); + bool running() {return m_running;} void setDebugMode(bool debug) {m_debugMode = debug;} void setConfFilename (const String filename) {m_data_filename = filename;} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <bni...@us...> - 2006-11-29 20:05:28
|
Revision: 405 http://svn.sourceforge.net/omc/?rev=405&view=rev Author: bnicholes Date: 2006-11-29 12:05:27 -0800 (Wed, 29 Nov 2006) Log Message: ----------- allow each of the omcclpX binaries to use a different configuration file. Modified Paths: -------------- clp/trunk/src/omcclp.cpp clp/trunk/src/omcclpc.cpp clp/trunk/src/omcclpprogram.cpp Modified: clp/trunk/src/omcclp.cpp =================================================================== --- clp/trunk/src/omcclp.cpp 2006-11-29 00:10:32 UTC (rev 404) +++ clp/trunk/src/omcclp.cpp 2006-11-29 20:05:27 UTC (rev 405) @@ -378,6 +378,8 @@ String val = parser.getOptionValue(E_CMDOPT_CONFIG); clpsvrt.setConfFilename(val); } + else + clpsvrt.setConfFilename(OMCCLP_SYSCONF_DIR"/omcclp.conf"); if (parser.isSet(E_CMDOPT_DEBUG)) { clpsvrt.setDebugMode(true); @@ -407,6 +409,8 @@ String val = parser.getOptionValue(E_CMDOPT_CONFIG); clpt.setConfFilename(val); } + else + clpt.setConfFilename(OMCCLP_SYSCONF_DIR"/omcclp.conf"); if (parser.isSet(E_CMDOPT_CMD)) { String val = parser.getOptionValue(E_CMDOPT_CMD); Modified: clp/trunk/src/omcclpc.cpp =================================================================== --- clp/trunk/src/omcclpc.cpp 2006-11-29 00:10:32 UTC (rev 404) +++ clp/trunk/src/omcclpc.cpp 2006-11-29 20:05:27 UTC (rev 405) @@ -692,6 +692,8 @@ String val = parser.getOptionValue(E_CMDOPT_CONFIG); clp.setConfFilename(val); } + else + clp.setConfFilename(OMCCLP_SYSCONF_DIR"/omcclpc.conf"); if (parser.isSet(E_CMDOPT_CMD)) { String val = parser.getOptionValue(E_CMDOPT_CMD); Modified: clp/trunk/src/omcclpprogram.cpp =================================================================== --- clp/trunk/src/omcclpprogram.cpp 2006-11-29 00:10:32 UTC (rev 404) +++ clp/trunk/src/omcclpprogram.cpp 2006-11-29 20:05:27 UTC (rev 405) @@ -284,8 +284,8 @@ bool OMCCLPProgram::initializeCLPSession() { /* Open the main configuration file */ - loadConfigItemsFromFile(getConfigItem(OMCClpdConfigOpts::CONFIG_FILE_opt, - OMCCLPD_DEFAULT_CONFIG_FILE)); + String conffile = getConfFilename(); + loadConfigItemsFromFile(conffile.length() ? conffile : OMCCLPD_DEFAULT_CONFIG_FILE); String url = getCIMURL(); String ns = getCIMNamespace(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <bni...@us...> - 2006-11-29 20:09:54
|
Revision: 406 http://svn.sourceforge.net/omc/?rev=406&view=rev Author: bnicholes Date: 2006-11-29 12:09:50 -0800 (Wed, 29 Nov 2006) Log Message: ----------- sync up the alternate configuration file parameter between all of the binaries on a -f Modified Paths: -------------- clp/trunk/src/omcclpc.cpp clp/trunk/src/omcclpd.cpp Modified: clp/trunk/src/omcclpc.cpp =================================================================== --- clp/trunk/src/omcclpc.cpp 2006-11-29 20:05:27 UTC (rev 405) +++ clp/trunk/src/omcclpc.cpp 2006-11-29 20:09:50 UTC (rev 406) @@ -62,7 +62,7 @@ CmdLineParser::Option g_options[] = { {E_CMDOPT_CMD, 'c', "command", CmdLineParser::E_REQUIRED_ARG, 0, "Execute a single command from the command line."}, - {E_CMDOPT_CONFIG, 'd', "config", CmdLineParser::E_REQUIRED_ARG, 0, "Alternate configuration file. Default is omcclp.conf."}, + {E_CMDOPT_CONFIG, 'f', "config", CmdLineParser::E_REQUIRED_ARG, 0, "Alternate configuration file. Default is omcclpc.conf."}, {E_CMDOPT_HELP, 'h', "help", CmdLineParser::E_NO_ARG, 0, "Show help about options."}, {E_CMDOPT_NS, 'n', "ns", CmdLineParser::E_REQUIRED_ARG, 0, "Alternate CIM namespace to be used in place of the namespace specified in the configuration file"}, {E_CMDOPT_URL, 'u', "url", CmdLineParser::E_REQUIRED_ARG, 0, "Alternate CIM URL to be used in place of the URL specified in the configuration file."}, Modified: clp/trunk/src/omcclpd.cpp =================================================================== --- clp/trunk/src/omcclpd.cpp 2006-11-29 20:05:27 UTC (rev 405) +++ clp/trunk/src/omcclpd.cpp 2006-11-29 20:09:50 UTC (rev 406) @@ -165,7 +165,7 @@ { { HELP_OPT, 'h', "help", CmdLineParser::E_NO_ARG, 0, "Show help about command line options"}, { DEBUG_OPT, 'd', "debug", CmdLineParser::E_NO_ARG, 0, "Run in debug mode (Does not detach from the terminal" }, - { CONFIG_FILE_OPT, 'c', "config", CmdLineParser::E_REQUIRED_ARG, 0, "User <arg> instead of the default config file" }, + { CONFIG_FILE_OPT, 'f', "config", CmdLineParser::E_REQUIRED_ARG, 0, "Alternate configuration file. Default is omcclpd.conf." }, { 0, 0, 0, CmdLineParser::E_NO_ARG, 0, 0 } }; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <bni...@us...> - 2006-11-30 18:07:12
|
Revision: 411 http://svn.sourceforge.net/omc/?rev=411&view=rev Author: bnicholes Date: 2006-11-30 10:07:12 -0800 (Thu, 30 Nov 2006) Log Message: ----------- allow the show command to recognize the default display option value in the clp setting data instance Modified Paths: -------------- clp/trunk/src/omcclpcmdshow.cpp clp/trunk/src/omcclpcommand.cpp clp/trunk/src/omcclpprint.cpp Modified: clp/trunk/src/omcclpcmdshow.cpp =================================================================== --- clp/trunk/src/omcclpcmdshow.cpp 2006-11-30 16:23:14 UTC (rev 410) +++ clp/trunk/src/omcclpcmdshow.cpp 2006-11-30 18:07:12 UTC (rev 411) @@ -368,12 +368,21 @@ } } + String defaultDisplayType; + + /* Only get the default display type if one was not specified + on the command line. */ + if (!hasOption(E_OPT_DISPLAY)) + { + defaultDisplayType = getOptionValueString(E_OPT_DISPLAY); + defaultDisplayType.toLowerCase(); + } + Int32 targetLevel = getOptionValueInt(E_OPT_LEVEL); /* Get the targets display option if it was specified on the command line.*/ - displaySubOption = hasOption(E_OPT_DISPLAY, E_SUBOPT_TARGETS); - - if (displaySubOption || (targetLevel != 1)) + displaySubOption = (hasOption(E_OPT_DISPLAY, E_SUBOPT_TARGETS) || hasOption(E_OPT_DISPLAY, E_SUBOPT_ALL)); + if ((displaySubOption || defaultDisplayType.startsWith("t")) || (targetLevel != 1)) { setTargetsForTargets(m_cimObjectPathInfoArray, targetLevel); } @@ -387,9 +396,8 @@ /* Get the verbs display option if it was specified on the command line. If we are to display valid verbs, then look up the verbs in the address data file */ - displaySubOption = hasOption(E_OPT_DISPLAY, E_SUBOPT_VERBS); - - if (displaySubOption) + displaySubOption = (hasOption(E_OPT_DISPLAY, E_SUBOPT_VERBS) || hasOption(E_OPT_DISPLAY, E_SUBOPT_ALL)); + if (displaySubOption || defaultDisplayType.startsWith("v")) { setValidCmdsForTargets(m_cimObjectPathInfoArray, targetLevel); } @@ -397,9 +405,8 @@ /* Get the associations display option if it was specified on the command line. If we are to display the associations, then look up the verbs in the address data file */ - displaySubOption = hasOption(E_OPT_DISPLAY, E_SUBOPT_ASSOCIATIONS); - - if (displaySubOption) + displaySubOption = (hasOption(E_OPT_DISPLAY, E_SUBOPT_ASSOCIATIONS) || hasOption(E_OPT_DISPLAY, E_SUBOPT_ALL)); + if (displaySubOption || defaultDisplayType.startsWith("as")) { setAssociationsForTargets(m_cimObjectPathInfoArray, targetLevel); } Modified: clp/trunk/src/omcclpcommand.cpp =================================================================== --- clp/trunk/src/omcclpcommand.cpp 2006-11-30 16:23:14 UTC (rev 410) +++ clp/trunk/src/omcclpcommand.cpp 2006-11-30 18:07:12 UTC (rev 411) @@ -304,7 +304,8 @@ one that machines the specified criteria */ for (int i=0; i<m_options.size(); i++) { - if (m_options[i]->getOptionType() == o && m_options[i]->getOptionSubtype() == so) + if ((m_options[i]->getOptionType() == o) && + ((m_options[i]->getOptionSubtype() == so) || (so == E_SUBOPT_NONE))) { opt = m_options[i]; break; Modified: clp/trunk/src/omcclpprint.cpp =================================================================== --- clp/trunk/src/omcclpprint.cpp 2006-11-30 16:23:14 UTC (rev 410) +++ clp/trunk/src/omcclpprint.cpp 2006-11-30 18:07:12 UTC (rev 411) @@ -197,18 +197,68 @@ CIMClient *cc = clpSession->getCIMClient(); std::ostream& clpout(clpSession->clpout()); StringArray displayProp; - bool displayTargets, displayAssociations, displayProperties, displayVerbs; + bool displayTargets(false), displayAssociations(false); + bool displayProperties(false), displayVerbs(false); const StringArray verbs = copi->getCmdVerbs(); const CIMObjectPath cop = copi->getCimObjectPath(); String indent; if (copi->getIsDisplayible()) { - displayTargets = m_showCmd->hasOption(E_OPT_DISPLAY, E_SUBOPT_TARGETS); - displayAssociations = m_showCmd->hasOption(E_OPT_DISPLAY, E_SUBOPT_ASSOCIATIONS); - displayProperties = m_showCmd->hasOption(E_OPT_DISPLAY, E_SUBOPT_PROPERTIES); - displayVerbs = m_showCmd->hasOption(E_OPT_DISPLAY, E_SUBOPT_VERBS); + /* If a display option was specified, the use it. Otherwise use + the default option from the CLP session object.*/ + if (m_showCmd->hasOption(E_OPT_DISPLAY)) + { + if (m_showCmd->hasOption(E_OPT_DISPLAY, E_SUBOPT_ALL)) + { + displayAssociations = true; + displayProperties = true; + displayTargets = true; + displayVerbs = true; + } + else + { + displayTargets = m_showCmd->hasOption(E_OPT_DISPLAY, E_SUBOPT_TARGETS); + displayAssociations = m_showCmd->hasOption(E_OPT_DISPLAY, E_SUBOPT_ASSOCIATIONS); + displayProperties = m_showCmd->hasOption(E_OPT_DISPLAY, E_SUBOPT_PROPERTIES); + displayVerbs = m_showCmd->hasOption(E_OPT_DISPLAY, E_SUBOPT_VERBS); + } + } + else + { + String displayType = m_showCmd->getOptionValueString(E_OPT_DISPLAY); + if (displayType.length()) + { + displayType.toLowerCase(); + char token = displayType.charAt(0); + switch (token) { + case 'p': + displayProperties = true; + break; + case 't': + displayTargets = true; + break; + case 'v': + displayVerbs = true; + break; + case 'a': + if (displayType.startsWith("al")) + { + displayAssociations = true; + displayProperties = true; + displayTargets = true; + displayVerbs = true; + } + else if (displayType.startsWith("as")) + { + displayAssociations = true; + } + break; + } + } + } + // When getting the instance, get just the properties that were specified in the command // If no properties were specified, then get all properties. displayProp = m_showCmd->getOptionValueArray(E_OPT_DISPLAY, E_SUBOPT_PROPERTIES); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <bni...@us...> - 2006-12-05 00:09:51
|
Revision: 414 http://svn.sourceforge.net/omc/?rev=414&view=rev Author: bnicholes Date: 2006-12-04 16:09:31 -0800 (Mon, 04 Dec 2006) Log Message: ----------- replace endl with \r\n to fix the output formatting on a telnet session Modified Paths: -------------- clp/trunk/src/omcclp.cpp clp/trunk/src/omcclpcmdalias.cpp clp/trunk/src/omcclpcmdcreate.cpp clp/trunk/src/omcclpcmddelete.cpp clp/trunk/src/omcclpcmdhelp.cpp clp/trunk/src/omcclpcmdmapping.cpp clp/trunk/src/omcclpcmdreset.cpp clp/trunk/src/omcclpcmdshow.cpp clp/trunk/src/omcclpcmdstart.cpp clp/trunk/src/omcclpcmdstop.cpp clp/trunk/src/omcclpcommand.cpp clp/trunk/src/omcclpcommandline.cpp clp/trunk/src/omcclpcommandstatus.cpp clp/trunk/src/omcclpcommon.cpp clp/trunk/src/omcclpcommon.h clp/trunk/src/omcclpconf.cpp clp/trunk/src/omcclpd.cpp clp/trunk/src/omcclpprint.cpp clp/trunk/src/omcclpprint.h clp/trunk/src/omcclpprogram.cpp clp/trunk/src/omcclptargetpath.cpp Modified: clp/trunk/src/omcclp.cpp =================================================================== --- clp/trunk/src/omcclp.cpp 2006-12-04 23:15:57 UTC (rev 413) +++ clp/trunk/src/omcclp.cpp 2006-12-05 00:09:31 UTC (rev 414) @@ -82,11 +82,11 @@ void usage() { cerr << PROG_NAME << " " << PROG_VERSION - << " Server Management Command Line Protocol" << endl; - cerr << "Copyright (C) 2006 by Novell Inc." << endl; - cerr << "Usage: " << PROG_NAME << " [OPTIONS]" << endl; + << " Server Management Command Line Protocol" << CLPENDL; + cerr << "Copyright (C) 2006 by Novell Inc." << CLPENDL; + cerr << "Usage: " << PROG_NAME << " [OPTIONS]" << CLPENDL; - cout << endl << CmdLineParser::getUsage(g_options) << endl; + cout << CLPENDL << CmdLineParser::getUsage(g_options) << CLPENDL; } void printCmdLineParserExceptionMessage(CmdLineParserException& e) @@ -94,19 +94,19 @@ switch (e.getErrorCode()) { case CmdLineParser::E_INVALID_OPTION: - cerr << "unknown option: " << e.getMessage() << endl; + cerr << "unknown option: " << e.getMessage() << CLPENDL; break; case CmdLineParser::E_MISSING_ARGUMENT: - cerr << "missing argument for option: " << e.getMessage() << endl; + cerr << "missing argument for option: " << e.getMessage() << CLPENDL; break; case CmdLineParser::E_INVALID_NON_OPTION_ARG: - cerr << "invalid non-option argument: " << e.getMessage() << endl; + cerr << "invalid non-option argument: " << e.getMessage() << CLPENDL; break; case CmdLineParser::E_MISSING_OPTION: - cerr << "missing required option: " << e.getMessage() << endl; + cerr << "missing required option: " << e.getMessage() << CLPENDL; break; default: - cerr << "failed parsing command line options: " << e << endl; + cerr << "failed parsing command line options: " << e << CLPENDL; break; } } @@ -162,17 +162,17 @@ } catch (Exception& e) { - cerr << "* EXCEPTION CAUGHT IN clp server startup!" << endl; - cerr << Format("* %1", e) << endl; + cerr << "* EXCEPTION CAUGHT IN clp server startup!" << CLPENDL; + cerr << Format("* %1", e) << CLPENDL; } catch (std::exception& e) { - cerr << "* EXCEPTION CAUGHT IN clp server startup!" << endl; - cerr << Format("* Message: %1", e.what()) << endl; + cerr << "* EXCEPTION CAUGHT IN clp server startup!" << CLPENDL; + cerr << Format("* Message: %1", e.what()) << CLPENDL; } catch (...) { - cerr << "* UNKNOWN EXCEPTION CAUGHT IN clpd MAIN!" << endl; + cerr << "* UNKNOWN EXCEPTION CAUGHT IN clpd MAIN!" << CLPENDL; } if (initialized) @@ -224,7 +224,7 @@ } else { - cerr << "Exiting CLP server thread" << endl; + cerr << "Exiting CLP server thread" << CLPENDL; m_condition.notifyAll(); return -1; } @@ -261,7 +261,7 @@ // it can be referenced by other objects. gclp = &clp; - cout << "hello world" << endl; + cout << "hello world" << CLPENDL; /* Initialize the readline library */ init_rl(); @@ -287,16 +287,16 @@ } catch (AssertionException& a) { - cerr << "Caught Assertion: " << a << endl; + cerr << "Caught Assertion: " << a << CLPENDL; ret = 1; } catch (Exception& e) { - cerr << e << endl; + cerr << e << CLPENDL; ret = 1; } - //cerr << "Exit recieved. Client returning" << endl; + //cerr << "Exit recieved. Client returning" << CLPENDL; /* Signal a shutdown */ sigPipe->writeInt(0); return ret; @@ -360,7 +360,7 @@ OMCCLPServerThread clpsvrt(cond, lock); int cc, c; - cout << "hello world" << endl; + cout << "hello world" << CLPENDL; try { @@ -454,23 +454,23 @@ } catch (AssertionException& a) { - cerr << "Caught Assertion: " << a << endl; + cerr << "Caught Assertion: " << a << CLPENDL; } catch (CIMException& e) { - cerr << "ERROR: CIMException:" << e.getMessage() << endl; + cerr << "ERROR: CIMException:" << e.getMessage() << CLPENDL; } catch (Exception& e) { - cerr << "ERROR: Exception:" << e.getMessage() << endl; + cerr << "ERROR: Exception:" << e.getMessage() << CLPENDL; } catch (std::exception& e) { - cerr << "ERROR: sdtException:" << e.what() << endl; + cerr << "ERROR: sdtException:" << e.what() << CLPENDL; } catch (...) { - cerr << "ERROR: UnknownException." << endl; + cerr << "ERROR: UnknownException." << CLPENDL; } return 1; Modified: clp/trunk/src/omcclpcmdalias.cpp =================================================================== --- clp/trunk/src/omcclpcmdalias.cpp 2006-12-04 23:15:57 UTC (rev 413) +++ clp/trunk/src/omcclpcmdalias.cpp 2006-12-05 00:09:31 UTC (rev 414) @@ -157,7 +157,7 @@ for (size_t i = 0; (i < m_aliasDisplayList.size()); ++i) { - clpout << m_aliasDisplayList[i] << endl; + clpout << m_aliasDisplayList[i] << CLPENDL; } } if (optArg == OUTPUT_DISPLAY_KEYWORD) Modified: clp/trunk/src/omcclpcmdcreate.cpp =================================================================== --- clp/trunk/src/omcclpcmdcreate.cpp 2006-12-04 23:15:57 UTC (rev 413) +++ clp/trunk/src/omcclpcmdcreate.cpp 2006-12-05 00:09:31 UTC (rev 414) @@ -129,7 +129,7 @@ } catch ( CIMException& ce ) { - cerr << ce << endl; + cerr << ce << CLPENDL; getCmdStatusRef()->setStatus(COMMAND_EXECUTION_FAILED); getCmdStatusRef()->setProcessingError (INVALID_TARGET); return false; @@ -177,7 +177,7 @@ } catch ( CIMException& ce ) { - cerr << ce << endl; + cerr << ce << CLPENDL; getCmdStatusRef()->setStatus(COMMAND_EXECUTION_FAILED); getCmdStatusRef()->setProcessingError (INVALID_TARGET); return false; Modified: clp/trunk/src/omcclpcmddelete.cpp =================================================================== --- clp/trunk/src/omcclpcmddelete.cpp 2006-12-04 23:15:57 UTC (rev 413) +++ clp/trunk/src/omcclpcmddelete.cpp 2006-12-05 00:09:31 UTC (rev 414) @@ -116,14 +116,14 @@ } catch (const CIMException& ce) { - cerr << ce << endl; + cerr << ce << CLPENDL; getCmdStatusRef()->setStatus(COMMAND_EXECUTION_FAILED); getCmdStatusRef()->setProcessingError (INVALID_TARGET); getCmdStatusRef()->setCIMStatus(CIM_ERR_METHOD_NOT_FOUND); } catch (Exception& e) { - cerr << e << endl; + cerr << e << CLPENDL; } } else @@ -219,7 +219,7 @@ for (int x=0; x < m_deleteInfoArray.size(); x++) { clpout << m_deleteInfoArray[x]->getUFiP() << " "; - clpout << m_deleteInfoArray[x]->getErrorMessage() << endl; + clpout << m_deleteInfoArray[x]->getErrorMessage() << CLPENDL; } } } @@ -230,7 +230,7 @@ for (int x=0; x < m_deleteInfoArray.size(); x++) { clpout << m_deleteInfoArray[x]->getUFiP() << " "; - clpout << m_deleteInfoArray[x]->getErrorMessage() << endl; + clpout << m_deleteInfoArray[x]->getErrorMessage() << CLPENDL; } clpout << "endoutput\n"; } @@ -248,10 +248,10 @@ clpout << "<ufit ufct=\"" << UFcT; clpout << "\" instance=\"" << x << "\"> "; - clpout << UFcT << ufis << "</ufit>" << endl; - clpout << "<ufip>" << UFiP << "</ufip>" << endl; + clpout << UFcT << ufis << "</ufit>" << CLPENDL; + clpout << "<ufip>" << UFiP << "</ufip>" << CLPENDL; clpout << "<result>" << m_deleteInfoArray[x]->getErrorMessage() << "</result>"; - clpout << endl; + clpout << CLPENDL; } clpout << "</instance>\n"; clpout << "</target>\n"; Modified: clp/trunk/src/omcclpcmdhelp.cpp =================================================================== --- clp/trunk/src/omcclpcmdhelp.cpp 2006-12-04 23:15:57 UTC (rev 413) +++ clp/trunk/src/omcclpcmdhelp.cpp 2006-12-05 00:09:31 UTC (rev 414) @@ -96,29 +96,29 @@ for (size_t i = 0; (i < topics.size()); ++i) { String topicHelp = conf->GetIniSetting(String("help-Commands"), topics[i]); - clpout << topicHelp << endl; + clpout << topicHelp << CLPENDL; } } if (optArg == OUTPUT_DISPLAY_KEYWORD) { - clpout << "command=help" << endl; + clpout << "command=help" << CLPENDL; for (size_t i = 0; (i < topics.size()); ++i) { String topicHelp = conf->GetIniSetting(String("help-Commands"), topics[i]); - clpout << "help=" << topicHelp << endl; + clpout << "help=" << topicHelp << CLPENDL; } - clpout << "endoutput" << endl; + clpout << "endoutput" << CLPENDL; } if (optArg == OUTPUT_DISPLAY_CLPXML) { - clpout << "<help>" << endl; + clpout << "<help>" << CLPENDL; for (size_t i = 0; (i < topics.size()); ++i) { String topicHelp = conf->GetIniSetting(String("help-Commands"), topics[i]); - clpout << "<text>" << topicHelp << "</text>" << endl; + clpout << "<text>" << topicHelp << "</text>" << CLPENDL; } - clpout << "</help>" << endl; - clpout << "</response>" << endl; + clpout << "</help>" << CLPENDL; + clpout << "</response>" << CLPENDL; } } Modified: clp/trunk/src/omcclpcmdmapping.cpp =================================================================== --- clp/trunk/src/omcclpcmdmapping.cpp 2006-12-04 23:15:57 UTC (rev 413) +++ clp/trunk/src/omcclpcmdmapping.cpp 2006-12-05 00:09:31 UTC (rev 414) @@ -65,13 +65,13 @@ } catch (const CIMException& ce) { - cerr << ce << endl; + cerr << ce << CLPENDL; m_returnValue = CIMValue(2u); m_errorMsg = String(ce.getDescription()); } catch (Exception& e) { - cerr << e << endl; + cerr << e << CLPENDL; } return m_returnValue; @@ -174,7 +174,7 @@ } catch (const CIMException& ce) { - cerr << ce << endl; + cerr << ce << CLPENDL; /*XXX Need to specify a real error value here */ m_returnValue = CIMValue(2u); } @@ -213,13 +213,13 @@ } catch (const CIMException& ce) { - cerr << ce << endl; + cerr << ce << CLPENDL; m_returnValue = CIMValue((UInt32)-1); m_errorMsg = String(ce.getDescription()); } catch (Exception& e) { - cerr << e << endl; + cerr << e << CLPENDL; } return m_returnValue; @@ -368,14 +368,14 @@ } catch (const CIMException& ce) { - cerr << ce << endl; + cerr << ce << CLPENDL; m_returnValue = CIMValue((UInt32)-1); m_errorMsg = String("Invalid parameter for method ") + paramName; ret = false; } catch (Exception& e) { - cerr << e << endl; + cerr << e << CLPENDL; ret = false; } return ret; @@ -410,14 +410,14 @@ } catch (const CIMException& ce) { - cerr << ce << endl; + cerr << ce << CLPENDL; m_returnValue = CIMValue((UInt32)-1); m_errorMsg = String("Invalid method invocation string"); ret = false; } catch (Exception& e) { - cerr << e << endl; + cerr << e << CLPENDL; ret = false; } Modified: clp/trunk/src/omcclpcmdreset.cpp =================================================================== --- clp/trunk/src/omcclpcmdreset.cpp 2006-12-04 23:15:57 UTC (rev 413) +++ clp/trunk/src/omcclpcmdreset.cpp 2006-12-05 00:09:31 UTC (rev 414) @@ -118,14 +118,14 @@ { getCmdStatusRef()->setStatus(COMMAND_EXECUTION_FAILED); getCmdStatusRef()->setCIMStatus (CIM_ERR_UNEXPECTED_RESPONSE); - cerr << "reset command general error: " << ce << endl; + cerr << "reset command general error: " << ce << CLPENDL; return false; } catch (Exception& e) { getCmdStatusRef()->setStatus(COMMAND_EXECUTION_FAILED); getCmdStatusRef()->setCIMStatus (CIM_ERR_UNEXPECTED_RESPONSE); - cerr << "reset command general error: " << e << endl; + cerr << "reset command general error: " << e << CLPENDL; return false; } } Modified: clp/trunk/src/omcclpcmdshow.cpp =================================================================== --- clp/trunk/src/omcclpcmdshow.cpp 2006-12-04 23:15:57 UTC (rev 413) +++ clp/trunk/src/omcclpcmdshow.cpp 2006-12-05 00:09:31 UTC (rev 414) @@ -76,11 +76,11 @@ } catch (const CIMException& ce) { - cerr << ce << endl; + cerr << ce << CLPENDL; } catch (Exception& e) { - cerr << e << endl; + cerr << e << CLPENDL; } /* If a specific traversal level was specified on the command line @@ -210,11 +210,11 @@ } catch (const CIMException& ce) { - cerr << ce << endl; + cerr << ce << CLPENDL; } catch (Exception& e) { - cerr << e << endl; + cerr << e << CLPENDL; } /* If a specific traversal level was specified on the command line @@ -475,7 +475,7 @@ } catch (const Exception& e) { - clpout << e.getMessage() << endl; + clpout << e.getMessage() << CLPENDL; } handler->outputTail(clpSession->clpout()); delete handler; Modified: clp/trunk/src/omcclpcmdstart.cpp =================================================================== --- clp/trunk/src/omcclpcmdstart.cpp 2006-12-04 23:15:57 UTC (rev 413) +++ clp/trunk/src/omcclpcmdstart.cpp 2006-12-05 00:09:31 UTC (rev 414) @@ -118,14 +118,14 @@ { getCmdStatusRef()->setStatus(COMMAND_EXECUTION_FAILED); getCmdStatusRef()->setCIMStatus (CIM_ERR_UNEXPECTED_RESPONSE); - cerr << "start command general error: " << ce << endl; + cerr << "start command general error: " << ce << CLPENDL; return false; } catch (Exception& e) { getCmdStatusRef()->setStatus(COMMAND_EXECUTION_FAILED); getCmdStatusRef()->setCIMStatus (CIM_ERR_UNEXPECTED_RESPONSE); - cerr << "start command general error: " << e << endl; + cerr << "start command general error: " << e << CLPENDL; return false; } } Modified: clp/trunk/src/omcclpcmdstop.cpp =================================================================== --- clp/trunk/src/omcclpcmdstop.cpp 2006-12-04 23:15:57 UTC (rev 413) +++ clp/trunk/src/omcclpcmdstop.cpp 2006-12-05 00:09:31 UTC (rev 414) @@ -120,14 +120,14 @@ { getCmdStatusRef()->setStatus(COMMAND_EXECUTION_FAILED); getCmdStatusRef()->setCIMStatus (CIM_ERR_UNEXPECTED_RESPONSE); - cerr << "stop command general error: " << ce << endl; + cerr << "stop command general error: " << ce << CLPENDL; return false; } catch (Exception& e) { getCmdStatusRef()->setStatus(COMMAND_EXECUTION_FAILED); getCmdStatusRef()->setCIMStatus (CIM_ERR_UNEXPECTED_RESPONSE); - cerr << "stop command general error: " << e << endl; + cerr << "stop command general error: " << e << CLPENDL; return false; } } Modified: clp/trunk/src/omcclpcommand.cpp =================================================================== --- clp/trunk/src/omcclpcommand.cpp 2006-12-04 23:15:57 UTC (rev 413) +++ clp/trunk/src/omcclpcommand.cpp 2006-12-05 00:09:31 UTC (rev 414) @@ -335,11 +335,11 @@ } catch (const CIMException& ce) { - cerr << ce << endl; + cerr << ce << CLPENDL; } catch (Exception& e) { - cerr << e << endl; + cerr << e << CLPENDL; } catch (...) { @@ -382,11 +382,11 @@ } catch (const CIMException& ce) { - cerr << ce << endl; + cerr << ce << CLPENDL; } catch (Exception& e) { - cerr << e << endl; + cerr << e << CLPENDL; } catch (...) { @@ -550,7 +550,7 @@ /* If there was a general message or message error, then display it */ if (getCmdStatusRef()->getMessageData()->getMessageID() != 0) { - clpout << getCmdStatusRef()->getMessageData()->getMessage() << endl; + clpout << getCmdStatusRef()->getMessageData()->getMessage() << CLPENDL; } break; case OUTPUT_DISPLAY_KEYWORD: Modified: clp/trunk/src/omcclpcommandline.cpp =================================================================== --- clp/trunk/src/omcclpcommandline.cpp 2006-12-04 23:15:57 UTC (rev 413) +++ clp/trunk/src/omcclpcommandline.cpp 2006-12-05 00:09:31 UTC (rev 414) @@ -52,7 +52,7 @@ */ static void display_message (const char *msg) { - cout << endl << msg << endl; + cout << CLPENDL << msg << CLPENDL; rl_on_new_line(); } Modified: clp/trunk/src/omcclpcommandstatus.cpp =================================================================== --- clp/trunk/src/omcclpcommandstatus.cpp 2006-12-04 23:15:57 UTC (rev 413) +++ clp/trunk/src/omcclpcommandstatus.cpp 2006-12-05 00:09:31 UTC (rev 414) @@ -299,13 +299,13 @@ switch (displayArg) { case OUTPUT_DISPLAY_TEXT: - str_msg += "\n"; + str_msg += "\r\n"; break; case OUTPUT_DISPLAY_KEYWORD: - str_msg = "status=" + str_msg + "\n"; + str_msg = "status=" + str_msg + "\r\n"; break; case OUTPUT_DISPLAY_CLPXML: - str_msg = "<status>" + str_msg + "</status>" + "\n"; + str_msg = "<status>" + str_msg + "</status>" + "\r\n"; break; } @@ -343,13 +343,13 @@ switch (displayArg) { case OUTPUT_DISPLAY_TEXT: - str_msg += "\n"; + str_msg += "\r\n"; break; case OUTPUT_DISPLAY_KEYWORD: - str_msg = "status_tag=" + str_msg + "\n"; + str_msg = "status_tag=" + str_msg + "\r\n"; break; case OUTPUT_DISPLAY_CLPXML: - str_msg = "<status_tag>" + str_msg + "</status_tag>" + "\n"; + str_msg = "<status_tag>" + str_msg + "</status_tag>" + "\r\n"; break; } @@ -380,13 +380,13 @@ switch (displayArg) { case OUTPUT_DISPLAY_TEXT: - str_msg += "\n"; + str_msg += "\r\n"; break; case OUTPUT_DISPLAY_KEYWORD: - str_msg = "error=" + str_msg + "\n"; + str_msg = "error=" + str_msg + "\r\n"; break; case OUTPUT_DISPLAY_CLPXML: - str_msg = "<error>" + str_msg + "</error>" + "\n"; + str_msg = "<error>" + str_msg + "</error>" + "\r\n"; break; } @@ -419,13 +419,13 @@ switch (displayArg) { case OUTPUT_DISPLAY_TEXT: - str_msg += "\n"; + str_msg += "\r\n"; break; case OUTPUT_DISPLAY_KEYWORD: - str_msg = "error_tag=" + str_msg + "\n"; + str_msg = "error_tag=" + str_msg + "\r\n"; break; case OUTPUT_DISPLAY_CLPXML: - str_msg = "<error_tag>" + str_msg + "</error_tag>" + "\n"; + str_msg = "<error_tag>" + str_msg + "</error_tag>" + "\r\n"; break; } @@ -473,13 +473,13 @@ switch (displayArg) { case OUTPUT_DISPLAY_TEXT: - str_msg += "\n"; + str_msg += "\r\n"; break; case OUTPUT_DISPLAY_KEYWORD: - str_msg = "errtype=" + str_msg + "\n"; + str_msg = "errtype=" + str_msg + "\r\n"; break; case OUTPUT_DISPLAY_CLPXML: - str_msg = "<errtype>" + str_msg + "</errtype>" + "\n"; + str_msg = "<errtype>" + str_msg + "</errtype>" + "\r\n"; break; } @@ -512,13 +512,13 @@ switch (displayArg) { case OUTPUT_DISPLAY_TEXT: - str_msg += "\n"; + str_msg += "\r\n"; break; case OUTPUT_DISPLAY_KEYWORD: - str_msg = "errtype_desc=" + str_msg + "\n"; + str_msg = "errtype_desc=" + str_msg + "\r\n"; break; case OUTPUT_DISPLAY_CLPXML: - str_msg = "<errtype_desc>" + str_msg + "</errtype_desc>" + "\n"; + str_msg = "<errtype_desc>" + str_msg + "</errtype_desc>" + "\r\n"; break; } @@ -552,10 +552,10 @@ str_msg += "\n"; break; case OUTPUT_DISPLAY_KEYWORD: - str_msg = "cimstat=" + str_msg + "\n"; + str_msg = "cimstat=" + str_msg + "\r\n"; break; case OUTPUT_DISPLAY_CLPXML: - str_msg = "<cimstat>" + str_msg + "</cimstat>" + "\n"; + str_msg = "<cimstat>" + str_msg + "</cimstat>" + "\r\n"; break; } @@ -588,13 +588,13 @@ switch (displayArg) { case OUTPUT_DISPLAY_TEXT: - str_msg += "\n"; + str_msg += "\r\n"; break; case OUTPUT_DISPLAY_KEYWORD: - str_msg = "cimstat_desc=" + str_msg + "\n"; + str_msg = "cimstat_desc=" + str_msg + "\r\n"; break; case OUTPUT_DISPLAY_CLPXML: - str_msg = "<cimstat_desc>" + str_msg + "</cimstat_desc>" + "\n"; + str_msg = "<cimstat_desc>" + str_msg + "</cimstat_desc>" + "\r\n"; break; } @@ -625,13 +625,13 @@ switch (displayArg) { case OUTPUT_DISPLAY_TEXT: - str_msg += "\n"; + str_msg += "\r\n"; break; case OUTPUT_DISPLAY_KEYWORD: - str_msg = "severity=" + str_msg + "\n"; + str_msg = "severity=" + str_msg + "\r\n"; break; case OUTPUT_DISPLAY_CLPXML: - str_msg = "<severity>" + str_msg + "</severity>" + "\n"; + str_msg = "<severity>" + str_msg + "</severity>" + "\r\n"; break; } @@ -664,13 +664,13 @@ switch (displayArg) { case OUTPUT_DISPLAY_TEXT: - str_msg += "\n"; + str_msg += "\r\n"; break; case OUTPUT_DISPLAY_KEYWORD: - str_msg = "severity_desc=" + str_msg + "\n"; + str_msg = "severity_desc=" + str_msg + "\r\n"; break; case OUTPUT_DISPLAY_CLPXML: - str_msg = "<severity_desc>" + str_msg + "</severity_desc>" + "\n"; + str_msg = "<severity_desc>" + str_msg + "</severity_desc>" + "\r\n"; break; } @@ -701,13 +701,13 @@ switch (displayArg) { case OUTPUT_DISPLAY_TEXT: - str_msg += "\n"; + str_msg += "\r\n"; break; case OUTPUT_DISPLAY_KEYWORD: - str_msg = "probcause=" + str_msg + "\n"; + str_msg = "probcause=" + str_msg + "\r\n"; break; case OUTPUT_DISPLAY_CLPXML: - str_msg = "<probcause>" + str_msg + "</probcause>" + "\n"; + str_msg = "<probcause>" + str_msg + "</probcause>" + "\r\n"; break; } @@ -740,13 +740,13 @@ switch (displayArg) { case OUTPUT_DISPLAY_TEXT: - str_msg += "\n"; + str_msg += "\r\n"; break; case OUTPUT_DISPLAY_KEYWORD: - str_msg = "probcause_desc=" + str_msg + "\n"; + str_msg = "probcause_desc=" + str_msg + "\r\n"; break; case OUTPUT_DISPLAY_CLPXML: - str_msg = "<probcause_desc>" + str_msg + "</probcause_desc>" + "\n"; + str_msg = "<probcause_desc>" + str_msg + "</probcause_desc>" + "\r\n"; break; } Modified: clp/trunk/src/omcclpcommon.cpp =================================================================== --- clp/trunk/src/omcclpcommon.cpp 2006-12-04 23:15:57 UTC (rev 413) +++ clp/trunk/src/omcclpcommon.cpp 2006-12-05 00:09:31 UTC (rev 414) @@ -309,14 +309,14 @@ catch (const CIMException& ce) { #ifdef DEBUG1 - cerr << ce << endl; + cerr << ce << CLPENDL; #endif result = false; } catch (Exception& e) { #ifdef DEBUG1 - cerr << e << endl; + cerr << e << CLPENDL; #endif result = false; } @@ -474,7 +474,7 @@ CIMObjectPath cop = enu.nextElement(); #ifdef DEBUG1 - cout << ufit << " " << getUFiSFromObjectPath(cop) << endl; + cout << ufit << " " << getUFiSFromObjectPath(cop) << CLPENDL; #endif /* Match the specifed UFiS with the derived UFiS from the @@ -717,9 +717,9 @@ try { #ifdef DEBUG1 - cout << endl << baseCop.toString(); - cout << endl << assocCT; - cout << endl << subUFcT; + cout << CLPENDL << baseCop.toString(); + cout << CLPENDL << assocCT; + cout << CLPENDL << subUFcT; #endif /* Enumerate through all of the selected CIMObjects looking for the one that matches the specified UFiS */ @@ -765,7 +765,7 @@ } catch (Exception& e) { - cerr << e << endl; + cerr << e << CLPENDL; } } } @@ -917,9 +917,9 @@ try { #ifdef DEBUG1 - cout << endl << baseCop.toString(); - cout << endl << assocCT; - cout << endl << subUFcT; + cout << CLPENDL << baseCop.toString(); + cout << CLPENDL << assocCT; + cout << CLPENDL << subUFcT; #endif /* Enumerate through all of the selected CIMObjects looking for the one that matches the specified UFiS */ @@ -952,11 +952,11 @@ } catch (const CIMException& ce) { - cerr << ce << endl; + cerr << ce << CLPENDL; } catch (Exception& e) { - cerr << e << endl; + cerr << e << CLPENDL; } } } Modified: clp/trunk/src/omcclpcommon.h =================================================================== --- clp/trunk/src/omcclpcommon.h 2006-12-04 23:15:57 UTC (rev 413) +++ clp/trunk/src/omcclpcommon.h 2006-12-05 00:09:31 UTC (rev 414) @@ -46,20 +46,22 @@ using std::cerr; using std::cin; using std::cout; -using std::endl; +//using std::endl; extern void* addrgram__set_scan_string( const char *yy_str ); extern int addrgram_doparse (void *omcclp); #define DISPLAY_ARRAY1(disparray,meth) \ for (int aaa=0; aaa<disparray.size(); aaa++) { \ - cout << disparray[aaa].meth() << endl; } + cout << disparray[aaa].meth() << CLPENDL; } #define STRIP_QUOTES(s) \ if (s.startsWith('"') && s.endsWith('"')) { \ s = s.substring(1); \ s = s.substring(0,s.length()-1); } +#define CLPENDL "\r\n" + namespace OMCCLP { class OMCCLPProgram; Modified: clp/trunk/src/omcclpconf.cpp =================================================================== --- clp/trunk/src/omcclpconf.cpp 2006-12-04 23:15:57 UTC (rev 413) +++ clp/trunk/src/omcclpconf.cpp 2006-12-05 00:09:31 UTC (rev 414) @@ -25,6 +25,7 @@ #include "omcclpconf.h" +#include "omcclpcommon.h" namespace OMCCLP { @@ -90,7 +91,7 @@ { if (m_filename.empty()) { - cout << "No configuration file specified" << endl; + cout << "No configuration file specified" << CLPENDL; return; } Modified: clp/trunk/src/omcclpd.cpp =================================================================== --- clp/trunk/src/omcclpd.cpp 2006-12-04 23:15:57 UTC (rev 413) +++ clp/trunk/src/omcclpd.cpp 2006-12-05 00:09:31 UTC (rev 414) @@ -72,8 +72,8 @@ /*XXX will be enabled with job tracking exists if (!createCLPJobInfo(m_cimClient)) { - cerr << "Could not create a CLP job instance" << endl; - cerr << "Running without CLP job data" << endl; + cerr << "Could not create a CLP job instance" << CLPENDL; + cerr << "Running without CLP job data" << CLPENDL; } */ @@ -95,11 +95,11 @@ } catch (const CIMException& ce) { - cerr << "execute general error: " << ce << endl; + cerr << "execute general error: " << ce << CLPENDL; } catch (Exception& e) { - cerr << "execute general error: " << e << endl; + cerr << "execute general error: " << e << CLPENDL; } try @@ -109,12 +109,12 @@ catch (const CIMException& ce) { rnclpCommand->display(); - cerr << "display general error: " << ce << endl; + cerr << "display general error: " << ce << CLPENDL; } catch (Exception& e) { rnclpCommand->display(); - cerr << "display general error: " << e << endl; + cerr << "display general error: " << e << CLPENDL; } } else Modified: clp/trunk/src/omcclpprint.cpp =================================================================== --- clp/trunk/src/omcclpprint.cpp 2006-12-04 23:15:57 UTC (rev 413) +++ clp/trunk/src/omcclpprint.cpp 2006-12-05 00:09:31 UTC (rev 414) @@ -413,7 +413,7 @@ { for (size_t i = 0; i < verbs.size(); ++i) { - clpout << outputIndent() << verbs[i] << endl; + clpout << outputIndent() << verbs[i] << CLPENDL; } } @@ -424,7 +424,7 @@ { OMCCLPProgram* clpSession = m_showCmd->getCLPSession(); String cpName = cpa.getName(); - clpout << outputIndent() << "Role = " << cpName << endl; + clpout << outputIndent() << "Role = " << cpName << CLPENDL; CIMValue cv = cpa.getValue();; if (cv && cv.getType() == CIMDataType::REFERENCE) @@ -438,8 +438,8 @@ String UFcT = getUFcTFromCIMObjectPath (clpSession, ov); increaseIndent(); - clpout << outputIndent() << "UFiT: " << UFcT << UFiS << endl; - clpout << outputIndent() << "UFiP: " << UFiP << endl; + clpout << outputIndent() << "UFiT: " << UFcT << UFiS << CLPENDL; + clpout << outputIndent() << "UFiP: " << UFiP << CLPENDL; decreaseIndent(); } } @@ -452,7 +452,7 @@ { String UFiP = copi->getTargetPathRef()->getUFiP(); StringArray sa = UFiP.tokenize("/"); - clpout << outputIndent() << safeBack(sa) << endl; + clpout << outputIndent() << safeBack(sa) << CLPENDL; } /** @@ -460,11 +460,11 @@ */ void InstanceKeywordPrinter::outputProperty(std::ostream& clpout, const CIMObjectPath& cop, CIMProperty& prop) { - clpout << "begingroup=property" << endl; - clpout << "property_name=" << prop.getName()<< endl; + clpout << "begingroup=property" << CLPENDL; + clpout << "property_name=" << prop.getName()<< CLPENDL; // TODO this should get the value and type output that data - clpout << "property_value=" << prop.toString() << endl; - clpout << "endgroup" << endl; + clpout << "property_value=" << prop.toString() << CLPENDL; + clpout << "endgroup" << CLPENDL; } /** @@ -475,7 +475,7 @@ { for (size_t i = 0; i < verbs.size(); ++i) { - clpout << "verb=" << verbs[i] << endl; + clpout << "verb=" << verbs[i] << CLPENDL; } } @@ -486,8 +486,8 @@ { OMCCLPProgram* clpSession = m_showCmd->getCLPSession(); String cpName = cpa.getName(); - clpout << "begingroup=reference" << endl; - clpout << "role=" << cpName << endl; + clpout << "begingroup=reference" << CLPENDL; + clpout << "role=" << cpName << CLPENDL; CIMValue cv = cpa.getValue();; if (cv && cv.getType() == CIMDataType::REFERENCE) @@ -500,13 +500,13 @@ Int32 UFiS = getUFiSFromObjectPath (ov); String UFcT = getUFcTFromCIMObjectPath (clpSession, ov); - clpout << "begingroup=instance" << endl; - clpout << "ufit=" << UFcT << UFiS << endl; - clpout << "ufip=" << UFiP << endl; - clpout << "endgroup" << endl; + clpout << "begingroup=instance" << CLPENDL; + clpout << "ufit=" << UFcT << UFiS << CLPENDL; + clpout << "ufip=" << UFiP << CLPENDL; + clpout << "endgroup" << CLPENDL; } } - clpout << "endgroup" << endl; + clpout << "endgroup" << CLPENDL; } /** @@ -514,7 +514,7 @@ */ void InstanceKeywordPrinter::outputTarget(std::ostream& clpout, const OMCCLPCimObjectPathInfoRef& copi) { - clpout << "ufip=" << copi->getTargetPathRef()->getUFiP() << endl; + clpout << "ufip=" << copi->getTargetPathRef()->getUFiP() << CLPENDL; } /** @@ -537,12 +537,12 @@ */ void InstanceXMLPrinter::outputStandardVerbs(std::ostream& clpout, StringArray verbs) { - clpout << "<standardverbs>" << endl; + clpout << "<standardverbs>" << CLPENDL; for (size_t i = 0; i < verbs.size(); ++i) { clpout << verbs[i] << " "; } - clpout << endl << "</standardverbs>"; + clpout << CLPENDL << "</standardverbs>"; } /** @@ -552,8 +552,8 @@ { OMCCLPProgram* clpSession = m_showCmd->getCLPSession(); String cpName = cpa.getName(); - clpout << "<reference>" << endl; - clpout << "<role>" << cpName << "</role>" << endl; + clpout << "<reference>" << CLPENDL; + clpout << "<role>" << cpName << "</role>" << CLPENDL; CIMValue cv = cpa.getValue();; if (cv && cv.getType() == CIMDataType::REFERENCE) @@ -566,15 +566,15 @@ Int32 UFiS = getUFiSFromObjectPath (ov); String UFcT = getUFcTFromCIMObjectPath (clpSession, ov); - clpout << "<instance>" << endl; + clpout << "<instance>" << CLPENDL; clpout << "<ufit ufct=\"" << UFcT << "\" instance=\"" << UFiS << "\">" << - UFcT << UFiS << "</ufit>" << endl; - clpout << "<ufip>" << UFiP << "</ufip>" << endl; - clpout << "</instance>" << endl; + UFcT << UFiS << "</ufit>" << CLPENDL; + clpout << "<ufip>" << UFiP << "</ufip>" << CLPENDL; + clpout << "</instance>" << CLPENDL; } } - clpout << "</reference>" << endl; + clpout << "</reference>" << CLPENDL; } /** @@ -582,7 +582,7 @@ */ void InstanceXMLPrinter::outputTarget(std::ostream& clpout, const OMCCLPCimObjectPathInfoRef& copi) { - clpout << "<ufip>" << copi->getTargetPathRef()->getUFiP() << "</ufip>" << endl; + clpout << "<ufip>" << copi->getTargetPathRef()->getUFiP() << "</ufip>" << CLPENDL; } Modified: clp/trunk/src/omcclpprint.h =================================================================== --- clp/trunk/src/omcclpprint.h 2006-12-04 23:15:57 UTC (rev 413) +++ clp/trunk/src/omcclpprint.h 2006-12-05 00:09:31 UTC (rev 414) @@ -54,38 +54,38 @@ void virtual outputInstanceHead(std::ostream& clpout){} void virtual outputUFiP(std::ostream& clpout, const String& ufip) { - clpout << outputIndent() << "UFiP:" << endl; + clpout << outputIndent() << "UFiP:" << CLPENDL; increaseIndent(); - clpout << outputIndent() << ufip << endl; + clpout << outputIndent() << ufip << CLPENDL; decreaseIndent(); } void virtual outputUFcT(std::ostream& clpout, String ufct){} void virtual outputTargetHead(std::ostream& clpout){ - clpout << outputIndent() << "Targets:" << endl; + clpout << outputIndent() << "Targets:" << CLPENDL; } void virtual outputTarget(std::ostream& clpout, const OMCCLPCimObjectPathInfoRef& t); void virtual outputTargetTail(std::ostream& clpout){} void virtual outputPropertiesHead(std::ostream& clpout) { - clpout << outputIndent() << "Properties:" << endl; + clpout << outputIndent() << "Properties:" << CLPENDL; } void virtual outputProperty(std::ostream& clpout, const CIMInstance& ci, CIMProperty& prop) { String cpName = prop.getName(); - clpout << outputIndent() << cpName << " = " << getPropertyValue(ci, cpName) << endl; + clpout << outputIndent() << cpName << " = " << getPropertyValue(ci, cpName) << CLPENDL; } void virtual outputPropertiesTail(std::ostream& clpout){} void virtual outputAssociationsHead(std::ostream& clpout){ - clpout << outputIndent() << "Associations:" << endl; + clpout << outputIndent() << "Associations:" << CLPENDL; } void virtual outputAssociationHead(std::ostream& clpout, CIMInstance cia){ /*XXX This should print out the user friend name not a CIM class name */ - clpout << outputIndent() << "Association = " << cia.getName() << endl; + clpout << outputIndent() << "Association = " << cia.getName() << CLPENDL; } void virtual outputAssociation(std::ostream& clpout, CIMProperty cpa); void virtual outputAssociationTail(std::ostream& clpout){} void virtual outputAssociationsTail(std::ostream& clpout){} void virtual outputVerbsHead(std::ostream& clpout) { - clpout << outputIndent() << "Verbs:" << endl; + clpout << outputIndent() << "Verbs:" << CLPENDL; } void virtual outputStandardVerbs(std::ostream& clpout, StringArray verbs); void virtual outputOEMVerbs(std::ostream& clpout, StringArray verbs){} @@ -134,36 +134,36 @@ virtual ~InstanceKeywordPrinter() {}; void outputHead(std::ostream& clpout) {} - void outputTail(std::ostream& clpout) {clpout << "endoutput" << endl;} - void outputInstanceHead(std::ostream& clpout){clpout << "begingroup=instance" << endl;} + void outputTail(std::ostream& clpout) {clpout << "endoutput" << CLPENDL;} + void outputInstanceHead(std::ostream& clpout){clpout << "begingroup=instance" << CLPENDL;} void outputUFiP(std::ostream& clpout, const String& ufip) { - clpout << "ufip=" << ufip << endl; + clpout << "ufip=" << ufip << CLPENDL; } - void outputUFcT(std::ostream& clpout, String ufct) {clpout << "ufip=" << ufct << endl;} - void outputTargetHead(std::ostream& clpout){clpout << "begingroup=targets" << endl;} + void outputUFcT(std::ostream& clpout, String ufct) {clpout << "ufip=" << ufct << CLPENDL;} + void outputTargetHead(std::ostream& clpout){clpout << "begingroup=targets" << CLPENDL;} void outputTarget(std::ostream& clpout, const OMCCLPCimObjectPathInfoRef& t); - void outputTargetTail(std::ostream& clpout){clpout << "endgroup" << endl;} + void outputTargetTail(std::ostream& clpout){clpout << "endgroup" << CLPENDL;} void outputPropertiesHead(std::ostream& clpout) {} // TODO what should the type be for propValue? void outputProperty(std::ostream& clpout, const CIMObjectPath& cop, CIMProperty& prop); void outputPropertiesTail(std::ostream& clpout){} - void outputAssociationsHead(std::ostream& clpout) {clpout << "begingroup=associations" << endl;} + void outputAssociationsHead(std::ostream& clpout) {clpout << "begingroup=associations" << CLPENDL;} void outputAssociationHead(std::ostream& clpout, CIMInstance cia){ - clpout << "begingroup=association" << endl; - clpout << "name=" << cia.getName() << endl; + clpout << "begingroup=association" << CLPENDL; + clpout << "name=" << cia.getName() << CLPENDL; } void outputAssociation(std::ostream& clpout, CIMProperty cpa); - void outputAssociationTail(std::ostream& clpout){clpout << "endgroup" << endl;} - void outputAssociationsTail(std::ostream& clpout){clpout << "endgroup" << endl;} + void outputAssociationTail(std::ostream& clpout){clpout << "endgroup" << CLPENDL;} + void outputAssociationsTail(std::ostream& clpout){clpout << "endgroup" << CLPENDL;} void outputVerbsHead(std::ostream& clpout) { - clpout << "begingroup=verbs" << endl; + clpout << "begingroup=verbs" << CLPENDL; } void outputStandardVerbs(std::ostream& clpout, StringArray verbs); void outputOEMVerbs(std::ostream& clpout, StringArray verbs){} void outputVerbsTail(std::ostream& clpout) { - clpout << "endgroup" << endl; + clpout << "endgroup" << CLPENDL; } - void outputInstanceTail(std::ostream& clpout){clpout << "endgroup" << endl;} + void outputInstanceTail(std::ostream& clpout){clpout << "endgroup" << CLPENDL;} }; class InstanceXMLPrinter : public InstancePrinter { @@ -173,26 +173,26 @@ virtual ~InstanceXMLPrinter() {}; void outputHead(std::ostream& clpout) {} - void outputTail(std::ostream& clpout) {clpout << "</show></response>" << endl;} + void outputTail(std::ostream& clpout) {clpout << "</show></response>" << CLPENDL;} void outputInstanceHead(std::ostream& clpout){clpout << "<instance>";} void outputUFiP(std::ostream& clpout, const String& ufip){ - clpout << "<ufip>" << ufip <<"</ufip>" << endl; + clpout << "<ufip>" << ufip <<"</ufip>" << CLPENDL; } - void outputUFcT(std::ostream& clpout, String ufct) {clpout << "<ufip>" << ufct <<"</ufip>" << endl;} - void outputTargetHead(std::ostream& clpout){clpout << "<targets>" << endl;} + void outputUFcT(std::ostream& clpout, String ufct) {clpout << "<ufip>" << ufct <<"</ufip>" << CLPENDL;} + void outputTargetHead(std::ostream& clpout){clpout << "<targets>" << CLPENDL;} void outputTarget(std::ostream& clpout, const OMCCLPCimObjectPathInfoRef& t); - void outputTargetTail(std::ostream& clpout){clpout << "</targets>" << endl;} + void outputTargetTail(std::ostream& clpout){clpout << "</targets>" << CLPENDL;} void outputPropertiesHead(std::ostream& clpout) {clpout << "<properties>";} void outputProperty(std::ostream& clpout, const CIMObjectPath& cop, CIMProperty& prop); - void outputPropertiesTail(std::ostream& clpout){clpout <<"</properties>" << endl;} + void outputPropertiesTail(std::ostream& clpout){clpout <<"</properties>" << CLPENDL;} void outputAssociationsHead(std::ostream& clpout) {clpout << "<associations>";} void outputAssociationHead(std::ostream& clpout, CIMInstance cia) { clpout << "<association>"; - clpout << "<ufct>" << cia.getName() << "</ufct>" << endl; + clpout << "<ufct>" << cia.getName() << "</ufct>" << CLPENDL; } void outputAssociation(std::ostream& clpout, CIMProperty cpa); - void outputAssociationTail(std::ostream& clpout) {clpout << "</association>" << endl;} - void outputAssociationsTail(std::ostream& clpout) {clpout << "</associations>" << endl;} + void outputAssociationTail(std::ostream& clpout) {clpout << "</association>" << CLPENDL;} + void outputAssociationsTail(std::ostream& clpout) {clpout << "</associations>" << CLPENDL;} void outputVerbsHead(std::ostream& clpout) { clpout << "<verbs>"; } @@ -201,7 +201,7 @@ void outputVerbsTail(std::ostream& clpout) { clpout << "</verbs>"; } - void outputInstanceTail(std::ostream& clpout){clpout << "</instance>" << endl;} + void outputInstanceTail(std::ostream& clpout){clpout << "</instance>" << CLPENDL;} }; } Modified: clp/trunk/src/omcclpprogram.cpp =================================================================== --- clp/trunk/src/omcclpprogram.cpp 2006-12-04 23:15:57 UTC (rev 413) +++ clp/trunk/src/omcclpprogram.cpp 2006-12-05 00:09:31 UTC (rev 414) @@ -47,7 +47,7 @@ bool getCredentials(const String& realm, String& name, String& passwd, const String& details) { - cout << "Authentication required for " << realm << endl; + cout << "Authentication required for " << realm << CLPENDL; cout << "Enter the user name: "; name = String::getLine(cin); passwd = GetPass::getPass("Enter the password for " + @@ -58,7 +58,7 @@ static void display_message (const char *msg) { - cout << endl << msg << endl; + cout << CLPENDL << msg << CLPENDL; } namespace OMCCLP { @@ -113,7 +113,7 @@ #ifdef OMCCLPDAEMON OW_LOG_DEBUG(m_logger, msg); #else - cout << msg << endl; + cout << msg << CLPENDL; #endif } @@ -122,7 +122,7 @@ #ifdef OMCCLPDAEMON OW_LOG_INFO(m_logger, msg); #else - cout << msg << endl; + cout << msg << CLPENDL; #endif } @@ -245,7 +245,7 @@ //#else // display_message (se.c_str()); //#endif -cout << se << endl; +cout << se << CLPENDL; } catch (Exception& e) { @@ -254,7 +254,7 @@ //#else // display_message (e.getMessage()); //#endif -cout << e << endl; +cout << e << CLPENDL; } return false; } Modified: clp/trunk/src/omcclptargetpath.cpp =================================================================== --- clp/trunk/src/omcclptargetpath.cpp 2006-12-04 23:15:57 UTC (rev 413) +++ clp/trunk/src/omcclptargetpath.cpp 2006-12-05 00:09:31 UTC (rev 414) @@ -421,9 +421,9 @@ try { #ifdef DEBUG1 - cout << endl << baseCop.toString(); - cout << endl << assocCT; - cout << endl << subUFcT; + cout << CLPENDL << baseCop.toString(); + cout << CLPENDL << assocCT; + cout << CLPENDL << subUFcT; #endif /* Enumerate through all of the selected CIMObjects looking for the one @@ -477,7 +477,7 @@ } catch (Exception& e) { - cerr << e << endl; + cerr << e << CLPENDL; } } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <bni...@us...> - 2006-12-08 22:43:44
|
Revision: 417 http://svn.sourceforge.net/omc/?rev=417&view=rev Author: bnicholes Date: 2006-12-08 14:43:44 -0800 (Fri, 08 Dec 2006) Log Message: ----------- Make sure that the command terminator is recognized as a LF, CR or CRLF Modified Paths: -------------- clp/trunk/src/omcclpdsvrconnection.cpp clp/trunk/src/omcclpdsvrconnection.h Modified: clp/trunk/src/omcclpdsvrconnection.cpp =================================================================== --- clp/trunk/src/omcclpdsvrconnection.cpp 2006-12-08 22:41:31 UTC (rev 416) +++ clp/trunk/src/omcclpdsvrconnection.cpp 2006-12-08 22:43:44 UTC (rev 417) @@ -36,6 +36,7 @@ #include <openwbem/OW_SortedVectorMap.hpp> #include <openwbem/OW_StringBuffer.hpp> #include <openwbem/OW_ThreadCancelledException.hpp> +#include <iostream> #if defined(BAD) #undef BAD @@ -92,7 +93,44 @@ OW_LOG_DEBUG(m_pServer->getEnv()->getLogger(COMPONENT_NAME), "OMCClpdSvrConnection object destroyed"); } + ////////////////////////////////////////////////////////////////////////////// +// Get one line from an input stream. This StringBuffer object will be +// reset (cleared) before an attempt is made to retrieve the line. +const String OMCClpdSvrConnection::getLine(std::istream& is) +{ + String bfr; + + if (is) + { + size_t count = 0; + std::streambuf *sb = is.rdbuf(); + + while (1) + { + int ch = sb->sbumpc(); + if (ch == EOF) + { + is.setstate(count == 0 + ? (std::ios::failbit | std::ios::eofbit) : std::ios::eofbit); + break; + } + + ++count; + + if ((ch == '\n') || (ch == '\r')) + { + break; + } + + bfr += String((char)ch); + } + } + + return bfr; +} + +////////////////////////////////////////////////////////////////////////////// void OMCClpdSvrConnection::run() { @@ -128,7 +166,7 @@ { if (!firstLine) { - String line = String::getLine(sistr); + String line = getLine(sistr); OW_LOG_DEBUG(logger, Format("OMCClpdSvrConnection received line: %1", line)); Modified: clp/trunk/src/omcclpdsvrconnection.h =================================================================== --- clp/trunk/src/omcclpdsvrconnection.h 2006-12-08 22:41:31 UTC (rev 416) +++ clp/trunk/src/omcclpdsvrconnection.h 2006-12-08 22:43:44 UTC (rev 417) @@ -76,6 +76,8 @@ protected: + const String getLine(std::istream& is); + private: OMCClpdServer* m_pServer; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <bni...@us...> - 2006-12-08 22:45:20
|
Revision: 418 http://svn.sourceforge.net/omc/?rev=418&view=rev Author: bnicholes Date: 2006-12-08 14:45:14 -0800 (Fri, 08 Dec 2006) Log Message: ----------- Allow the value map values on a set command to be resolved before passing them to the cimom Modified Paths: -------------- clp/trunk/src/omcclpcmdmapping.cpp clp/trunk/src/omcclpcmdmapping.h Modified: clp/trunk/src/omcclpcmdmapping.cpp =================================================================== --- clp/trunk/src/omcclpcmdmapping.cpp 2006-12-08 22:43:44 UTC (rev 417) +++ clp/trunk/src/omcclpcmdmapping.cpp 2006-12-08 22:45:14 UTC (rev 418) @@ -25,7 +25,7 @@ #ifdef HAVE_CONFIG_H - #include <config.h> + #include <config.h> #endif #include "omcclpprogram.h" @@ -48,33 +48,33 @@ */ CIMValue SMCmdMapping::smRequestStateChange (const CIMObjectPath& cop, Int32 reqState) { - m_methodToCall = m_methodCalled = "RequestStateChange"; - m_cimObjectPath = cop; + m_methodToCall = m_methodCalled = "RequestStateChange"; + m_cimObjectPath = cop; - try - { - /* Push the parameters on the input parameter array. */ - /*XXX For now we aren't going to worry about the timeoutperiod. - That will come later */ - m_inParams.push_back(CIMParamValue("RequestedState", CIMValue(UInt16(reqState)))); - m_inParams.push_back(CIMParamValue("TimeoutPeriod", CIMValue(CIMDateTime(0)))); + try + { + /* Push the parameters on the input parameter array. */ + /*XXX For now we aren't going to worry about the timeoutperiod. + That will come later */ + m_inParams.push_back(CIMParamValue("RequestedState", CIMValue(UInt16(reqState)))); + m_inParams.push_back(CIMParamValue("TimeoutPeriod", CIMValue(CIMDateTime(0)))); - /*XXX The out paramenter should be checked for a job object, but that will come later */ + /*XXX The out paramenter should be checked for a job object, but that will come later */ - m_returnValue = m_cimClient->invokeMethod (m_cimObjectPath, m_methodToCall, m_inParams, m_outParams); - } - catch (const CIMException& ce) - { - cerr << ce << CLPENDL; - m_returnValue = CIMValue(2u); - m_errorMsg = String(ce.getDescription()); - } - catch (Exception& e) - { - cerr << e << CLPENDL; - } + m_returnValue = m_cimClient->invokeMethod (m_cimObjectPath, m_methodToCall, m_inParams, m_outParams); + } + catch (const CIMException& ce) + { + cerr << ce << CLPENDL; + m_returnValue = CIMValue(2u); + m_errorMsg = String(ce.getDescription()); + } + catch (Exception& e) + { + cerr << e << CLPENDL; + } - return m_returnValue; + return m_returnValue; } /** @@ -82,8 +82,8 @@ */ CIMValue SMCmdMapping::smResetRSC (const CIMObjectPath& cop) { - // Send a reset which evaluates to id 11 - return smRequestStateChange (cop, 11); + // Send a reset which evaluates to id 11 + return smRequestStateChange (cop, 11); } /** @@ -91,8 +91,8 @@ */ CIMValue SMCmdMapping::smStartRSC (const CIMObjectPath& cop) { - // Send a Enabled which evaluates to id 2 - return smRequestStateChange (cop, 2); + // Send a Enabled which evaluates to id 2 + return smRequestStateChange (cop, 2); } /** @@ -100,8 +100,8 @@ */ CIMValue SMCmdMapping::smStopRSC (const CIMObjectPath& cop) { - // Send a Disabled which evaluates to id 3 - return smRequestStateChange (cop, 3); + // Send a Disabled which evaluates to id 3 + return smRequestStateChange (cop, 3); } /** @@ -110,7 +110,7 @@ */ CIMValue SMCmdMapping::smOpDeleteInstance (const CIMObjectPath& cop) { - m_returnValue = CIMValue(0u); + m_returnValue = CIMValue(0u); try { @@ -145,15 +145,15 @@ } catch (const CIMException& ce) { - m_errorMsg = String(ce.getDescription()); - /*XXX Need to specify a real error value here */ - m_returnValue = CIMValue(2u); + m_errorMsg = String(ce.getDescription()); + /*XXX Need to specify a real error value here */ + m_returnValue = CIMValue(2u); } catch (Exception& e) { - m_errorMsg = String(e.getMessage()); - /*XXX Need to specify a real error value here */ - m_returnValue = CIMValue(2u); + m_errorMsg = String(e.getMessage()); + /*XXX Need to specify a real error value here */ + m_returnValue = CIMValue(2u); } return m_returnValue; @@ -165,35 +165,39 @@ */ CIMValue SMCmdMapping::smModifyInstance (const CIMObjectPath& cop) { - m_returnValue = CIMValue(0u); + m_returnValue = CIMValue(0u); - CIMInstance ci; - try - { - ci = m_cimClient->getInstance(cop); - } - catch (const CIMException& ce) - { - cerr << ce << CLPENDL; - /*XXX Need to specify a real error value here */ - m_returnValue = CIMValue(2u); - } + CIMInstance ci; + try + { + ci = m_cimClient->getInstance(cop, WBEMFlags::E_NOT_LOCAL_ONLY, + WBEMFlags::E_INCLUDE_QUALIFIERS); + } + catch (const CIMException& ce) + { + cerr << ce << CLPENDL; + /*XXX Need to specify a real error value here */ + m_returnValue = CIMValue(2u); + } - for (int i=0;i<m_property_names.size();i++) - { - ci.updatePropertyValue(m_property_names[i], m_property_values[i]); - } - try - { - m_cimClient->modifyInstance(ci, WBEMFlags::E_EXCLUDE_QUALIFIERS, &m_property_names); - } - catch (const CIMException& ce) - { - m_returnValue = CIMValue((UInt32)ce.getErrNo()); - m_errorMsg = String(ce.getDescription()); - } + for (int i=0;i<m_property_names.size();i++) + { + CIMProperty cprop = ci.getProperty(CIMName(m_property_names[i])); + CIMValue cv = resolveMappedValue(cprop, m_property_values[i].toString()); - return m_returnValue; + ci.updatePropertyValue(m_property_names[i], cv); + } + try + { + m_cimClient->modifyInstance(ci, WBEMFlags::E_EXCLUDE_QUALIFIERS, &m_property_names); + } + catch (const CIMException& ce) + { + m_returnValue = CIMValue((UInt32)ce.getErrNo()); + m_errorMsg = String(ce.getDescription()); + } + + return m_returnValue; } /** @@ -203,26 +207,26 @@ */ CIMValue SMCmdMapping::smInvokeMethod (const CIMObjectPath& cop) { - m_cimObjectPath = cop; + m_cimObjectPath = cop; - try - { - m_methodCalled = m_methodToCall; - m_returnValue = m_cimClient->invokeMethod (m_cimObjectPath, m_methodToCall, - m_inParams, m_outParams); - } - catch (const CIMException& ce) - { - cerr << ce << CLPENDL; - m_returnValue = CIMValue((UInt32)-1); - m_errorMsg = String(ce.getDescription()); - } - catch (Exception& e) - { - cerr << e << CLPENDL; - } + try + { + m_methodCalled = m_methodToCall; + m_returnValue = m_cimClient->invokeMethod (m_cimObjectPath, m_methodToCall, + m_inParams, m_outParams); + } + catch (const CIMException& ce) + { + cerr << ce << CLPENDL; + m_returnValue = CIMValue((UInt32)-1); + m_errorMsg = String(ce.getDescription()); + } + catch (Exception& e) + { + cerr << e << CLPENDL; + } - return m_returnValue; + return m_returnValue; } /** @@ -231,8 +235,8 @@ */ void SMCmdMapping::setProperty (const String name, const CIMValue value) { - m_property_names.push_back(name); - m_property_values.push_back(value); + m_property_names.push_back(name); + m_property_values.push_back(value); } /** @@ -241,144 +245,279 @@ * val - String value to be converted to the correct type and * set */ +CIMValue SMCmdMapping::resolveMappedValue (const CIMProperty prop, const String val) +{ + CIMValue cv(val); + + try + { + switch (prop.getDataType().getType()) + { + case CIMDataType::UINT8: + try + { + cv = CIMValue(val.toUInt8()); + } + catch (Exception& e) + { + String v = getPropertyMappedValue(prop,val); + cv = CIMValue(v.toUInt8()); + } + break; + case CIMDataType::SINT8: + try + { + cv = CIMValue(val.toInt8()); + } + catch (Exception& e) + { + String v = getPropertyMappedValue(prop,val); + cv = CIMValue(v.toInt8()); + } + break; + case CIMDataType::UINT16: + try + { + cv = CIMValue(val.toUInt16()); + } + catch (Exception& e) + { + String v = getPropertyMappedValue(prop,val); + cv = CIMValue(v.toUInt16()); + } + break; + case CIMDataType::SINT16: + try + { + cv = CIMValue(val.toInt16()); + } + catch (Exception& e) + { + String v = getPropertyMappedValue(prop,val); + cv = CIMValue(v.toInt16()); + } + break; + case CIMDataType::UINT32: + try + { + cv = CIMValue(val.toUInt32()); + } + catch (Exception& e) + { + String v = getPropertyMappedValue(prop,val); + cv = CIMValue(v.toUInt32()); + } + break; + case CIMDataType::SINT32: + try + { + cv = CIMValue(val.toInt32()); + } + catch (Exception& e) + { + String v = getPropertyMappedValue(prop,val); + cv = CIMValue(v.toInt32()); + } + break; + case CIMDataType::UINT64: + try + { + cv = CIMValue(val.toUInt64()); + } + catch (Exception& e) + { + String v = getPropertyMappedValue(prop,val); + cv = CIMValue(v.toUInt64()); + } + break; + case CIMDataType::SINT64: + try + { + cv = CIMValue(val.toInt64()); + } + catch (Exception& e) + { + String v = getPropertyMappedValue(prop,val); + cv = CIMValue(v.toInt64()); + } + break; + case CIMDataType::BOOLEAN: + cv = CIMValue(val.toBool()); + break; + case CIMDataType::REAL32: + cv = CIMValue(val.toReal32()); + break; + case CIMDataType::REAL64: + cv = CIMValue(val.toReal64()); + break; + // case CIMDataType::DATETIME: + // cv = CIMValue(val.toDateTime()); + // break; + // case CIMDataType::CHAR16: + // cv = CIMValue(val.toChar16()); + // break; + } + } + catch (const CIMException& ce) + { + cerr << ce << CLPENDL; + m_returnValue = CIMValue((UInt32)-1); + m_errorMsg = String("Invalid property type "); + cv = CIMValue(val); + } + catch (Exception& e) + { + cerr << e << CLPENDL; + cv = CIMValue(val); + } + + return cv; +} + +/** +* Set an IN parameter for a method that will be invoked +* param - String name of the parameter +* val - String value to be converted to the correct type and +* set +*/ bool SMCmdMapping::setInParamValue (String param, String val) { - String paramName; - bool ret = true; + String paramName; + bool ret = true; - try - { - for (int i=0; i<m_inParamsDesc.size(); i++) - { - paramName = m_inParamsDesc[i].getName(); - if (param.equalsIgnoreCase(paramName)) - { - CIMValue cv(val); - switch (m_inParamsDesc[i].getType().getType()) - { - case CIMDataType::UINT8: - try - { - cv = CIMValue(val.toUInt8()); - } - catch (Exception& e) - { - String v = getParameterMappedValue(m_inParamsDesc[i],val); - cv = CIMValue(v.toUInt8()); - } - break; - case CIMDataType::SINT8: - try - { - cv = CIMValue(val.toInt8()); - } - catch (Exception& e) - { - String v = getParameterMappedValue(m_inParamsDesc[i],val); - cv = CIMValue(v.toInt8()); - } - break; - case CIMDataType::UINT16: - try - { - cv = CIMValue(val.toUInt16()); - } - catch (Exception& e) - { - String v = getParameterMappedValue(m_inParamsDesc[i],val); - cv = CIMValue(v.toUInt16()); - } - break; - case CIMDataType::SINT16: - try - { - cv = CIMValue(val.toInt16()); - } - catch (Exception& e) - { - String v = getParameterMappedValue(m_inParamsDesc[i],val); - cv = CIMValue(v.toInt16()); - } - break; - case CIMDataType::UINT32: - try - { - cv = CIMValue(val.toUInt32()); - } - catch (Exception& e) - { - String v = getParameterMappedValue(m_inParamsDesc[i],val); - cv = CIMValue(v.toUInt32()); - } - break; - case CIMDataType::SINT32: - try - { - cv = CIMValue(val.toInt32()); - } - catch (Exception& e) - { - String v = getParameterMappedValue(m_inParamsDesc[i],val); - cv = CIMValue(v.toInt32()); - } - break; - case CIMDataType::UINT64: - try - { - cv = CIMValue(val.toUInt64()); - } - catch (Exception& e) - { - String v = getParameterMappedValue(m_inParamsDesc[i],val); - cv = CIMValue(v.toUInt64()); - } - break; - case CIMDataType::SINT64: - try - { - cv = CIMValue(val.toInt64()); - } - catch (Exception& e) - { - String v = getParameterMappedValue(m_inParamsDesc[i],val); - cv = CIMValue(v.toInt64()); - } - break; - case CIMDataType::BOOLEAN: - cv = CIMValue(val.toBool()); - break; - case CIMDataType::REAL32: - cv = CIMValue(val.toReal32()); - break; - case CIMDataType::REAL64: - cv = CIMValue(val.toReal64()); - break; + try + { + for (int i=0; i<m_inParamsDesc.size(); i++) + { + paramName = m_inParamsDesc[i].getName(); + if (param.equalsIgnoreCase(paramName)) + { + CIMValue cv(val); + switch (m_inParamsDesc[i].getType().getType()) + { + case CIMDataType::UINT8: + try + { + cv = CIMValue(val.toUInt8()); + } + catch (Exception& e) + { + String v = getParameterMappedValue(m_inParamsDesc[i],val); + cv = CIMValue(v.toUInt8()); + } + break; + case CIMDataType::SINT8: + try + { + cv = CIMValue(val.toInt8()); + } + catch (Exception& e) + { + String v = getParameterMappedValue(m_inParamsDesc[i],val); + cv = CIMValue(v.toInt8()); + } + break; + case CIMDataType::UINT16: + try + { + cv = CIMValue(val.toUInt16()); + } + catch (Exception& e) + { + String v = getParameterMappedValue(m_inParamsDesc[i],val); + cv = CIMValue(v.toUInt16()); + } + break; + case CIMDataType::SINT16: + try + { + cv = CIMValue(val.toInt16()); + } + catch (Exception& e) + { + String v = getParameterMappedValue(m_inParamsDesc[i],val); + cv = CIMValue(v.toInt16()); + } + break; + case CIMDataType::UINT32: + try + { + cv = CIMValue(val.toUInt32()); + } + catch (Exception& e) + { + String v = getParameterMappedValue(m_inParamsDesc[i],val); + cv = CIMValue(v.toUInt32()); + } + break; + case CIMDataType::SINT32: + try + { + cv = CIMValue(val.toInt32()); + } + catch (Exception& e) + { + String v = getParameterMappedValue(m_inParamsDesc[i],val); + cv = CIMValue(v.toInt32()); + } + break; + case CIMDataType::UINT64: + try + { + cv = CIMValue(val.toUInt64()); + } + catch (Exception& e) + { + String v = getParameterMappedValue(m_inParamsDesc[i],val); + cv = CIMValue(v.toUInt64()); + } + break; + case CIMDataType::SINT64: + try + { + cv = CIMValue(val.toInt64()); + } + catch (Exception& e) + { + String v = getParameterMappedValue(m_inParamsDesc[i],val); + cv = CIMValue(v.toInt64()); + } + break; + case CIMDataType::BOOLEAN: + cv = CIMValue(val.toBool()); + break; + case CIMDataType::REAL32: + cv = CIMValue(val.toReal32()); + break; + case CIMDataType::REAL64: + cv = CIMValue(val.toReal64()); + break; // case CIMDataType::DATETIME: // cv = CIMValue(val.toDateTime()); // break; // case CIMDataType::CHAR16: // cv = CIMValue(val.toChar16()); // break; - } + } - setInParamValue(CIMParamValue(paramName, cv)); - break; - } - } - } - catch (const CIMException& ce) - { - cerr << ce << CLPENDL; - m_returnValue = CIMValue((UInt32)-1); - m_errorMsg = String("Invalid parameter for method ") + paramName; - ret = false; - } - catch (Exception& e) - { - cerr << e << CLPENDL; - ret = false; - } - return ret; + setInParamValue(CIMParamValue(paramName, cv)); + break; + } + } + } + catch (const CIMException& ce) + { + cerr << ce << CLPENDL; + m_returnValue = CIMValue((UInt32)-1); + m_errorMsg = String("Invalid parameter for method ") + paramName; + ret = false; + } + catch (Exception& e) + { + cerr << e << CLPENDL; + ret = false; + } + return ret; } /** @@ -389,58 +528,58 @@ */ bool SMCmdMapping::setMethodToCall(String cmd) { - String params; - bool ret = true; + String params; + bool ret = true; - /* Parse the method invocation string for the class name, - method name and parameters. */ - try - { - Int32 idxStart = 0; - Int32 idxEnd = cmd.indexOf('.'); - m_methodClassName = cmd.substring(idxStart, idxEnd); + /* Parse the method invocation string for the class name, + method name and parameters. */ + try + { + Int32 idxStart = 0; + Int32 idxEnd = cmd.indexOf('.'); + m_methodClassName = cmd.substring(idxStart, idxEnd); - idxStart = idxStart+idxEnd+1; - idxEnd = cmd.indexOf('(', idxStart) - idxStart; - m_methodToCall = cmd.substring(idxStart, idxEnd); + idxStart = idxStart+idxEnd+1; + idxEnd = cmd.indexOf('(', idxStart) - idxStart; + m_methodToCall = cmd.substring(idxStart, idxEnd); - idxStart = idxStart+idxEnd+1; - idxEnd = cmd.indexOf(')', idxStart) - idxStart; - params = cmd.substring(idxStart, idxEnd); - } - catch (const CIMException& ce) - { - cerr << ce << CLPENDL; - m_returnValue = CIMValue((UInt32)-1); - m_errorMsg = String("Invalid method invocation string"); - ret = false; - } - catch (Exception& e) - { - cerr << e << CLPENDL; - ret = false; - } + idxStart = idxStart+idxEnd+1; + idxEnd = cmd.indexOf(')', idxStart) - idxStart; + params = cmd.substring(idxStart, idxEnd); + } + catch (const CIMException& ce) + { + cerr << ce << CLPENDL; + m_returnValue = CIMValue((UInt32)-1); + m_errorMsg = String("Invalid method invocation string"); + ret = false; + } + catch (Exception& e) + { + cerr << e << CLPENDL; + ret = false; + } - /* Get the method description from the CIMOM so that it can - be matched with the actual parameter list. This will - tell us if everything lines up for the method call. */ - CIMClass cimCls = m_cimClient->getClass(m_methodClassName, E_NOT_LOCAL_ONLY, - E_INCLUDE_QUALIFIERS, E_INCLUDE_CLASS_ORIGIN); - CIMMethod cimMthd = cimCls.getMethod(m_methodToCall); + /* Get the method description from the CIMOM so that it can + be matched with the actual parameter list. This will + tell us if everything lines up for the method call. */ + CIMClass cimCls = m_cimClient->getClass(m_methodClassName, E_NOT_LOCAL_ONLY, + E_INCLUDE_QUALIFIERS, E_INCLUDE_CLASS_ORIGIN); + CIMMethod cimMthd = cimCls.getMethod(m_methodToCall); - if (cimMthd) - { - m_inParamsDesc = cimMthd.getINParameters(); - m_outParamsDesc = cimMthd.getOUTParameters(); - } - else - { - m_returnValue = CIMValue((UInt32)-1); - m_errorMsg = String("Method: ") + m_methodToCall + - String("doesn't exist for class ") + m_methodClassName; - ret = false; - } - return ret; + if (cimMthd) + { + m_inParamsDesc = cimMthd.getINParameters(); + m_outParamsDesc = cimMthd.getOUTParameters(); + } + else + { + m_returnValue = CIMValue((UInt32)-1); + m_errorMsg = String("Method: ") + m_methodToCall + + String("doesn't exist for class ") + m_methodClassName; + ret = false; + } + return ret; } /** @@ -448,43 +587,43 @@ */ String SMCmdMapping::getReturnValueText() { - /* Initialize the return value */ - String msg(""); + /* Initialize the return value */ + String msg(""); - /* If we don't have a contained object then bail out */ - if (!m_cimObjectPath) - return msg; + /* If we don't have a contained object then bail out */ + if (!m_cimObjectPath) + return msg; - /* Get the CIMMethod object for the called method */ - String clsName = m_cimObjectPath.getClassName(); - CIMClass cimCls = m_cimClient->getClass(clsName, E_NOT_LOCAL_ONLY, E_INCLUDE_QUALIFIERS, E_INCLUDE_CLASS_ORIGIN); - CIMMethod cimMeth = cimCls.getMethod(m_methodCalled); + /* Get the CIMMethod object for the called method */ + String clsName = m_cimObjectPath.getClassName(); + CIMClass cimCls = m_cimClient->getClass(clsName, E_NOT_LOCAL_ONLY, E_INCLUDE_QUALIFIERS, E_INCLUDE_CLASS_ORIGIN); + CIMMethod cimMeth = cimCls.getMethod(m_methodCalled); - if (cimMeth) - { - /* Get the valueMap and values for the called method */ - String retValue = m_returnValue.toString(); - CIMQualifier returnsMap = cimMeth.getQualifier("ValueMap"); - CIMQualifier returnsMsgs = cimMeth.getQualifier("Values"); - if (returnsMap && returnsMsgs) - { - /* Tokenize the string array so that we can match up the return - value with the value map */ - StringArray returnsMapSA = returnsMap.getValue().toStringArray(); - StringArray returnsMsgsSA = returnsMsgs.getValue().toStringArray(); + if (cimMeth) + { + /* Get the valueMap and values for the called method */ + String retValue = m_returnValue.toString(); + CIMQualifier returnsMap = cimMeth.getQualifier("ValueMap"); + CIMQualifier returnsMsgs = cimMeth.getQualifier("Values"); + if (returnsMap && returnsMsgs) + { + /* Tokenize the string array so that we can match up the return + value with the value map */ + StringArray returnsMapSA = returnsMap.getValue().toStringArray(); + StringArray returnsMsgsSA = returnsMsgs.getValue().toStringArray(); - for (int i=0;i<returnsMapSA.size();i++) - { - if (retValue.equals(returnsMapSA[i])) - { - msg = returnsMsgsSA[i]; - break; - } - } - } - } + for (int i=0;i<returnsMapSA.size();i++) + { + if (retValue.equals(returnsMapSA[i])) + { + msg = returnsMsgsSA[i]; + break; + } + } + } + } - return msg; + return msg; } /** @@ -492,34 +631,67 @@ */ String SMCmdMapping::getParameterMappedValue(CIMParameter param, String val) { - /* Initialize the return value */ - String retVal(""); + /* Initialize the return value */ + String retVal(""); - /* Get the valueMap and values for the parameter */ - CIMQualifier paramMap = param.getQualifier(CIMName("ValueMap")); - CIMQualifier paramValues = param.getQualifier(CIMName("Values")); + /* Get the valueMap and values for the parameter */ + CIMQualifier paramMap = param.getQualifier(CIMName("ValueMap")); + CIMQualifier paramValues = param.getQualifier(CIMName("Values")); - if (paramMap && paramValues) - { - /* Tokenize the string array so that we can match up the command - line value with the the value map */ - StringArray paramMapSA = paramMap.getValue().toStringArray(); - StringArray paramValuesSA = paramValues.getValue().toStringArray(); - STRIP_QUOTES(val); + if (paramMap && paramValues) + { + /* Tokenize the string array so that we can match up the command + line value with the the value map */ + StringArray paramMapSA = paramMap.getValue().toStringArray(); + StringArray paramValuesSA = paramValues.getValue().toStringArray(); + STRIP_QUOTES(val); - for (int i=0; i<paramValuesSA.size(); i++) - { - if (val.equalsIgnoreCase(paramValuesSA[i])) - { - retVal = paramMapSA[i]; - break; - } - } - } + for (int i=0; i<paramValuesSA.size(); i++) + { + if (val.equalsIgnoreCase(paramValuesSA[i])) + { + retVal = paramMapSA[i]; + break; + } + } + } - return retVal; + return retVal; } +/** +* Get the mapped value for a property +*/ +String SMCmdMapping::getPropertyMappedValue(CIMProperty prop, String val) +{ + /* Initialize the return value */ + String retVal(""); + /* Get the valueMap and values for the parameter */ + CIMQualifier qualMap = prop.getQualifier(CIMName("ValueMap")); + CIMQualifier qualValues = prop.getQualifier(CIMName("Values")); + + if (qualMap && qualValues) + { + /* Tokenize the string array so that we can match up the command + line value with the the value map */ + StringArray qualMapSA = qualMap.getValue().toStringArray(); + StringArray qualValuesSA = qualValues.getValue().toStringArray(); + STRIP_QUOTES(val); + + for (int i=0; i<qualValuesSA.size(); i++) + { + if (val.equalsIgnoreCase(qualValuesSA[i])) + { + retVal = qualMapSA[i]; + break; + } + } + } + + return retVal; } + +} + Modified: clp/trunk/src/omcclpcmdmapping.h =================================================================== --- clp/trunk/src/omcclpcmdmapping.h 2006-12-08 22:43:44 UTC (rev 417) +++ clp/trunk/src/omcclpcmdmapping.h 2006-12-08 22:45:14 UTC (rev 418) @@ -36,6 +36,7 @@ #include <openwbem/OW_CIMValue.hpp> #include <openwbem/OW_CIMParamValue.hpp> #include <openwbem/OW_CIMParameter.hpp> +#include <openwbem/OW_CIMProperty.hpp> namespace OMCCLP { @@ -84,6 +85,7 @@ String getReturnValueText(); String getParameterMappedValue(CIMParameter param, String val); + String getPropertyMappedValue(CIMProperty prop, String val); String getErrorMsgText() const {return m_errorMsg;} CIMValue getReturnValue() const {return m_returnValue;} CIMParamValueArray getInParamValues () {return m_inParams;} @@ -101,6 +103,7 @@ bool setMethodToCall(String cmd); void setProperty (const String name, const CIMValue value); + CIMValue resolveMappedValue (const CIMProperty prop, const String val); protected: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <bni...@us...> - 2006-12-08 23:08:18
|
Revision: 419 http://svn.sourceforge.net/omc/?rev=419&view=rev Author: bnicholes Date: 2006-12-08 15:08:19 -0800 (Fri, 08 Dec 2006) Log Message: ----------- Fix a typo with COMMAND COMPLETED Modified Paths: -------------- clp/trunk/src/omcclpcmdalias.cpp clp/trunk/src/omcclpcmdcd.cpp clp/trunk/src/omcclpcmdcreate.cpp clp/trunk/src/omcclpcmddelete.cpp clp/trunk/src/omcclpcmddump.cpp clp/trunk/src/omcclpcmdexit.cpp clp/trunk/src/omcclpcmdhelp.cpp clp/trunk/src/omcclpcmdload.cpp clp/trunk/src/omcclpcmdreset.cpp clp/trunk/src/omcclpcmdset.cpp clp/trunk/src/omcclpcmdshow.cpp clp/trunk/src/omcclpcmdstart.cpp clp/trunk/src/omcclpcmdstop.cpp clp/trunk/src/omcclpcmdversion.cpp clp/trunk/src/omcclpcommandstatus.cpp clp/trunk/src/omcclpcommandstatus.h Modified: clp/trunk/src/omcclpcmdalias.cpp =================================================================== --- clp/trunk/src/omcclpcmdalias.cpp 2006-12-08 22:45:14 UTC (rev 418) +++ clp/trunk/src/omcclpcmdalias.cpp 2006-12-08 23:08:19 UTC (rev 419) @@ -120,7 +120,7 @@ conf->SaveConfigurationFile(); } - getCmdStatusRef()->setStatus(COMMAND_COMPLETE); + getCmdStatusRef()->setStatus(COMMAND_COMPLETED); return true; } Modified: clp/trunk/src/omcclpcmdcd.cpp =================================================================== --- clp/trunk/src/omcclpcmdcd.cpp 2006-12-08 22:45:14 UTC (rev 418) +++ clp/trunk/src/omcclpcmdcd.cpp 2006-12-08 23:08:19 UTC (rev 419) @@ -107,7 +107,7 @@ return false; } - getCmdStatusRef()->setStatus(COMMAND_COMPLETE); + getCmdStatusRef()->setStatus(COMMAND_COMPLETED); return true; } Modified: clp/trunk/src/omcclpcmdcreate.cpp =================================================================== --- clp/trunk/src/omcclpcmdcreate.cpp 2006-12-08 22:45:14 UTC (rev 418) +++ clp/trunk/src/omcclpcmdcreate.cpp 2006-12-08 23:08:19 UTC (rev 419) @@ -172,7 +172,7 @@ try { CIMValue cv = cc->invokeMethod (invokeCop, methodName, inParams, outParams); - getCmdStatusRef()->setStatus(COMMAND_COMPLETE); + getCmdStatusRef()->setStatus(COMMAND_COMPLETED); return true; } catch ( CIMException& ce ) @@ -198,7 +198,7 @@ return false; } - getCmdStatusRef()->setStatus(COMMAND_COMPLETE); + getCmdStatusRef()->setStatus(COMMAND_COMPLETED); return true; } Modified: clp/trunk/src/omcclpcmddelete.cpp =================================================================== --- clp/trunk/src/omcclpcmddelete.cpp 2006-12-08 22:45:14 UTC (rev 418) +++ clp/trunk/src/omcclpcmddelete.cpp 2006-12-08 23:08:19 UTC (rev 419) @@ -175,7 +175,7 @@ if (ret) { - getCmdStatusRef()->setStatus(COMMAND_COMPLETE); + getCmdStatusRef()->setStatus(COMMAND_COMPLETED); } else { Modified: clp/trunk/src/omcclpcmddump.cpp =================================================================== --- clp/trunk/src/omcclpcmddump.cpp 2006-12-08 22:45:14 UTC (rev 418) +++ clp/trunk/src/omcclpcmddump.cpp 2006-12-08 23:08:19 UTC (rev 419) @@ -50,7 +50,7 @@ /*XXX Not implemented yet */ - getCmdStatusRef()->setStatus(COMMAND_COMPLETE); + getCmdStatusRef()->setStatus(COMMAND_COMPLETED); return true; } Modified: clp/trunk/src/omcclpcmdexit.cpp =================================================================== --- clp/trunk/src/omcclpcmdexit.cpp 2006-12-08 22:45:14 UTC (rev 418) +++ clp/trunk/src/omcclpcmdexit.cpp 2006-12-08 23:08:19 UTC (rev 419) @@ -51,7 +51,7 @@ /* Set the exit flag in the main program object */ clpSession->doExit(); - getCmdStatusRef()->setStatus(COMMAND_COMPLETE); + getCmdStatusRef()->setStatus(COMMAND_COMPLETED); return true; } Modified: clp/trunk/src/omcclpcmdhelp.cpp =================================================================== --- clp/trunk/src/omcclpcmdhelp.cpp 2006-12-08 22:45:14 UTC (rev 418) +++ clp/trunk/src/omcclpcmdhelp.cpp 2006-12-08 23:08:19 UTC (rev 419) @@ -59,7 +59,7 @@ { /* Nothing to execute for the help command */ - getCmdStatusRef()->setStatus(COMMAND_COMPLETE); + getCmdStatusRef()->setStatus(COMMAND_COMPLETED); return true; } Modified: clp/trunk/src/omcclpcmdload.cpp =================================================================== --- clp/trunk/src/omcclpcmdload.cpp 2006-12-08 22:45:14 UTC (rev 418) +++ clp/trunk/src/omcclpcmdload.cpp 2006-12-08 23:08:19 UTC (rev 419) @@ -51,7 +51,7 @@ /*XXX Not yet implemented */ - getCmdStatusRef()->setStatus(COMMAND_COMPLETE); + getCmdStatusRef()->setStatus(COMMAND_COMPLETED); return true; } Modified: clp/trunk/src/omcclpcmdreset.cpp =================================================================== --- clp/trunk/src/omcclpcmdreset.cpp 2006-12-08 22:45:14 UTC (rev 418) +++ clp/trunk/src/omcclpcmdreset.cpp 2006-12-08 23:08:19 UTC (rev 419) @@ -136,7 +136,7 @@ return false; } - getCmdStatusRef()->setStatus(COMMAND_COMPLETE); + getCmdStatusRef()->setStatus(COMMAND_COMPLETED); return true; } Modified: clp/trunk/src/omcclpcmdset.cpp =================================================================== --- clp/trunk/src/omcclpcmdset.cpp 2006-12-08 22:45:14 UTC (rev 418) +++ clp/trunk/src/omcclpcmdset.cpp 2006-12-08 23:08:19 UTC (rev 419) @@ -188,7 +188,7 @@ } else { - getCmdStatusRef()->setStatus(COMMAND_COMPLETE); + getCmdStatusRef()->setStatus(COMMAND_COMPLETED); ret = true; } } @@ -279,7 +279,7 @@ } else { - getCmdStatusRef()->setStatus(COMMAND_COMPLETE); + getCmdStatusRef()->setStatus(COMMAND_COMPLETED); ret = true; } } Modified: clp/trunk/src/omcclpcmdshow.cpp =================================================================== --- clp/trunk/src/omcclpcmdshow.cpp 2006-12-08 22:45:14 UTC (rev 418) +++ clp/trunk/src/omcclpcmdshow.cpp 2006-12-08 23:08:19 UTC (rev 419) @@ -419,7 +419,7 @@ return false; } - getCmdStatusRef()->setStatus(COMMAND_COMPLETE); + getCmdStatusRef()->setStatus(COMMAND_COMPLETED); return true; } Modified: clp/trunk/src/omcclpcmdstart.cpp =================================================================== --- clp/trunk/src/omcclpcmdstart.cpp 2006-12-08 22:45:14 UTC (rev 418) +++ clp/trunk/src/omcclpcmdstart.cpp 2006-12-08 23:08:19 UTC (rev 419) @@ -136,7 +136,7 @@ return false; } - getCmdStatusRef()->setStatus(COMMAND_COMPLETE); + getCmdStatusRef()->setStatus(COMMAND_COMPLETED); return true; } Modified: clp/trunk/src/omcclpcmdstop.cpp =================================================================== --- clp/trunk/src/omcclpcmdstop.cpp 2006-12-08 22:45:14 UTC (rev 418) +++ clp/trunk/src/omcclpcmdstop.cpp 2006-12-08 23:08:19 UTC (rev 419) @@ -138,7 +138,7 @@ return false; } - getCmdStatusRef()->setStatus(COMMAND_COMPLETE); + getCmdStatusRef()->setStatus(COMMAND_COMPLETED); return true; } Modified: clp/trunk/src/omcclpcmdversion.cpp =================================================================== --- clp/trunk/src/omcclpcmdversion.cpp 2006-12-08 22:45:14 UTC (rev 418) +++ clp/trunk/src/omcclpcmdversion.cpp 2006-12-08 23:08:19 UTC (rev 419) @@ -49,7 +49,7 @@ { // XXX we may need to get the version from the // CLP service running in the CIMOM. - getCmdStatusRef()->setStatus(COMMAND_COMPLETE); + getCmdStatusRef()->setStatus(COMMAND_COMPLETED); return true; } Modified: clp/trunk/src/omcclpcommandstatus.cpp =================================================================== --- clp/trunk/src/omcclpcommandstatus.cpp 2006-12-08 22:45:14 UTC (rev 418) +++ clp/trunk/src/omcclpcommandstatus.cpp 2006-12-08 23:08:19 UTC (rev 419) @@ -35,7 +35,7 @@ } cmdmsg; static cmdmsg cmdstatus[] = { - {COMMAND_COMPLETE, "COMMAND COMPLETE"}, + {COMMAND_COMPLETED, "COMMAND COMPLETED"}, {COMMAND_SPAWNED, "COMMAND SPAWNED"}, {COMMAND_PROCESSING_FAILED, "COMMAND PROCESSING FAILED"}, {COMMAND_EXECUTION_FAILED, "COMMAND EXECUTION FAILED"}, Modified: clp/trunk/src/omcclpcommandstatus.h =================================================================== --- clp/trunk/src/omcclpcommandstatus.h 2006-12-08 22:45:14 UTC (rev 418) +++ clp/trunk/src/omcclpcommandstatus.h 2006-12-08 23:08:19 UTC (rev 419) @@ -39,7 +39,7 @@ namespace OMCCLP { // Command Status values -#define COMMAND_COMPLETE 0 +#define COMMAND_COMPLETED 0 #define COMMAND_SPAWNED 1 #define COMMAND_PROCESSING_FAILED 2 #define COMMAND_EXECUTION_FAILED 3 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <bni...@us...> - 2006-12-12 17:24:01
|
Revision: 421 http://svn.sourceforge.net/omc/?rev=421&view=rev Author: bnicholes Date: 2006-12-12 09:23:19 -0800 (Tue, 12 Dec 2006) Log Message: ----------- Fix the CLP prompt to conform to the spec. The prompt should be -><space> Modified Paths: -------------- clp/trunk/src/omcclpc.cpp clp/trunk/src/omcclpc.h clp/trunk/src/omcclpcommon.h clp/trunk/src/omcclpdsvrconnection.cpp Modified: clp/trunk/src/omcclpc.cpp =================================================================== --- clp/trunk/src/omcclpc.cpp 2006-12-11 23:33:10 UTC (rev 420) +++ clp/trunk/src/omcclpc.cpp 2006-12-12 17:23:19 UTC (rev 421) @@ -309,7 +309,7 @@ int count = 0; /* Wait for the prompt from the server */ - while (!prompt.endsWith("-->") && (count < 10)) + while (!prompt.endsWith(PROMPT) && (count < 10)) { if (m_socket.waitForInput(1)) { @@ -351,8 +351,8 @@ { String UFiP(0); - /* We need to get the session UFiP from the CLP server. - Send the command to get the session UFiP */ + /* We need to make sure that the 'session' reserved target + exists so that we can use it when needed */ String cmd = "show -o format=keyword session"; m_socket.write(cmd.c_str(), cmd.length()); m_socket.write("\r\n", 2); Modified: clp/trunk/src/omcclpc.h =================================================================== --- clp/trunk/src/omcclpc.h 2006-12-11 23:33:10 UTC (rev 420) +++ clp/trunk/src/omcclpc.h 2006-12-12 17:23:19 UTC (rev 421) @@ -77,7 +77,7 @@ void doExit(); void shutdown(); String getServerPrompt(); - bool isValidPrompt (String prompt) {prompt.endsWith("-->");} + bool isValidPrompt (String prompt) {prompt.endsWith(PROMPT);} bool socketConnect(); void createLogger(); Modified: clp/trunk/src/omcclpcommon.h =================================================================== --- clp/trunk/src/omcclpcommon.h 2006-12-11 23:33:10 UTC (rev 420) +++ clp/trunk/src/omcclpcommon.h 2006-12-12 17:23:19 UTC (rev 421) @@ -61,6 +61,8 @@ s = s.substring(0,s.length()-1); } #define CLPENDL "\r\n" +#define PROMPT "-> " +#define CLPPROMPT "CLP"PROMPT namespace OMCCLP { Modified: clp/trunk/src/omcclpdsvrconnection.cpp =================================================================== --- clp/trunk/src/omcclpdsvrconnection.cpp 2006-12-11 23:33:10 UTC (rev 420) +++ clp/trunk/src/omcclpdsvrconnection.cpp 2006-12-12 17:23:19 UTC (rev 421) @@ -187,7 +187,7 @@ firstLine = false; /* Send the prompt to the client */ - sostr << "\r\nCLP-->"; + sostr << "\r\n"CLPPROMPT; sostr.flush(); // only select if the buffer is empty This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <bni...@us...> - 2006-12-12 21:35:53
|
Revision: 423 http://svn.sourceforge.net/omc/?rev=423&view=rev Author: bnicholes Date: 2006-12-12 13:35:53 -0800 (Tue, 12 Dec 2006) Log Message: ----------- Realign the socket interaction of the server so that all of the data input is detected by the select call rather than the getline function. Modified Paths: -------------- clp/trunk/src/omcclpc.cpp clp/trunk/src/omcclpdsvrconnection.cpp Modified: clp/trunk/src/omcclpc.cpp =================================================================== --- clp/trunk/src/omcclpc.cpp 2006-12-12 21:33:29 UTC (rev 422) +++ clp/trunk/src/omcclpc.cpp 2006-12-12 21:35:53 UTC (rev 423) @@ -440,7 +440,7 @@ bool runOnce = false; String histFile = getenv ("HOME"); String prompt; - char lineBuf[1024]; + char lineBuf[4096]; /* Get the timout value from the configuration file. */ String item = getConfigItem(OMCClpdConfigOpts::SERVER_TIMEOUT_opt, @@ -587,7 +587,7 @@ /* Read the data from the socket and parse it on carriage returns. */ memset(lineBuf, 0, sizeof(lineBuf)); - int bytesRead = m_socket.read(lineBuf, sizeof(lineBuf)); + int bytesRead = m_socket.read(lineBuf, sizeof(lineBuf)-1); /* If we got data back then process it. Otherwise consider it to be an EOF and bail out. */ Modified: clp/trunk/src/omcclpdsvrconnection.cpp =================================================================== --- clp/trunk/src/omcclpdsvrconnection.cpp 2006-12-12 21:33:29 UTC (rev 422) +++ clp/trunk/src/omcclpdsvrconnection.cpp 2006-12-12 21:35:53 UTC (rev 423) @@ -61,37 +61,37 @@ ////////////////////////////////////////////////////////////////////////////// OMCClpdSvrConnection::OMCClpdSvrConnection(const Socket& socket, - OMCClpdServer* pServer, - IntrusiveReference<UnnamedPipe>& upipe) - : Runnable() - , m_pServer(pServer) - , m_socket(socket) - , m_upipe(upipe) - , m_shutdown(false) + OMCClpdServer* pServer, + IntrusiveReference<UnnamedPipe>& upipe) + : Runnable() + , m_pServer(pServer) + , m_socket(socket) + , m_upipe(upipe) + , m_shutdown(false) , m_clpSession() { - OW_LOG_DEBUG(pServer->getEnv()->getLogger(COMPONENT_NAME), - "OMCClpdSvrConnection object created"); + OW_LOG_DEBUG(pServer->getEnv()->getLogger(COMPONENT_NAME), + "OMCClpdSvrConnection object created"); - String item = pServer->getEnv()->getConfigItem( - OMCClpdConfigOpts::SERVER_TIMEOUT_opt, OMCCLPD_DEFAULT_SERVER_TIMEOUT); - m_socket.setTimeouts(item.toInt32()); + String item = pServer->getEnv()->getConfigItem( + OMCClpdConfigOpts::SERVER_TIMEOUT_opt, OMCCLPD_DEFAULT_SERVER_TIMEOUT); + m_socket.setTimeouts(item.toInt32()); } ////////////////////////////////////////////////////////////////////////////// // Destructor OMCClpdSvrConnection::~OMCClpdSvrConnection() { - try - { - m_socket.disconnect(); - } - catch (...) - { - // don't let exceptions escape - } + try + { + m_socket.disconnect(); + } + catch (...) + { + // don't let exceptions escape + } - OW_LOG_DEBUG(m_pServer->getEnv()->getLogger(COMPONENT_NAME), - "OMCClpdSvrConnection object destroyed"); + OW_LOG_DEBUG(m_pServer->getEnv()->getLogger(COMPONENT_NAME), + "OMCClpdSvrConnection object destroyed"); } ////////////////////////////////////////////////////////////////////////////// @@ -101,55 +101,52 @@ { String bfr; - if (is) - { - size_t count = 0; - std::streambuf *sb = is.rdbuf(); - - while (1) - { - int ch = sb->sbumpc(); - if (ch == EOF) - { - is.setstate(count == 0 - ? (std::ios::failbit | std::ios::eofbit) : std::ios::eofbit); - break; - } - - ++count; - - if ((ch == '\n') || (ch == '\r')) - { - break; - } + if (is) + { + std::streambuf *sb = is.rdbuf(); + sb->sgetc(); + std::streamsize count = sb->in_avail(); + bool stopReading = false; - bfr += String((char)ch); - } - } + /* Since the CLP will only allow a single command before + responding, read a line up to the \n or \r and then + empty the buffer to make sure that the server + stays insync with the client. */ + while (count-- > 0) + { + int ch = sb->sbumpc(); + + if ((ch == '\n') || (ch == '\r')) + stopReading = true; - return bfr; + if (!stopReading) + bfr += String((char)ch); + } + } + + return bfr; } ////////////////////////////////////////////////////////////////////////////// void OMCClpdSvrConnection::run() { - LoggerRef logger = m_pServer->getEnv()->getLogger(COMPONENT_NAME); + LoggerRef logger = m_pServer->getEnv()->getLogger(COMPONENT_NAME); - OW_LOG_DEBUG(logger, "OMCClpdSvrConnection::run entered"); + OW_LOG_DEBUG(logger, "OMCClpdSvrConnection::run entered"); - SelectTypeArray selArray; - selArray.push_back(m_upipe->getSelectObj()); - selArray.push_back(m_socket.getSelectObj()); + SelectTypeArray selArray; + selArray.push_back(m_upipe->getSelectObj()); + selArray.push_back(m_socket.getSelectObj()); - // Get input & output streams from socket - std::istream& sistr(m_socket.getInputStream()); - std::ostream& sostr(m_socket.getOutputStream()); + // Get input & output streams from socket + std::istream& sistr(m_socket.getInputStream()); + std::ostream& sostr(m_socket.getOutputStream()); - // Get timeout value - String item = m_pServer->getEnv()->getConfigItem( - OMCClpdConfigOpts::SERVER_TIMEOUT_opt, OMCCLPD_DEFAULT_SERVER_TIMEOUT); - Int32 timeout = item.toInt32(); + // Get timeout value + String item = m_pServer->getEnv()->getConfigItem( + OMCClpdConfigOpts::SERVER_TIMEOUT_opt, OMCCLPD_DEFAULT_SERVER_TIMEOUT); + Int32 timeout = item.toInt32(); OMCCLPProgramRef clpref(new OMCCLPDaemon(sostr)); clpref->setLogger(logger); @@ -158,105 +155,89 @@ { setCLPSession(clpref); - try - { - bool firstLine = true; + try + { + String line; - while (sistr.good()) - { - if (!firstLine) - { - String line = getLine(sistr); - OW_LOG_DEBUG(logger, - Format("OMCClpdSvrConnection received line: %1", line)); + while (sistr.good()) + { + line.erase(); - if (!line.empty()) { - clpref->runCommand(line); - sostr.flush(); - } - - if (clpref->shouldExit()) - { - line = "Good-bye :-)"; - sostr << line << "\r\n"; - sostr.flush(); - break; - } - } - else - firstLine = false; - /* Send the prompt to the client */ sostr << "\r\n"CLPPROMPT; sostr.flush(); - - // only select if the buffer is empty - if (sistr.rdbuf()->in_avail() == 0) - { - int selType = Select::SELECT_INTERRUPTED; - while(selType == Select::SELECT_INTERRUPTED) - { - selType = Select::select(selArray, timeout * 1000); // *1000 to convert seconds to milliseconds - } - - if (selType == Select::SELECT_ERROR) - { - OW_THROW(SocketException, "Error occurred during select()"); - } - if (selType == Select::SELECT_TIMEOUT) - { - OW_LOG_INFO(logger, "Client connection timed out"); - return; - } - if (selType == 0) // Unnamped pipe/event selected - { - OW_LOG_DEBUG(logger, "Server is shutting down. Closing connection"); - return; - } - } - else - { - // check for server shutting down message. - int selType = Select::select(selArray, 0); // 0 so we don't block - if (selType == 0) // Unnamped pipe/event selected - { - OW_LOG_DEBUG(logger, - "Server is shutting down. Closing connection"); - return; - } - } - } // while (sistr.good()) + int selType = Select::SELECT_INTERRUPTED; + while(selType == Select::SELECT_INTERRUPTED) + { + selType = Select::select(selArray, timeout * 1000); // *1000 to convert seconds to milliseconds + } + + if (selType == Select::SELECT_ERROR) + { + OW_THROW(SocketException, "Error occurred during select()"); + } + if (selType == Select::SELECT_TIMEOUT) + { + OW_LOG_INFO(logger, "Client connection timed out"); + break; + } + if (selType == 0) // Unnamped pipe/event selected + { + OW_LOG_DEBUG(logger, "Server is shutting down. Closing connection"); + break; + } + else if (selType == 1) + { + line = getLine(sistr); + } + + if (line.length()) { + OW_LOG_DEBUG(logger, + Format("OMCClpdSvrConnection received line: %1", line)); + clpref->runCommand(line); + sostr.flush(); + } + + if (clpref->shouldExit()) + { + line = "Good-bye :-)"; + sostr << line << "\r\n"; + sostr.flush(); + break; + } + } // while (sistr.good()) + clpref->destroyCLPSessionInfo(); - } // try - catch (Exception& e) - { - OW_LOG_ERROR(logger, Format("%1", e)); - } - catch (std::ios_base::failure& e) - { - // This happens if the socket is closed, so we don't - //have to do anything. - OW_LOG_DEBUG(logger, "Caught std::ios_base::failure, " - "client has closed the connection"); - } - catch (std::exception& e) - { - OW_LOG_ERROR(logger, Format("Caught std::exception (%1) " - "in OMCClpdSvrConnection::run()", e.what())); - } - catch (ThreadCancelledException&) - { - OW_LOG_ERROR(logger, "Got Thread Cancelled Exception in " - "OMCClpdSvrConnection::run()"); - throw; - } - catch (...) - { - OW_LOG_ERROR(logger, "Got Unknown Exception in " - "OMCClpdSvrConnection::run()"); - } + } // try + catch (Exception& e) + { + OW_LOG_ERROR(logger, Format("%1", e)); + } + catch (std::ios_base::failure& e) + { + // This happens if the socket is closed, so we don't + //have to do anything. + OW_LOG_DEBUG(logger, "Caught std::ios_base::failure, " + "client has closed the connection"); + } + catch (std::exception& e) + { + OW_LOG_ERROR(logger, Format("Caught std::exception (%1) " + "in OMCClpdSvrConnection::run()", e.what())); + } + catch (ThreadCancelledException&) + { + OW_LOG_ERROR(logger, "Got Thread Cancelled Exception in " + "OMCClpdSvrConnection::run()"); + throw; + } + catch (...) + { + OW_LOG_ERROR(logger, "Got Unknown Exception in " + "OMCClpdSvrConnection::run()"); + } } else { @@ -264,23 +245,23 @@ "OMCClpdSvrConnection::run()"); } - OW_LOG_DEBUG(logger, "OMCClpdSvrConnection::run exiting"); + OW_LOG_DEBUG(logger, "OMCClpdSvrConnection::run exiting"); } ////////////////////////////////////////////////////////////////////////////// String OMCClpdSvrConnection::getHostName() { - //return m_socket.getLocalAddress().getName(); - return SocketAddress::getAnyLocalHost().getName(); + //return m_socket.getLocalAddress().getName(); + return SocketAddress::getAnyLocalHost().getName(); } ////////////////////////////////////////////////////////////////////////////// void OMCClpdSvrConnection::doCooperativeCancel() { - m_shutdown = true; - m_socket.disconnect(); + m_shutdown = true; + m_socket.disconnect(); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <bni...@us...> - 2007-05-21 22:53:51
|
Revision: 465 http://svn.sourceforge.net/omc/?rev=465&view=rev Author: bnicholes Date: 2007-05-21 15:53:49 -0700 (Mon, 21 May 2007) Log Message: ----------- Fix the addressing file code so that the addressing file is not opened repeatedly. Submitted by: [Jeff McMenomey <jeff mcmenomey hp com>] Modified Paths: -------------- clp/trunk/src/omcclpprogram.cpp clp/trunk/src/omcclpprogram.h Modified: clp/trunk/src/omcclpprogram.cpp =================================================================== --- clp/trunk/src/omcclpprogram.cpp 2007-05-21 21:53:25 UTC (rev 464) +++ clp/trunk/src/omcclpprogram.cpp 2007-05-21 22:53:49 UTC (rev 465) @@ -76,6 +76,7 @@ , m_session(CIMNULL) , m_sessionUFiP() , m_clpout(clpout) + , m_addrref(NULL) { } @@ -132,37 +133,46 @@ */ OMCCLPConfigurationRef OMCCLPProgram::getAddrFileReference() { - if (m_addr_filename.empty()) + //Let's not open the addressing configuration file a bunch of times. Do it + //once and re-use it. Re-opening this file many times can cause BIG performance problems. + //It doesn't appear that this should cause problems because each + //connection thread gets it's own OMCCLPDaemon object when it is created. + if (!m_addrref) { - m_addr_filename = getConfigItem(OMCClpdConfigOpts::CIM_ADDRESS_MAP_FILE_opt, - OMCCLPD_DEFAULT_CIM_ADDRESS_MAP_FILE); - } - OMCCLPConfigurationRef addrref(new OMCCLPConfiguration(m_addr_filename)); + if (m_addr_filename.empty()) + { + m_addr_filename = getConfigItem(OMCClpdConfigOpts::CIM_ADDRESS_MAP_FILE_opt, + OMCCLPD_DEFAULT_CIM_ADDRESS_MAP_FILE); + } - if (!addrref->isOpen()) - { - String msg = String("The addressing file at ") + m_addr_filename + - " appears to be empty or missing"; - logInfoMessage(msg); - } + OMCCLPConfigurationRef addrref(new OMCCLPConfiguration(m_addr_filename)); - /* Get a list of all of the UFcTs that have a filter. */ - String ufcts = addrref->GetIniSectionsByKey("ufct"); - StringArray ufctSections = ufcts.tokenize(";"); + if (!addrref->isOpen()) + { + String msg = String("The addressing file at ") + m_addr_filename + + " appears to be empty or missing"; + logInfoMessage(msg); + } - for (int j=0; j<ufctSections.size(); j++) - { - String UFcT = addrref->GetIniSetting(ufctSections[j], String("ufct")); + /* Get a list of all of the UFcTs that have a filter. */ + String ufcts = addrref->GetIniSectionsByKey("ufct"); + StringArray ufctSections = ufcts.tokenize(";"); - addrref->PutIniSetting(String("UFcTs"), UFcT, ufctSections[j]); - } + for (int j=0; j<ufctSections.size(); j++) + { + String UFcT = addrref->GetIniSetting(ufctSections[j], String("ufct")); + addrref->PutIniSetting(String("UFcTs"), UFcT, ufctSections[j]); + } + #ifdef DEBUG1 - StlIni::INIFile ini = addrref->getDataIni(); - SaveIni(ini, "debugdata.ini"); + StlIni::INIFile ini = addrref->getDataIni(); + SaveIni(ini, "debugdata.ini"); #endif + m_addrref = addrref; + } - return addrref; + return m_addrref; } /** Modified: clp/trunk/src/omcclpprogram.h =================================================================== --- clp/trunk/src/omcclpprogram.h 2007-05-21 21:53:25 UTC (rev 464) +++ clp/trunk/src/omcclpprogram.h 2007-05-21 22:53:49 UTC (rev 465) @@ -203,6 +203,8 @@ CIMObjectPath m_session; // Reference to the session data String m_sessionUFiP; // User friendly path that corresponds to the session object std::ostream& m_clpout; // output stream + OMCCLPConfigurationRef m_addrref; + #ifndef OMCCLPCLIENT LoggerRef m_logger; #endif This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |