diff options
author | Jose <jose@zeroc.com> | 2013-01-24 23:10:22 +0100 |
---|---|---|
committer | Jose <jose@zeroc.com> | 2013-01-24 23:10:22 +0100 |
commit | 47cc21ee10c01fee3f5643a54baa9fff6e1f2cc0 (patch) | |
tree | c32cc6957025399fb9b202e61f44f844bc890811 | |
parent | Fix VS2010 compilation warning (diff) | |
download | ice-47cc21ee10c01fee3f5643a54baa9fff6e1f2cc0.tar.bz2 ice-47cc21ee10c01fee3f5643a54baa9fff6e1f2cc0.tar.xz ice-47cc21ee10c01fee3f5643a54baa9fff6e1f2cc0.zip |
Fixed (ICE-4993) - Inconsistent naming of IcePatch2 properties
-rw-r--r-- | config/PropertyNames.xml | 1 | ||||
-rw-r--r-- | cpp/demo/IcePatch2/MFC/PatchClient.cpp | 4 | ||||
-rw-r--r-- | cpp/demo/IcePatch2/MFC/PatchClientDlg.cpp | 12 | ||||
-rw-r--r-- | cpp/demo/IcePatch2/MFC/README | 2 | ||||
-rw-r--r-- | cpp/src/Ice/PropertyNames.cpp | 12 | ||||
-rw-r--r-- | cpp/src/Ice/PropertyNames.h | 2 | ||||
-rw-r--r-- | cpp/src/IcePatch2/Client.cpp | 4 | ||||
-rw-r--r-- | cpp/src/IcePatch2Lib/ClientUtil.cpp | 115 | ||||
-rw-r--r-- | cs/src/Ice/PropertyNames.cs | 12 | ||||
-rw-r--r-- | java/src/IceInternal/PropertyNames.java | 12 |
10 files changed, 147 insertions, 29 deletions
diff --git a/config/PropertyNames.xml b/config/PropertyNames.xml index 14b525ba7f2..7c13f14fe91 100644 --- a/config/PropertyNames.xml +++ b/config/PropertyNames.xml @@ -487,6 +487,7 @@ generated from the section label. </section> <section name="IcePatch2Client"> + <property name="ChunkSize" /> <property name="Directory" /> <property name="Proxy" /> <property name="Remove" /> diff --git a/cpp/demo/IcePatch2/MFC/PatchClient.cpp b/cpp/demo/IcePatch2/MFC/PatchClient.cpp index f444d846393..37100529e3b 100644 --- a/cpp/demo/IcePatch2/MFC/PatchClient.cpp +++ b/cpp/demo/IcePatch2/MFC/PatchClient.cpp @@ -63,9 +63,9 @@ CPatchClientApp::InitInstance() } Ice::PropertiesPtr properties = communicator->getProperties(); - if(properties->getProperty("IcePatch2.Endpoints").empty()) + if(properties->getProperty("IcePatch2Client.Proxy").empty()) { - properties->setProperty("IcePatch2.Endpoints", "tcp -h 127.0.0.1 -p 10000"); + properties->setProperty("IcePatch2Client.Proxy", "IcePatch2/server:tcp -h localhost -p 10000"); } CPatchDlg dlg(communicator); diff --git a/cpp/demo/IcePatch2/MFC/PatchClientDlg.cpp b/cpp/demo/IcePatch2/MFC/PatchClientDlg.cpp index 20766445b39..658f87e0f59 100644 --- a/cpp/demo/IcePatch2/MFC/PatchClientDlg.cpp +++ b/cpp/demo/IcePatch2/MFC/PatchClientDlg.cpp @@ -294,13 +294,13 @@ CPatchDlg::OnInitDialog() // Set the patch directory and thorough flag from properties. // Ice::PropertiesPtr properties = _communicator->getProperties(); - CString path = IceUtil::stringToWstring(properties->getPropertyWithDefault("IcePatch2.Directory", "")).c_str(); + CString path = IceUtil::stringToWstring(properties->getPropertyWithDefault("IcePatch2Client.Directory", "")).c_str(); _path->SetWindowText(path); - CString thorough = IceUtil::stringToWstring(properties->getPropertyWithDefault("IcePatch2.Thorough", "0")).c_str(); + CString thorough = IceUtil::stringToWstring(properties->getPropertyWithDefault("IcePatch2Client.Thorough", "0")).c_str(); _thorough->SetCheck(thorough != "0"); - CString remove = IceUtil::stringToWstring(properties->getPropertyWithDefault("IcePatch2.Remove", "0")).c_str(); + CString remove = IceUtil::stringToWstring(properties->getPropertyWithDefault("IcePatch2Client.Remove", "0")).c_str(); _remove->SetCheck(remove != "0"); // @@ -395,19 +395,19 @@ CPatchDlg::OnStartPatch() AfxMessageBox(CString(L"Please select a patch directory."), MB_OK|MB_ICONEXCLAMATION); return; } - properties->setProperty("IcePatch2.Directory", IceUtil::wstringToString(wstring(path))); + properties->setProperty("IcePatch2Client.Directory", IceUtil::wstringToString(wstring(path))); // // Set the thorough patch flag. // string thorough = _thorough->GetCheck() == BST_CHECKED ? "1" : "0"; - properties->setProperty("IcePatch2.Thorough", thorough); + properties->setProperty("IcePatch2Client.Thorough", thorough); // // Set the remove orphan flag. // string remove = _remove->GetCheck() == BST_CHECKED ? "1" : "0"; - properties->setProperty("IcePatch2.Remove", remove); + properties->setProperty("IcePatch2Client.Remove", remove); DialogPatcherFeedbackPtr feedback = new DialogPatcherFeedback(this); IcePatch2::PatcherPtr patcher = new IcePatch2::Patcher(_communicator, feedback); diff --git a/cpp/demo/IcePatch2/MFC/README b/cpp/demo/IcePatch2/MFC/README index 78c1ffbf286..06250f35001 100644 --- a/cpp/demo/IcePatch2/MFC/README +++ b/cpp/demo/IcePatch2/MFC/README @@ -25,7 +25,7 @@ a new command window and execute this command: > mkdir C:\icepatch_download Now you can start the IcePatch2 client (You will also need to pass an -argument that defines IcePatch2.Endpoints if you use an endpoint other +argument that defines IcePatch2Client.Proxy if you use an endpoint other than the one shown above when you start icepatch2server): > client 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; } diff --git a/cs/src/Ice/PropertyNames.cs b/cs/src/Ice/PropertyNames.cs index 559b728c7cd..982970dca31 100644 --- a/cs/src/Ice/PropertyNames.cs +++ b/cs/src/Ice/PropertyNames.cs @@ -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! @@ -562,17 +562,21 @@ namespace IceInternal new Property(@"^IcePatch2\.ThreadPool\.Serialize$", false, null), new Property(@"^IcePatch2\.ThreadPool\.ThreadIdleTime$", false, null), new Property(@"^IcePatch2\.ThreadPool\.ThreadPriority$", false, null), - new Property(@"^IcePatch2\.ChunkSize$", false, null), + new Property(@"^IcePatch2\.ChunkSize$", true, @"IcePatch2Client.ChunkSize"), new Property(@"^IcePatch2\.Directory$", false, null), new Property(@"^IcePatch2\.InstanceName$", false, null), - new Property(@"^IcePatch2\.Remove$", false, null), - new Property(@"^IcePatch2\.Thorough$", false, null), + new Property(@"^IcePatch2\.Remove$", true, @"IcePatch2Client.Remove"), + new Property(@"^IcePatch2\.Thorough$", true, @"IcePatch2Client.Thorough"), null }; public static Property[] IcePatch2ClientProps = { + new Property(@"^IcePatch2Client\.ChunkSize$", false, null), + new Property(@"^IcePatch2Client\.Directory$", false, null), new Property(@"^IcePatch2Client\.Proxy$", false, null), + new Property(@"^IcePatch2Client\.Remove$", false, null), + new Property(@"^IcePatch2Client\.Thorough$", false, null), null }; diff --git a/java/src/IceInternal/PropertyNames.java b/java/src/IceInternal/PropertyNames.java index eaae142d07c..77eec82cfe0 100644 --- a/java/src/IceInternal/PropertyNames.java +++ b/java/src/IceInternal/PropertyNames.java @@ -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! @@ -562,17 +562,21 @@ public final class PropertyNames new Property("IcePatch2\\.ThreadPool\\.Serialize", false, null), new Property("IcePatch2\\.ThreadPool\\.ThreadIdleTime", false, null), new Property("IcePatch2\\.ThreadPool\\.ThreadPriority", false, null), - new Property("IcePatch2\\.ChunkSize", false, null), + new Property("IcePatch2\\.ChunkSize", true, "IcePatch2Client.ChunkSize"), new Property("IcePatch2\\.Directory", false, null), new Property("IcePatch2\\.InstanceName", false, null), - new Property("IcePatch2\\.Remove", false, null), - new Property("IcePatch2\\.Thorough", false, null), + new Property("IcePatch2\\.Remove", true, "IcePatch2Client.Remove"), + new Property("IcePatch2\\.Thorough", true, "IcePatch2Client.Thorough"), null }; public static final Property IcePatch2ClientProps[] = { + new Property("IcePatch2Client\\.ChunkSize", false, null), + new Property("IcePatch2Client\\.Directory", false, null), new Property("IcePatch2Client\\.Proxy", false, null), + new Property("IcePatch2Client\\.Remove", false, null), + new Property("IcePatch2Client\\.Thorough", false, null), null }; |