[mapguide-commits] r7111 - in trunk/MgDev: Common/MapGuideCommon/System Server/src/Core Server/src/UnitTesting

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Fri Oct 12 04:26:27 PDT 2012


Author: baertelchen
Date: 2012-10-12 04:26:26 -0700 (Fri, 12 Oct 2012)
New Revision: 7111

Modified:
   trunk/MgDev/Common/MapGuideCommon/System/ConfigProperties.cpp
   trunk/MgDev/Common/MapGuideCommon/System/ConfigProperties.h
   trunk/MgDev/Server/src/Core/Server.cpp
   trunk/MgDev/Server/src/Core/serverconfig.ini
   trunk/MgDev/Server/src/UnitTesting/TestCoordinateSystem.cpp
   trunk/MgDev/Server/src/UnitTesting/TestCoordinateSystem.h
Log:
Support MentorUserDictionaryPath in serverconfig.ini (part of RFC 127)

Implemented support for the [MentorUserDictionaryPath] setting in the serverconfig.ini file.
If that setting is available (i.e. not an empty string), the server startup code will call into
the MgCoordinateSystemCatalog's SetUserDictionaryDir() method thus overriding
the default location of the user dictionary path - which may or may not have been set before.

While an invalid [MentorDictionaryPath] setting leads to the server to failing to startup, an invalid
[MentorUserDictionaryPath] does not. It will be logged as a warning though.

Changes reviewed by Jackie. 

Modified: trunk/MgDev/Common/MapGuideCommon/System/ConfigProperties.cpp
===================================================================
--- trunk/MgDev/Common/MapGuideCommon/System/ConfigProperties.cpp	2012-10-12 03:02:26 UTC (rev 7110)
+++ trunk/MgDev/Common/MapGuideCommon/System/ConfigProperties.cpp	2012-10-12 11:26:26 UTC (rev 7111)
@@ -134,6 +134,8 @@
 const STRING MgConfigProperties::DefaultGeneralPropertyFdoPath                              = L"";
 const STRING MgConfigProperties::GeneralPropertyMentorDictionaryPath                        = L"MentorDictionaryPath";
 const STRING MgConfigProperties::DefaultGeneralPropertyMentorDictionaryPath                 = L"";
+const STRING MgConfigProperties::GeneralPropertyMentorUserDictionaryPath                    = L"MentorUserDictionaryPath";
+const STRING MgConfigProperties::DefaultGeneralPropertyMentorUserDictionaryPath             = L"";
 const STRING MgConfigProperties::GeneralPropertyLicenseServerPath                           = L"LicenseServerPath";
 const STRING MgConfigProperties::DefaultGeneralPropertyLicenseServerPath                    = L"";
 const STRING MgConfigProperties::GeneralPropertyLinuxMemDebug                               = L"LinuxMemDebug";
@@ -565,6 +567,7 @@
     { MgConfigProperties::GeneralPropertyDisplayName                                , MgPropertyType::String    , MG_CONFIG_MIN_OPTIONAL_STRING_LENGTH  , MG_CONFIG_MAX_OPTIONAL_STRING_LENGTH  , MG_CONFIG_FILE_NAME_RESERVED_CHARACTERS   },
     { MgConfigProperties::GeneralPropertyFdoPath                                    , MgPropertyType::String    , MG_CONFIG_MIN_PATH_LENGTH             , MG_CONFIG_MAX_PATH_LENGTH             , MG_CONFIG_PATH_RESERVED_CHARACTERS        },
     { MgConfigProperties::GeneralPropertyMentorDictionaryPath                       , MgPropertyType::String    , MG_CONFIG_MIN_PATH_LENGTH             , MG_CONFIG_MAX_PATH_LENGTH             , MG_CONFIG_PATH_RESERVED_CHARACTERS        },
+    { MgConfigProperties::GeneralPropertyMentorUserDictionaryPath                   , MgPropertyType::String    , MG_CONFIG_MIN_PATH_LENGTH             , MG_CONFIG_MAX_PATH_LENGTH             , MG_CONFIG_PATH_RESERVED_CHARACTERS        },
     { MgConfigProperties::GeneralPropertyLicenseServerPath                          , MgPropertyType::String    , MG_CONFIG_MIN_OPTIONAL_STRING_LENGTH  , MG_CONFIG_MAX_OPTIONAL_STRING_LENGTH  , L""                                       },
     { MgConfigProperties::GeneralPropertyLinuxMemDebug                              , MgPropertyType::Boolean   , 0                                     , 1                                     , L""                                       },
     { MgConfigProperties::GeneralPropertyLogsDelimiter                              , MgPropertyType::String    , 1                                     , 128                                   , L""                                       },

