diff options
author | Benoit Foucher <benoit@zeroc.com> | 2007-01-26 13:49:39 +0000 |
---|---|---|
committer | Benoit Foucher <benoit@zeroc.com> | 2007-01-26 13:49:39 +0000 |
commit | d4398a7a4ca5ececefb420edbe84baad08999380 (patch) | |
tree | 89251e64145e1f3ceedb16d19a0f0d8ba3c2470e /cpp/src/IceGrid/NodeI.cpp | |
parent | Fixes (diff) | |
download | ice-d4398a7a4ca5ececefb420edbe84baad08999380.tar.bz2 ice-d4398a7a4ca5ececefb420edbe84baad08999380.tar.xz ice-d4398a7a4ca5ececefb420edbe84baad08999380.zip |
Added properties override in service config files
Diffstat (limited to 'cpp/src/IceGrid/NodeI.cpp')
-rw-r--r-- | cpp/src/IceGrid/NodeI.cpp | 70 |
1 files changed, 70 insertions, 0 deletions
diff --git a/cpp/src/IceGrid/NodeI.cpp b/cpp/src/IceGrid/NodeI.cpp index 97a6a2cba01..a1131fcae4c 100644 --- a/cpp/src/IceGrid/NodeI.cpp +++ b/cpp/src/IceGrid/NodeI.cpp @@ -221,6 +221,70 @@ NodeI::NodeI(const Ice::ObjectAdapterPtr& adapter, const_cast<Ice::Int&>(_waitTime) = properties->getPropertyAsIntWithDefault("IceGrid.Node.WaitTime", 60); const_cast<string&>(_outputDir) = properties->getProperty("IceGrid.Node.Output"); const_cast<bool&>(_redirectErrToOut) = properties->getPropertyAsInt("IceGrid.Node.RedirectErrToOut") > 0; + + // + // Parse the properties override property. + // + string props = properties->getProperty("IceGrid.Node.PropertiesOverride"); + Ice::StringSeq propsAsArgs; + if(!props.empty()) + { + string::size_type end = 0; + while(end != string::npos) + { + const string delim = " \t\r\n"; + + string::size_type beg = props.find_first_not_of(delim, end); + if(beg == string::npos) + { + break; + } + + end = props.find_first_of(delim, beg); + string arg; + if(end == string::npos) + { + arg = props.substr(beg); + } + else + { + arg = props.substr(beg, end - beg); + } + + if(arg.find("--") == 0) + { + arg = arg.substr(2); + } + + // + // Extract the key/value + // + string::size_type argEnd = arg.find_first_of(delim + "="); + if(argEnd == string::npos) + { + continue; + } + + string key = arg.substr(0, argEnd); + + argEnd = arg.find('=', argEnd); + if(argEnd == string::npos) + { + return; + } + ++argEnd; + + string value; + string::size_type argBeg = arg.find_first_not_of(delim, argEnd); + if(argBeg != string::npos) + { + argEnd = arg.length(); + value = arg.substr(argBeg, argEnd - argBeg); + } + + _propertiesOverride.push_back(createProperty(key, value)); + } + } } NodeI::~NodeI() @@ -625,6 +689,12 @@ NodeI::getProxy() const return _proxy; } +const PropertyDescriptorSeq& +NodeI::getPropertiesOverride() const +{ + return _propertiesOverride; +} + string NodeI::getOutputDir() const { |