summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cpp/src/Ice/PropertiesI.cpp24
-rw-r--r--cpp/src/IceBox/ServiceManagerI.cpp64
2 files changed, 55 insertions, 33 deletions
diff --git a/cpp/src/Ice/PropertiesI.cpp b/cpp/src/Ice/PropertiesI.cpp
index 7030dd34114..e160fe6cf8f 100644
--- a/cpp/src/Ice/PropertiesI.cpp
+++ b/cpp/src/Ice/PropertiesI.cpp
@@ -178,6 +178,7 @@ Ice::PropertiesI::parseCommandLineOptions(const string& prefix, const StringSeq&
for(i = 0; i < options.size(); i++)
{
string opt = options[i];
+
if(opt.find(pfx) == 0)
{
if(opt.find('=') == string::npos)
@@ -253,17 +254,22 @@ Ice::PropertiesI::PropertiesI(StringSeq& args, const PropertiesPtr& defaults, co
}
StringSeq::iterator q = args.begin();
- if(q != args.end())
+
+ if(_properties.find("Ice.ProgramName") == _properties.end())
{
- //
- // Use the first argument as the value for Ice.ProgramName. Replace
- // any backslashes in this value with forward slashes, in case this
- // value is used by the event logger.
- //
- string name = *q;
- replace(name.begin(), name.end(), '\\', '/');
- setProperty("Ice.ProgramName", name);
+ if(q != args.end())
+ {
+ //
+ // Use the first argument as the value for Ice.ProgramName. Replace
+ // any backslashes in this value with forward slashes, in case this
+ // value is used by the event logger.
+ //
+ string name = *q;
+ replace(name.begin(), name.end(), '\\', '/');
+ setProperty("Ice.ProgramName", name);
+ }
}
+
StringSeq tmp;
bool loadConfigFiles = false;
diff --git a/cpp/src/IceBox/ServiceManagerI.cpp b/cpp/src/IceBox/ServiceManagerI.cpp
index fa45e173c05..d9a0e8e983e 100644
--- a/cpp/src/IceBox/ServiceManagerI.cpp
+++ b/cpp/src/IceBox/ServiceManagerI.cpp
@@ -283,41 +283,57 @@ IceBox::ServiceManagerI::start(const string& service, const string& entryPoint,
// property set.
//
PropertiesPtr properties = _communicator->getProperties();
+
if(properties->getPropertyAsInt("IceBox.UseSharedCommunicator." + service) > 0)
{
- PropertiesPtr fileProperties = createProperties(serviceArgs);
- properties->parseCommandLineOptions("", fileProperties->getCommandLineOptions());
-
- serviceArgs = properties->parseIceCommandLineOptions(serviceArgs);
- serviceArgs = properties->parseCommandLineOptions(service, serviceArgs);
- }
- else
- {
- PropertiesPtr serviceProperties = properties->clone();
+ PropertiesPtr serviceProperties = createProperties(serviceArgs, properties);
//
- // Append the service name to the program name if not empty.
+ // Erase properties in 'properties'
//
- string name = serviceProperties->getProperty("Ice.ProgramName");
- if(name != service)
+ PropertyDict allProps = properties->getPropertiesForPrefix("");
+ for(PropertyDict::iterator p = allProps.begin(); p != allProps.end(); ++p)
{
- name = name.empty() ? service : name + "-" + service;
+ if(serviceProperties->getProperty(p->first) == "")
+ {
+ properties->setProperty(p->first, "");
+ }
}
-
+
//
- // Load property file eventually specified with
- // --Ice.Config and add the properties from the file to
- // the service properties.
+ // Put all serviceProperties into 'properties'
//
- PropertiesPtr fileProperties = createProperties(serviceArgs);
- serviceProperties->parseCommandLineOptions("", fileProperties->getCommandLineOptions());
-
- serviceProperties->setProperty("Ice.ProgramName", name);
-
+ properties->parseCommandLineOptions("", serviceProperties->getCommandLineOptions());
+
+ //
+ // Parse <service>.* command line options
+ // (the Ice command line options were parse by the createProperties above)
+ //
+ serviceArgs = properties->parseCommandLineOptions(service, serviceArgs);
+ }
+ else
+ {
+ string name = properties->getProperty("Ice.ProgramName");
+ PropertiesPtr serviceProperties = createProperties(serviceArgs, properties);
+
+ if(name == properties->getProperty("Ice.ProgramName"))
+ {
+ //
+ // If the service did not set its own program-name, and
+ // the icebox program-name != service, append the service name to the
+ // program name.
+ //
+ if(name != service)
+ {
+ name = name.empty() ? service : name + "-" + service;
+ }
+ serviceProperties->setProperty("Ice.ProgramName", name);
+ }
+
//
- // Parse Ice and <service>.* command line options.
+ // Parse <service>.* command line options
+ // (the Ice command line options were parsed by the createProperties above)
//
- serviceArgs = serviceProperties->parseIceCommandLineOptions(serviceArgs);
serviceArgs = serviceProperties->parseCommandLineOptions(service, serviceArgs);
//