Modified: trunk/MgDev/Common/MapGuideCommon/System/ConfigProperties.h
===================================================================
--- trunk/MgDev/Common/MapGuideCommon/System/ConfigProperties.h	2012-10-12 03:02:26 UTC (rev 7110)
+++ trunk/MgDev/Common/MapGuideCommon/System/ConfigProperties.h	2012-10-12 11:26:26 UTC (rev 7111)
@@ -74,6 +74,10 @@
     static const STRING GeneralPropertyMentorDictionaryPath;            /// value("MentorDictionaryPath")
     static const STRING DefaultGeneralPropertyMentorDictionaryPath;     /// value("")
 
+    /// Mentor User Dictionary Path
+    static const STRING GeneralPropertyMentorUserDictionaryPath;        /// value("MentorUserDictionaryPath")
+    static const STRING DefaultGeneralPropertyMentorUserDictionaryPath; /// value("")
+
     /// Path of the license server
     static const STRING GeneralPropertyLicenseServerPath;               /// value("LicenseServerPath")
     static const STRING DefaultGeneralPropertyLicenseServerPath;        /// value("");

Modified: trunk/MgDev/Server/src/Core/Server.cpp
===================================================================
--- trunk/MgDev/Server/src/Core/Server.cpp	2012-10-12 03:02:26 UTC (rev 7110)
+++ trunk/MgDev/Server/src/Core/Server.cpp	2012-10-12 11:26:26 UTC (rev 7111)
@@ -721,6 +721,7 @@
     ACE_UNUSED_ARG(args);
     int nResult = 0;
     STRING mentorDictPath;
