summaryrefslogtreecommitdiff
path: root/cpp/src
diff options
context:
space:
mode:
authorJose <jose@zeroc.com>2013-01-24 23:10:22 +0100
committerJose <jose@zeroc.com>2013-01-24 23:10:22 +0100
commit47cc21ee10c01fee3f5643a54baa9fff6e1f2cc0 (patch)
treec32cc6957025399fb9b202e61f44f844bc890811 /cpp/src
parentFix VS2010 compilation warning (diff)
downloadice-47cc21ee10c01fee3f5643a54baa9fff6e1f2cc0.tar.bz2
ice-47cc21ee10c01fee3f5643a54baa9fff6e1f2cc0.tar.xz
ice-47cc21ee10c01fee3f5643a54baa9fff6e1f2cc0.zip
Fixed (ICE-4993) - Inconsistent naming of IcePatch2 properties
Diffstat (limited to 'cpp/src')
-rw-r--r--cpp/src/Ice/PropertyNames.cpp12
-rw-r--r--cpp/src/Ice/PropertyNames.h2
-rw-r--r--cpp/src/IcePatch2/Client.cpp4
-rw-r--r--cpp/src/IcePatch2Lib/ClientUtil.cpp115
4 files changed, 121 insertions, 12 deletions
diff --git a/cpp/src/Ice/PropertyNames.cpp b/cpp/src/Ice/PropertyNames.cpp
index 014228c8392..5236802f041 100644
--- a/cpp/src/Ice/PropertyNames.cpp
+++ b/cpp/src/Ice/PropertyNames.cpp
@@ -8,7 +8,7 @@
// **********************************************************************
//
-// Generated by makeprops.py from file ./config/PropertyNames.xml, Fri Jan 18 16:16:35 2013
+// Generated by makeprops.py from file ./config/PropertyNames.xml, Thu Jan 24 22:31:36 2013
// IMPORTANT: Do not edit this file -- any edits made here will be lost!
@@ -578,11 +578,11 @@ const IceInternal::Property IcePatch2PropsData[] =
IceInternal::Property("IcePatch2.ThreadPool.Serialize", false, 0),
IceInternal::Property("IcePatch2.ThreadPool.ThreadIdleTime", false, 0),
IceInternal::Property("IcePatch2.ThreadPool.ThreadPriority", false, 0),
- IceInternal::Property("IcePatch2.ChunkSize", false, 0),
+ IceInternal::Property("IcePatch2.ChunkSize", true, "IcePatch2Client.ChunkSize"),
IceInternal::Property("IcePatch2.Directory", false, 0),
IceInternal::Property("IcePatch2.InstanceName", false, 0),
- IceInternal::Property("IcePatch2.Remove", false, 0),
- IceInternal::Property("IcePatch2.Thorough", false, 0),
+ IceInternal::Property("IcePatch2.Remove", true, "IcePatch2Client.Remove"),
+ IceInternal::Property("IcePatch2.Thorough", true, "IcePatch2Client.Thorough"),
};
const IceInternal::PropertyArray
@@ -591,7 +591,11 @@ const IceInternal::PropertyArray
const IceInternal::Property IcePatch2ClientPropsData[] =
{
+ IceInternal::Property("IcePatch2Client.ChunkSize", false, 0),
+ IceInternal::Property("IcePatch2Client.Directory", false, 0),
IceInternal::Property("IcePatch2Client.Proxy", false, 0),
+ IceInternal::Property("IcePatch2Client.Remove", false, 0),
+ IceInternal::Property("IcePatch2Client.Thorough", false, 0),
};
const IceInternal::PropertyArray
diff --git a/cpp/src/Ice/PropertyNames.h b/cpp/src/Ice/PropertyNames.h
index 49f179b6772..0c0632ae728 100644
--- a/cpp/src/Ice/PropertyNames.h
+++ b/cpp/src/Ice/PropertyNames.h
@@ -8,7 +8,7 @@
// **********************************************************************
//
-// Generated by makeprops.py from file ./config/PropertyNames.xml, Fri Jan 18 16:16:35 2013
+// Generated by makeprops.py from file ./config/PropertyNames.xml, Thu Jan 24 22:31:36 2013
// IMPORTANT: Do not edit this file -- any edits made here will be lost!
diff --git a/cpp/src/IcePatch2/Client.cpp b/cpp/src/IcePatch2/Client.cpp
index e8ea78897b2..a4d2d6e7b74 100644
--- a/cpp/src/IcePatch2/Client.cpp
+++ b/cpp/src/IcePatch2/Client.cpp
@@ -263,7 +263,7 @@ Client::run(int argc, char* argv[])
}
if(opts.isSet("thorough"))
{
- properties->setProperty("IcePatch2.Thorough", "1");
+ properties->setProperty("IcePatch2Client.Thorough", "1");
}
if(args.size() > 1)
@@ -274,7 +274,7 @@ Client::run(int argc, char* argv[])
}
if(args.size() == 1)
{
- properties->setProperty("IcePatch2.Directory", simplify(args[0]));
+ properties->setProperty("IcePatch2Client.Directory", simplify(args[0]));
}
bool aborted = false;
diff --git a/cpp/src/IcePatch2Lib/ClientUtil.cpp b/cpp/src/IcePatch2Lib/ClientUtil.cpp
index 3e829cc3867..6d50a9215b0 100644
--- a/cpp/src/IcePatch2Lib/ClientUtil.cpp
+++ b/cpp/src/IcePatch2Lib/ClientUtil.cpp
@@ -145,12 +145,117 @@ private:
}
+namespace
+{
+
+string
+getDataDir(const CommunicatorPtr& communicator, const string& defaultValue)
+{
+ const string property = "IcePatch2Client.Directory";
+ const string deprecatedProperty = "IcePatch2.Directory";
+
+ if(communicator->getProperties()->getProperty(property).empty() &&
+ communicator->getProperties()->getProperty(deprecatedProperty).empty())
+ {
+ return defaultValue;
+ }
+
+ string value = communicator->getProperties()->getProperty(property);
+ if(value.empty())
+ {
+ value = communicator->getProperties()->getProperty(deprecatedProperty);
+ ostringstream os;
+ os << "The property " << deprecatedProperty << " is deprecated, use " << property << " instead.";
+ communicator->getLogger()->warning(os.str());
+ }
+ assert(!value.empty());
+ return value;
+}
+
+int
+getThorough(const CommunicatorPtr& communicator, int defaultValue)
+{
+ const string property = "IcePatch2Client.Thorough";
+ const string deprecatedProperty = "IcePatch2.Thorough";
+
+ if(communicator->getProperties()->getProperty(property).empty() &&
+ communicator->getProperties()->getProperty(deprecatedProperty).empty())
+ {
+ return defaultValue;
+ }
+
+ if(!communicator->getProperties()->getProperty(property).empty())
+ {
+ return communicator->getProperties()->getPropertyAsInt(property);
+ }
+ else
+ {
+ ostringstream os;
+ os << "The property " << deprecatedProperty << " is deprecated, use " << property << " instead.";
+ communicator->getLogger()->warning(os.str());
+ return communicator->getProperties()->getPropertyAsInt(deprecatedProperty);
+ }
+}
+
+int
+getChunkSize(const CommunicatorPtr& communicator, int defaultValue)
+{
+ const string property = "IcePatch2Client.ChunkSize";
+ const string deprecatedProperty = "IcePatch2.ChunkSize";
+
+ if(communicator->getProperties()->getProperty(property).empty() &&
+ communicator->getProperties()->getProperty(deprecatedProperty).empty())
+ {
+ return defaultValue;
+ }
+
+ if(!communicator->getProperties()->getProperty(property).empty())
+ {
+ return communicator->getProperties()->getPropertyAsInt(property);
+ }
+ else
+ {
+ ostringstream os;
+ os << "The property " << deprecatedProperty << " is deprecated, use " << property << " instead.";
+ communicator->getLogger()->warning(os.str());
+ return communicator->getProperties()->getPropertyAsInt(deprecatedProperty);
+ }
+}
+
+int
+getRemove(const CommunicatorPtr& communicator, int defaultValue)
+{
+ const string property = "IcePatch2Client.Remove";
+ const string deprecatedProperty = "IcePatch2.Remove";
+
+ if(communicator->getProperties()->getProperty(property).empty() &&
+ communicator->getProperties()->getProperty(deprecatedProperty).empty())
+ {
+ return defaultValue;
+ }
+
+ if(!communicator->getProperties()->getProperty(property).empty())
+ {
+ return communicator->getProperties()->getPropertyAsInt(property);
+ }
+ else
+ {
+ ostringstream os;
+ os << "The property " << deprecatedProperty << " is deprecated, use " << property << " instead.";
+ communicator->getLogger()->warning(os.str());
+ return communicator->getProperties()->getPropertyAsInt(deprecatedProperty);
+ }
+}
+
+}
+
+
IcePatch2::Patcher::Patcher(const CommunicatorPtr& communicator, const PatcherFeedbackPtr& feedback) :
_feedback(feedback),
- _dataDir(communicator->getProperties()->getPropertyWithDefault("IcePatch2.Directory", ".")),
- _thorough(communicator->getProperties()->getPropertyAsInt("IcePatch2.Thorough") > 0),
- _chunkSize(communicator->getProperties()->getPropertyAsIntWithDefault("IcePatch2.ChunkSize", 100)),
- _remove(communicator->getProperties()->getPropertyAsIntWithDefault("IcePatch2.Remove", 1)),
+ _dataDir(getDataDir(communicator, ".")),
+ _thorough(getThorough(communicator, 0) > 0),
+ _chunkSize(getChunkSize(communicator, 100)),
+ _remove(getRemove(communicator, 1)),
_log(0)
{
const PropertiesPtr properties = communicator->getProperties();
@@ -601,7 +706,7 @@ IcePatch2::Patcher::removeFiles(const FileInfoSeq& files)
}
catch(...)
{
- if(_remove < 2) // We ignore errors if IcePatch2.Remove >= 2.
+ if(_remove < 2) // We ignore errors if IcePatch2Client.Remove >= 2.
{
throw;
}