summaryrefslogtreecommitdiff
path: root/cpp
diff options
context:
space:
mode:
Diffstat (limited to 'cpp')
-rw-r--r--cpp/CHANGES4
-rw-r--r--cpp/include/Ice/Buffer.h1
-rw-r--r--cpp/slice/Ice/Properties.ice19
-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
-rw-r--r--cpp/test/IceStorm/federation/Publisher.cpp5
-rw-r--r--cpp/test/IceStorm/federation/Subscriber.cpp7
-rw-r--r--cpp/test/IceStorm/single/Publisher.cpp5
-rw-r--r--cpp/test/IceStorm/single/Subscriber.cpp7
21 files changed, 50 insertions, 125 deletions
diff --git a/cpp/CHANGES b/cpp/CHANGES
index 0a036880eed..7bae539bed2 100644
--- a/cpp/CHANGES
+++ b/cpp/CHANGES
@@ -1,6 +1,10 @@
Changes since version 1.1.0
---------------------------
+- Added Ice::Properties::parseIceCommandLineOptions(). This operation converts to
+ properties all options that start with one of the following prefixes:
+ --Ice, --IceBox, --IcePack, --IcePatch, --IceSSL, --IceStorm, --Freeze, and --Glacier.
+
- Added ice_clone() member function to non-abstract classes. ice_clone() polymorphically
copies a class instance. The copy is a deep copy for all types except for class members;
class members are copied shallow, that is, if a class contains a class member, the original
diff --git a/cpp/include/Ice/Buffer.h b/cpp/include/Ice/Buffer.h
index 09c3f962e86..f7931a56e2b 100644
--- a/cpp/include/Ice/Buffer.h
+++ b/cpp/include/Ice/Buffer.h
@@ -25,6 +25,7 @@ class ICE_API Buffer : public ::IceUtil::noncopyable
public:
Buffer() : i(b.begin()) { }
+ virtual ~Buffer() { }
typedef std::vector<Ice::Byte> Container;
diff --git a/cpp/slice/Ice/Properties.ice b/cpp/slice/Ice/Properties.ice
index 0e5834b9e33..07dd9e75b6a 100644
--- a/cpp/slice/Ice/Properties.ice
+++ b/cpp/slice/Ice/Properties.ice
@@ -152,14 +152,29 @@ local interface Properties
*
* @param options The command-line options.
*
- * @return The command-line options that were not converted,
- * in the same order.
+ * @return The command-line options that do not start with the specified
+ * prefix, in their original order.
*
**/
StringSeq parseCommandLineOptions(string prefix, StringSeq options);
/**
*
+ * Convert a sequence of command-line options into properties.
+ * All options that begin with one of the following prefixes
+ * are converted into properties: [--Ice], [--IceBox], [--IcePack],
+ * [--IcePatch], [--IceSSL], [--IceStorm], [--Freeze], and [--Glacier].
+ *
+ * @param options The command-line options.
+ *
+ * @return The command-line options that do not start with one of
+ * the listed prefixes, in their original order.
+ *
+ **/
+ StringSeq parseIceCommandLineOptions(StringSeq options);
+
+ /**
+ *
* Load properties from a file.
*
* @param file The property file.
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())
diff --git a/cpp/test/IceStorm/federation/Publisher.cpp b/cpp/test/IceStorm/federation/Publisher.cpp
index 5dff1186cef..30d729996c8 100644
--- a/cpp/test/IceStorm/federation/Publisher.cpp
+++ b/cpp/test/IceStorm/federation/Publisher.cpp
@@ -24,11 +24,6 @@ int
run(int argc, char* argv[], const CommunicatorPtr& communicator)
{
PropertiesPtr properties = communicator->getProperties();
-
- StringSeq args = argsToStringSeq(argc, argv);
- args = properties->parseCommandLineOptions("IceStorm", args);
- stringSeqToArgs(args, argc, argv);
-
const char* managerProxyProperty = "IceStorm.TopicManager.Proxy";
string managerProxy = properties->getProperty(managerProxyProperty);
if(managerProxy.empty())
diff --git a/cpp/test/IceStorm/federation/Subscriber.cpp b/cpp/test/IceStorm/federation/Subscriber.cpp
index f5aa3411508..8c2dcb1151f 100644
--- a/cpp/test/IceStorm/federation/Subscriber.cpp
+++ b/cpp/test/IceStorm/federation/Subscriber.cpp
@@ -87,12 +87,6 @@ usage(const char* appName)
int
run(int argc, char* argv[], const CommunicatorPtr& communicator)
{
- PropertiesPtr properties = communicator->getProperties();
-
- StringSeq args = argsToStringSeq(argc, argv);
- args = properties->parseCommandLineOptions("IceStorm", args);
- stringSeqToArgs(args, argc, argv);
-
string lockfile = "subscriber.lock";
bool batch = false;
@@ -127,6 +121,7 @@ run(int argc, char* argv[], const CommunicatorPtr& communicator)
}
}
+ PropertiesPtr properties = communicator->getProperties();
const char* managerProxyProperty = "IceStorm.TopicManager.Proxy";
string managerProxy = properties->getProperty(managerProxyProperty);
if(managerProxy.empty())
diff --git a/cpp/test/IceStorm/single/Publisher.cpp b/cpp/test/IceStorm/single/Publisher.cpp
index e77532b54f0..c0b4a2055b1 100644
--- a/cpp/test/IceStorm/single/Publisher.cpp
+++ b/cpp/test/IceStorm/single/Publisher.cpp
@@ -24,11 +24,6 @@ int
run(int argc, char* argv[], const CommunicatorPtr& communicator)
{
PropertiesPtr properties = communicator->getProperties();
-
- StringSeq args = argsToStringSeq(argc, argv);
- args = properties->parseCommandLineOptions("IceStorm", args);
- stringSeqToArgs(args, argc, argv);
-
const char* managerProxyProperty = "IceStorm.TopicManager.Proxy";
string managerProxy = properties->getProperty(managerProxyProperty);
if(managerProxy.empty())
diff --git a/cpp/test/IceStorm/single/Subscriber.cpp b/cpp/test/IceStorm/single/Subscriber.cpp
index 07f7d8e36df..d955e965340 100644
--- a/cpp/test/IceStorm/single/Subscriber.cpp
+++ b/cpp/test/IceStorm/single/Subscriber.cpp
@@ -69,12 +69,6 @@ deleteLock(const string& name)
int
run(int argc, char* argv[], const CommunicatorPtr& communicator)
{
- PropertiesPtr properties = communicator->getProperties();
-
- StringSeq args = argsToStringSeq(argc, argv);
- args = properties->parseCommandLineOptions("IceStorm", args);
- stringSeqToArgs(args, argc, argv);
-
string lockfile = "subscriber.lock";
if(argc != 1)
@@ -84,6 +78,7 @@ run(int argc, char* argv[], const CommunicatorPtr& communicator)
createLock(lockfile);
+ PropertiesPtr properties = communicator->getProperties();
const char* managerProxyProperty = "IceStorm.TopicManager.Proxy";
string managerProxy = properties->getProperty(managerProxyProperty);
if(managerProxy.empty())