+    STRING mentorUserDictPath;
 
     MG_TRY()
     {
@@ -882,14 +883,49 @@
             {
                 // Check if path ends with a '/' if not, add one if needed
                 MgFileUtil::AppendSlashToEndOfPath(mentorDictPath);
-                csCatalog->SetDictionaryDir(mentorDictPath);
+                MG_TRY()
+                    csCatalog->SetDictionaryDir(mentorDictPath);
+                MG_CATCH_AND_RELEASE()
+                if (NULL != mgException)
+                {
+                    ACE_DEBUG((LM_ERROR, ACE_TEXT("(%t) MgServer::open() - The MentorDictionaryPath setting is invalid. The coordinate system engine could not be initialized.\n")));
+                }
             }
             else
             {
                 mentorDictPath = L"";
-                ACE_DEBUG((LM_INFO, ACE_TEXT("(%t) Warning - No configured dictionary path found. Defaulting to MENTOR_DICTIONARY_PATH environment variable.\n")));
+                ACE_DEBUG((LM_INFO, ACE_TEXT("(%t) MgServer::open() - No configured dictionary path found. Defaulting to [%W].\n"), csCatalog->GetDictionaryDir().c_str()));
             }
 
+            // Update the user dictionary path with our configured value
+            pConfiguration->GetStringValue(MgConfigProperties::GeneralPropertiesSection, MgConfigProperties::GeneralPropertyMentorUserDictionaryPath, mentorUserDictPath, MgConfigProperties::DefaultGeneralPropertyMentorUserDictionaryPath);
+            if (!mentorUserDictPath.empty())
+            {
+                // Check if path ends with a '/' if not, add one if needed
+                MgFileUtil::AppendSlashToEndOfPath(mentorUserDictPath);
+                MG_TRY()
+                    csCatalog->SetUserDictionaryDir(mentorUserDictPath);
+                MG_CATCH_AND_RELEASE()
+                if (NULL != mgException)
+                {
+                    //not being able to initialize the user dictionary path doesn't result in the server not starting up
+                    ACE_DEBUG((LM_WARNING, ACE_TEXT("(%t) MgServer::open() - The MentorUserDictionaryPath setting is invalid. The user dictionary path setting will not be applied.\n")));
+                }
+            }
+            else
+            {
+                mentorUserDictPath = L"";
+                STRING defaultUserPath = csCatalog->GetUserDictionaryDir();
+                if (defaultUserPath.empty())
+                {
+                    ACE_DEBUG((LM_DEBUG, ACE_TEXT("(%t) MgServer::open() - No configured user dictionary path found.\n")));
+                }
+                else
+                {
+                    ACE_DEBUG((LM_DEBUG, ACE_TEXT("(%t) MgServer::open() - No configured user dictionary path found. Defaulting to directory [%W].\n"), defaultUserPath.c_str()));
+                }
+            }
+
             // Did we successfully initialize the coordinate system library?
             LibraryStatus status = csCatalog->GetLibraryStatus();
             if(lsInitialized != status)

Modified: trunk/MgDev/Server/src/Core/serverconfig.ini
===================================================================
--- trunk/MgDev/Server/src/Core/serverconfig.ini	2012-10-12 03:02:26 UTC (rev 7110)
+++ trunk/MgDev/Server/src/Core/serverconfig.ini	2012-10-12 11:26:26 UTC (rev 7111)
@@ -70,6 +70,7 @@
 #                                       0 < Value <= 2000000
 # MaxLogFileSizeEnabled            0 = max size disabled, 1 = max size enabled
 # MentorDictionaryPath             The path where the CS-Map Coordinate System Dictionaries are installed
+# MentorUserDictionaryPath         The path where user defined CS-Map Coordinate System Dictionaries are stored
 # PreCacheMaps                     The list of maps to precache at server startup.
 #                                       Value = Map resource name(s) separated by ","
 #                                       Example: Library://Samples/Sheboygan/Maps/Sheboygan.MapDefinition
@@ -97,6 +98,7 @@
 MaxLogFileSize                     = 1024
 MaxLogFileSizeEnabled              = 0
 MentorDictionaryPath               = ../../../Oem/CsMap/Dictionaries/
+MentorUserDictionaryPath           =
 PreCacheMaps                       =
 Renderer                           = AGG
 ResourcesPath                      = Resources/

Modified: trunk/MgDev/Server/src/UnitTesting/TestCoordinateSystem.cpp
===================================================================
--- trunk/MgDev/Server/src/UnitTesting/TestCoordinateSystem.cpp	2012-10-12 03:02:26 UTC (rev 7110)
+++ trunk/MgDev/Server/src/UnitTesting/TestCoordinateSystem.cpp	2012-10-12 11:26:26 UTC (rev 7111)
@@ -441,15 +441,15 @@
     if (userDictionaryDir.empty())
         return;
 
+    pCsCatalog->SetUserDictionaryDir(userDictionaryDir);
     STRING setUserDictionaryDir = pCsCatalog->GetUserDictionaryDir();
-    pCsCatalog->SetUserDictionaryDir(userDictionaryDir);
 
     MG_TRY()
 
 #ifdef _WIN32
         pCsCatalog->SetUserDictionaryDir(L"X:\\I am a hopefully not existing path - if I do, changeme");
 #else
-        pCsCatalog->SetUserDictionaryDir(L"/I a hopefully not existing path - if I do, changeme");
+        pCsCatalog->SetUserDictionaryDir(L"/I am a hopefully not existing path - if I do, changeme");
 #endif
 
     MG_CATCH_AND_RELEASE()

Modified: trunk/MgDev/Server/src/UnitTesting/TestCoordinateSystem.h
===================================================================
--- trunk/MgDev/Server/src/UnitTesting/TestCoordinateSystem.h	2012-10-12 03:02:26 UTC (rev 7110)
+++ trunk/MgDev/Server/src/UnitTesting/TestCoordinateSystem.h	2012-10-12 11:26:26 UTC (rev 7111)
@@ -39,6 +39,7 @@
     CPPUNIT_TEST(TestCase_UpdateGeodeticTransformations);
     CPPUNIT_TEST(TestCase_UpdateGeodeticPaths);
 
+    CPPUNIT_TEST(TestCase_InitializeInvalidUserDictionaryDir);
     CPPUNIT_TEST(TestCase_InitializeValidUserDictionaryDir);
 
     CPPUNIT_TEST(TestCase_UpdateUserCoordinateSystems);



More information about the mapguide-commits mailing list