summaryrefslogtreecommitdiff
path: root/cpp/src
diff options
context:
space:
mode:
authorMichi Henning <michi@zeroc.com>2003-08-08 06:59:35 +0000
committerMichi Henning <michi@zeroc.com>2003-08-08 06:59:35 +0000
commit7225dff8fbdc167a06faeb0e9fd2c46d826748d8 (patch)
treedd7b5217baeacb13c88cac084ef96a3cb8c10c8d /cpp/src
parentinfo on tests (diff)
downloadice-7225dff8fbdc167a06faeb0e9fd2c46d826748d8.tar.bz2
ice-7225dff8fbdc167a06faeb0e9fd2c46d826748d8.tar.xz
ice-7225dff8fbdc167a06faeb0e9fd2c46d826748d8.zip
Added Properties::parseIceCommandLineOptions().
Diffstat (limited to 'cpp/src')
-rw-r--r--cpp/src/Glacier/GlacierRouter.cpp15
-rw-r--r--cpp/src/Glacier/GlacierStarter.cpp15
-rw-r--r--cpp/src/Ice/Instance.cpp4
-rw-r--r--cpp/src/Ice/PropertiesI.cpp15
-rw-r--r--cpp/src/Ice/PropertiesI.h1
-rw-r--r--cpp/src/IceBox/Admin.cpp11
-rw-r--r--cpp/src/IceBox/Server.cpp5
-rw-r--r--cpp/src/IceBox/ServiceManagerI.cpp4
-rw-r--r--cpp/src/IcePack/Client.cpp6
-rw-r--r--cpp/src/IcePack/IcePackNode.cpp8
-rw-r--r--cpp/src/IcePack/IcePackRegistry.cpp7
-rw-r--r--cpp/src/IcePatch/Client.cpp15
-rw-r--r--cpp/src/IcePatch/Server.cpp14
-rw-r--r--cpp/src/IceStorm/Admin.cpp7
14 files changed, 26 insertions, 101 deletions
diff --git a/cpp/src/Glacier/GlacierRouter.cpp b/cpp/src/Glacier/GlacierRouter.cpp
index 60c5c3a935f..2691d79026e 100644
--- a/cpp/src/Glacier/GlacierRouter.cpp
+++ b/cpp/src/Glacier/GlacierRouter.cpp
@@ -295,20 +295,7 @@ main(int argc, char* argv[])
//
// Make sure that this process doesn't use a router.
//
- PropertiesPtr defaultProperties;
- try
- {
- defaultProperties = getDefaultProperties(argc, argv);
- StringSeq args = argsToStringSeq(argc, argv);
- args = defaultProperties->parseCommandLineOptions("Ice", args);
- args = defaultProperties->parseCommandLineOptions("Glacier.Router", args);
- stringSeqToArgs(args, argc, argv);
- }
- catch(const Exception& ex)
- {
- cerr << argv[0] << ": " << ex << endl;
- return EXIT_FAILURE;
- }
+ PropertiesPtr defaultProperties = getDefaultProperties(argc, argv);
defaultProperties->setProperty("Ice.Default.Router", "");
Glacier::RouterApp app;
diff --git a/cpp/src/Glacier/GlacierStarter.cpp b/cpp/src/Glacier/GlacierStarter.cpp
index 7ef036857cc..3b946904c45 100644
--- a/cpp/src/Glacier/GlacierStarter.cpp
+++ b/cpp/src/Glacier/GlacierStarter.cpp
@@ -190,20 +190,7 @@ main(int argc, char* argv[])
//
// Make sure that this process doesn't use a router.
//
- PropertiesPtr defaultProperties;
- try
- {
- defaultProperties = getDefaultProperties(argc, argv);
- StringSeq args = argsToStringSeq(argc, argv);
- args = defaultProperties->parseCommandLineOptions("Ice", args);
- args = defaultProperties->parseCommandLineOptions("Glacier", args);
- stringSeqToArgs(args, argc, argv);
- }
- catch(const Exception& ex)
- {
- cerr << argv[0] << ": " << ex << endl;
- return EXIT_FAILURE;
- }
+ PropertiesPtr defaultProperties = getDefaultProperties(argc, argv);
defaultProperties->setProperty("Ice.Default.Router", "");
Glacier::RouterApp app;
diff --git a/cpp/src/Ice/Instance.cpp b/cpp/src/Ice/Instance.cpp
index baabda38492..f86f0d8eb99 100644
--- a/cpp/src/Ice/Instance.cpp
+++ b/cpp/src/Ice/Instance.cpp
@@ -369,10 +369,10 @@ IceInternal::Instance::Instance(const CommunicatorPtr& communicator, int& argc,
++_globalStateCounter;
//
- // Convert command-line options beginning with --Ice. to properties.
+ // Convert command-line options to properties.
//
StringSeq args = argsToStringSeq(argc, argv);
- args = _properties->parseCommandLineOptions("Ice", args);
+ args = _properties->parseIceCommandLineOptions(args);
stringSeqToArgs(args, argc, argv);
try
diff --git a/cpp/src/Ice/PropertiesI.cpp b/cpp/src/Ice/PropertiesI.cpp
index f006eea79fe..39c1eae3bc5 100644
--- a/cpp/src/Ice/PropertiesI.cpp
+++ b/cpp/src/Ice/PropertiesI.cpp
@@ -402,6 +402,21 @@ Ice::PropertiesI::parseCommandLineOptions(const string& prefix, const StringSeq&
return result;
}
+StringSeq
+Ice::PropertiesI::parseIceCommandLineOptions(const StringSeq& options)
+{
+ StringSeq args;
+ args = parseCommandLineOptions("Ice", options);
+ args = parseCommandLineOptions("Freeze", args);
+ args = parseCommandLineOptions("Glacier", args);
+ args = parseCommandLineOptions("IceBox", args);
+ args = parseCommandLineOptions("IcePack", args);
+ args = parseCommandLineOptions("IcePatch", args);
+ args = parseCommandLineOptions("IceSSL", args);
+ args = parseCommandLineOptions("IceStorm", args);
+ return args;
+}
+
void
Ice::PropertiesI::load(const std::string& file)
{
diff --git a/cpp/src/Ice/PropertiesI.h b/cpp/src/Ice/PropertiesI.h
index 3b7f0897f8e..1547c394fbb 100644
--- a/cpp/src/Ice/PropertiesI.h
+++ b/cpp/src/Ice/PropertiesI.h
@@ -33,6 +33,7 @@ public:
virtual void setProperty(const std::string&, const std::string&);
virtual StringSeq getCommandLineOptions();
virtual StringSeq parseCommandLineOptions(const std::string&, const StringSeq&);
+ virtual StringSeq parseIceCommandLineOptions(const StringSeq&);
virtual void load(const std::string&);
virtual PropertiesPtr clone();
diff --git a/cpp/src/IceBox/Admin.cpp b/cpp/src/IceBox/Admin.cpp
index 2704959139d..bc35e03fdd8 100644
--- a/cpp/src/IceBox/Admin.cpp
+++ b/cpp/src/IceBox/Admin.cpp
@@ -52,12 +52,6 @@ Client::usage()
int
Client::run(int argc, char* argv[])
{
- PropertiesPtr properties = communicator()->getProperties();
-
- StringSeq args = argsToStringSeq(argc, argv);
- args = properties->parseCommandLineOptions("IceBox", args);
- stringSeqToArgs(args, argc, argv);
-
vector<string> commands;
int idx = 1;
@@ -92,10 +86,11 @@ Client::run(int argc, char* argv[])
return EXIT_SUCCESS;
}
- string managerProxy;
-
+ PropertiesPtr properties = communicator()->getProperties();
string managerIdentity = properties->getPropertyWithDefault("IceBox.ServiceManager.Identity", "ServiceManager");
+ string managerProxy;
+
if(properties->getProperty("Ice.Default.Locator").empty())
{
string managerEndpoints = properties->getProperty("IceBox.ServiceManager.Endpoints");
diff --git a/cpp/src/IceBox/Server.cpp b/cpp/src/IceBox/Server.cpp
index 11345abd794..119859a1dfc 100644
--- a/cpp/src/IceBox/Server.cpp
+++ b/cpp/src/IceBox/Server.cpp
@@ -53,11 +53,6 @@ Server::usage()
int
Server::run(int argc, char* argv[])
{
- PropertiesPtr properties = communicator()->getProperties();
- StringSeq args = argsToStringSeq(argc, argv);
- args = properties->parseCommandLineOptions("IceBox", args);
- stringSeqToArgs(args, argc, argv);
-
for(int i = 1; i < argc; ++i)
{
if(strcmp(argv[i], "-h") == 0 || strcmp(argv[i], "--help") == 0)
diff --git a/cpp/src/IceBox/ServiceManagerI.cpp b/cpp/src/IceBox/ServiceManagerI.cpp
index dcb8162fc1a..f52eb286069 100644
--- a/cpp/src/IceBox/ServiceManagerI.cpp
+++ b/cpp/src/IceBox/ServiceManagerI.cpp
@@ -261,7 +261,7 @@ IceBox::ServiceManagerI::start(const string& service, const string& entryPoint,
PropertiesPtr fileProperties = createProperties(serviceArgs);
properties->parseCommandLineOptions("", fileProperties->getCommandLineOptions());
- serviceArgs = properties->parseCommandLineOptions("Ice", serviceArgs);
+ serviceArgs = properties->parseIceCommandLineOptions(serviceArgs);
serviceArgs = properties->parseCommandLineOptions(service, serviceArgs);
}
else
@@ -284,7 +284,7 @@ IceBox::ServiceManagerI::start(const string& service, const string& entryPoint,
PropertiesPtr fileProperties = createProperties(serviceArgs);
serviceProperties->parseCommandLineOptions("", fileProperties->getCommandLineOptions());
- serviceArgs = serviceProperties->parseCommandLineOptions("Ice", serviceArgs);
+ serviceArgs = serviceProperties->parseIceCommandLineOptions(serviceArgs);
serviceArgs = serviceProperties->parseCommandLineOptions(service, serviceArgs);
info.communicator = initializeWithProperties(argc, argv, serviceProperties);
diff --git a/cpp/src/IcePack/Client.cpp b/cpp/src/IcePack/Client.cpp
index d36a5b90768..17199f49fda 100644
--- a/cpp/src/IcePack/Client.cpp
+++ b/cpp/src/IcePack/Client.cpp
@@ -59,12 +59,6 @@ Client::run(int argc, char* argv[])
string commands;
bool debug = false;
- PropertiesPtr properties = communicator()->getProperties();
-
- StringSeq args = argsToStringSeq(argc, argv);
- args = properties->parseCommandLineOptions("IcePack", args);
- stringSeqToArgs(args, argc, argv);
-
int idx = 1;
while(idx < argc)
{
diff --git a/cpp/src/IcePack/IcePackNode.cpp b/cpp/src/IcePack/IcePackNode.cpp
index 248c7169baf..0a30d53e275 100644
--- a/cpp/src/IcePack/IcePackNode.cpp
+++ b/cpp/src/IcePack/IcePackNode.cpp
@@ -371,14 +371,6 @@ main(int argc, char* argv[])
//
properties->setProperty("Ice.ServerIdleTime", "0");
- //
- // Remove IcePack and Freeze command line options from argv.
- //
- Ice::StringSeq args = Ice::argsToStringSeq(argc, argv);
- args = properties->parseCommandLineOptions("Freeze", args);
- args = properties->parseCommandLineOptions("IcePack", args);
- Ice::stringSeqToArgs(args, argc, argv);
-
bool nowarn = false;
for(int i = 1; i < argc; ++i)
{
diff --git a/cpp/src/IcePack/IcePackRegistry.cpp b/cpp/src/IcePack/IcePackRegistry.cpp
index ddd1618a0e5..857ee77b859 100644
--- a/cpp/src/IcePack/IcePackRegistry.cpp
+++ b/cpp/src/IcePack/IcePackRegistry.cpp
@@ -68,13 +68,6 @@ RegistryServer::usage()
int
RegistryServer::run(int argc, char* argv[])
{
- Ice::PropertiesPtr properties = communicator()->getProperties();
-
- Ice::StringSeq args = Ice::argsToStringSeq(argc, argv);
- args = properties->parseCommandLineOptions("IcePack", args);
- args = properties->parseCommandLineOptions("Freeze", args);
- Ice::stringSeqToArgs(args, argc, argv);
-
bool nowarn = false;
for(int i = 1; i < argc; ++i)
{
diff --git a/cpp/src/IcePatch/Client.cpp b/cpp/src/IcePatch/Client.cpp
index 2c80fbdba5b..ed819db4a79 100644
--- a/cpp/src/IcePatch/Client.cpp
+++ b/cpp/src/IcePatch/Client.cpp
@@ -583,21 +583,6 @@ IcePatch::Client::patch(const DirectoryDescPtr& dirDesc, const string& indent) c
int
main(int argc, char* argv[])
{
- PropertiesPtr defaultProperties;
- try
- {
- defaultProperties = getDefaultProperties(argc, argv);
- StringSeq args = argsToStringSeq(argc, argv);
- args = defaultProperties->parseCommandLineOptions("IcePatch", args);
- args = defaultProperties->parseCommandLineOptions("Glacier", args);
- stringSeqToArgs(args, argc, argv);
- }
- catch(const Exception& ex)
- {
- cerr << argv[0] << ": " << ex << endl;
- return EXIT_FAILURE;
- }
-
Client app;
return app.main(argc, argv);
}
diff --git a/cpp/src/IcePatch/Server.cpp b/cpp/src/IcePatch/Server.cpp
index e5b04a9f57b..02ac5e8ccc9 100644
--- a/cpp/src/IcePatch/Server.cpp
+++ b/cpp/src/IcePatch/Server.cpp
@@ -271,20 +271,6 @@ IcePatch::Updater::cleanup(const FileDescSeq& fileDescSeq)
int
main(int argc, char* argv[])
{
- PropertiesPtr defaultProperties;
- try
- {
- defaultProperties = getDefaultProperties(argc, argv);
- StringSeq args = argsToStringSeq(argc, argv);
- args = defaultProperties->parseCommandLineOptions("IcePatch", args);
- stringSeqToArgs(args, argc, argv);
- }
- catch(const Exception& ex)
- {
- cerr << argv[0] << ": " << ex << endl;
- return EXIT_FAILURE;
- }
-
Server app;
return app.main(argc, argv);
}
diff --git a/cpp/src/IceStorm/Admin.cpp b/cpp/src/IceStorm/Admin.cpp
index c1c46fca574..a01ee621e09 100644
--- a/cpp/src/IceStorm/Admin.cpp
+++ b/cpp/src/IceStorm/Admin.cpp
@@ -73,12 +73,6 @@ Client::usage()
int
Client::run(int argc, char* argv[])
{
- PropertiesPtr properties = communicator()->getProperties();
-
- StringSeq args = argsToStringSeq(argc, argv);
- args = properties->parseCommandLineOptions("IceStorm", args);
- stringSeqToArgs(args, argc, argv);
-
string cpp("cpp");
string commands;
bool debug = false;
@@ -164,6 +158,7 @@ Client::run(int argc, char* argv[])
return EXIT_FAILURE;
}
+ PropertiesPtr properties = communicator()->getProperties();
const char* managerProxyProperty = "IceStorm.TopicManager.Proxy";
string managerProxy = properties->getProperty(managerProxyProperty);
if(managerProxy.empty())