[mapguide-commits] r6186 - in trunk/MgDev: Common/CoordinateSystem Common/Foundation/System Common/MapGuideCommon/System Server/src/Core Server/src/UnitTesting Web/src/WebSupport

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Fri Oct 28 05:59:32 EDT 2011


Author: jng
Date: 2011-10-28 02:59:32 -0700 (Fri, 28 Oct 2011)
New Revision: 6186

Modified:
   trunk/MgDev/Common/CoordinateSystem/CoordSysCatalog.cpp
   trunk/MgDev/Common/Foundation/System/Resources.cpp
   trunk/MgDev/Common/Foundation/System/Resources.h
   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/Web/src/WebSupport/InitializeWebTier.cpp
   trunk/MgDev/Web/src/WebSupport/WebSupport.vcproj
Log:
#1840: Implement RFC122. The respective entry points of both the server and webtier now check for the existence of the MentorDictionaryPath configuration property. If one is found, this value is set in the MgCoordinateSystemCatalog before any other code gets their hands on it. Note that we're not removing MENTOR_DICTIONARY_PATH. This env var is still used, but now only as a second port of call in the absence of the MentorDictionaryPath configuration property. Thus, other applications using the MgGeometry library should behave as they did before.

However in its current form, the implementation of MgCoordinateSystemCatalog::SetDictionaryDir() does not re-evaluate the library status so the implementation has been updated to re-check the library status as well. This closes ticket #1821

Modified: trunk/MgDev/Common/CoordinateSystem/CoordSysCatalog.cpp
===================================================================
--- trunk/MgDev/Common/CoordinateSystem/CoordSysCatalog.cpp	2011-10-26 06:29:27 UTC (rev 6185)
+++ trunk/MgDev/Common/CoordinateSystem/CoordSysCatalog.cpp	2011-10-28 09:59:32 UTC (rev 6186)
@@ -344,6 +344,7 @@
     }
 
     m_sDir = szPath;
+    m_libraryStatus = lsInitializationFailed; 
 
     //initializes Mentor
     char* pszPath=Convert_Wide_To_Ascii(szPath);
@@ -370,6 +371,8 @@
     m_pGpDict->SetFileName(sGp);
     m_pGxDict->SetFileName(sGx);
 
+    m_libraryStatus = lsInitialized; 
+
     MG_CATCH_AND_THROW(L"MgCoordinateSystemCatalog.SetDictionaryDir")
 }
 

Modified: trunk/MgDev/Common/Foundation/System/Resources.cpp
===================================================================
--- trunk/MgDev/Common/Foundation/System/Resources.cpp	2011-10-26 06:29:27 UTC (rev 6185)
+++ trunk/MgDev/Common/Foundation/System/Resources.cpp	2011-10-28 09:59:32 UTC (rev 6186)
@@ -33,6 +33,7 @@
 const STRING MgResources::FormatExceptionLocationMethods = L"- ";
 const STRING MgResources::FormatExceptionLocationLines  = L" line ";
 const STRING MgResources::FormatExceptionLocationFiles  = L" file ";
+const STRING MgResources::MentorDictionaryPath          = L"%1 (using path: %2)";
 const STRING MgResources::ServerStarting                = L"Server starting...";
 const STRING MgResources::ServerShuttingDown            = L"Server shutting down...";
 const STRING MgResources::ServerStarted                 = L"Server started.";

Modified: trunk/MgDev/Common/Foundation/System/Resources.h
===================================================================
--- trunk/MgDev/Common/Foundation/System/Resources.h	2011-10-26 06:29:27 UTC (rev 6185)
+++ trunk/MgDev/Common/Foundation/System/Resources.h	2011-10-28 09:59:32 UTC (rev 6186)
@@ -181,6 +181,7 @@
     static const STRING FormatExceptionLocationMethods;
     static const STRING FormatExceptionLocationLines;
     static const STRING FormatExceptionLocationFiles;
+    static const STRING MentorDictionaryPath;
     static const STRING ServerStarting;
     static const STRING ServerShuttingDown;
     static const STRING ServerStarted;

Modified: trunk/MgDev/Common/MapGuideCommon/System/ConfigProperties.cpp
===================================================================
--- trunk/MgDev/Common/MapGuideCommon/System/ConfigProperties.cpp	2011-10-26 06:29:27 UTC (rev 6185)
+++ trunk/MgDev/Common/MapGuideCommon/System/ConfigProperties.cpp	2011-10-28 09:59:32 UTC (rev 6186)
@@ -132,6 +132,8 @@
 const STRING MgConfigProperties::DefaultGeneralPropertyDisplayName                          = L"";
 const STRING MgConfigProperties::GeneralPropertyFdoPath                                     = L"FdoPath";
 const STRING MgConfigProperties::DefaultGeneralPropertyFdoPath                              = L"";
+const STRING MgConfigProperties::GeneralPropertyMentorDictionaryPath                        = L"MentorDictionaryPath";
+const STRING MgConfigProperties::DefaultGeneralPropertyMentorDictionaryPath                 = L"";
 const STRING MgConfigProperties::GeneralPropertyLicenseServerPath                           = L"LicenseServerPath";
 const STRING MgConfigProperties::DefaultGeneralPropertyLicenseServerPath                    = L"";
 const STRING MgConfigProperties::GeneralPropertyLinuxMemDebug                               = L"LinuxMemDebug";
@@ -562,6 +564,7 @@
     { MgConfigProperties::GeneralPropertyDefaultMessageLocale                       , MgPropertyType::String    , MG_CONFIG_MIN_LOCALE_LENGTH           , MG_CONFIG_MAX_LOCALE_LENGTH           , L""                                       },
     { 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::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	2011-10-26 06:29:27 UTC (rev 6185)
+++ trunk/MgDev/Common/MapGuideCommon/System/ConfigProperties.h	2011-10-28 09:59:32 UTC (rev 6186)
@@ -70,6 +70,10 @@
     static const STRING GeneralPropertyFdoPath;                         /// value("FdoPath")
     static const STRING DefaultGeneralPropertyFdoPath;                  /// value("")
 
+    /// Mentor Dictionary Path
+    static const STRING GeneralPropertyMentorDictionaryPath;            /// value("MentorDictionaryPath")
+    static const STRING DefaultGeneralPropertyMentorDictionaryPath;     /// 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	2011-10-26 06:29:27 UTC (rev 6185)
+++ trunk/MgDev/Server/src/Core/Server.cpp	2011-10-28 09:59:32 UTC (rev 6186)
@@ -720,6 +720,7 @@
     ACE_DEBUG ((LM_DEBUG, ACE_TEXT("(%t) MgServer::open()\n")));
     ACE_UNUSED_ARG(args);
     int nResult = 0;
+    STRING mentorDictPath;
 
     MG_TRY()
     {
@@ -864,6 +865,7 @@
         {
             // Check Coordinate System initialization, if the following fails it should throw an exception
             ACE_DEBUG((LM_DEBUG, ACE_TEXT("(%t) MgServer::open() - Initializing Coordinate System Library.\n")));
+            
             Ptr<MgCoordinateSystemFactory> csFactory = new MgCoordinateSystemFactory();
             Ptr<MgCoordinateSystemCatalog> csCatalog = csFactory->GetCatalog();
 
@@ -874,6 +876,20 @@
                     L"MgServer.open", __LINE__, __WFILE__, NULL, L"", NULL);
             }
 
+            // Update the dictionary path with our configured value
+            pConfiguration->GetStringValue(MgConfigProperties::GeneralPropertiesSection, MgConfigProperties::GeneralPropertyMentorDictionaryPath, mentorDictPath, MgConfigProperties::DefaultGeneralPropertyMentorDictionaryPath);
+            if (!mentorDictPath.empty())
+            {
+                // Check if path ends with a '/' if not, add one if needed
+                MgFileUtil::AppendSlashToEndOfPath(mentorDictPath);
+                csCatalog->SetDictionaryDir(mentorDictPath);
+            }
+            else
+            {
+                mentorDictPath = L"";
+                ACE_DEBUG((LM_INFO, ACE_TEXT("(%t) Warning - No configured dictionary path found. Defaulting to MENTOR_DICTIONARY_PATH environment variable.\n")));
+            }
+
             // Did we successfully initialize the coordinate system library?
             LibraryStatus status = csCatalog->GetLibraryStatus();
             if(lsInitialized != status)
@@ -1197,7 +1213,20 @@
 
         // Identify the coordinate system base library
         Ptr<MgCoordinateSystemFactory> csFactory = new MgCoordinateSystemFactory();
-        message = csFactory->GetBaseLibrary();
+        if (!mentorDictPath.empty())
+        {
+            MgStringCollection fmtArgs;
+            fmtArgs.Add(csFactory->GetBaseLibrary());
+            fmtArgs.Add(mentorDictPath);
+            message = pResources->FormatMessage(MgResources::MentorDictionaryPath, &fmtArgs);
+        }
+        else
+        {
+            MgStringCollection fmtArgs;
+            fmtArgs.Add(csFactory->GetBaseLibrary());
+            fmtArgs.Add(L"MENTOR_DICTIONARY_PATH");
+            message = pResources->FormatMessage(MgResources::MentorDictionaryPath, &fmtArgs);
+        }
         ACE_DEBUG ((LM_INFO, ACE_TEXT("(%t) %W\n"), message.c_str()));
 
         // Start the service execution thread

Modified: trunk/MgDev/Server/src/Core/serverconfig.ini
===================================================================
--- trunk/MgDev/Server/src/Core/serverconfig.ini	2011-10-26 06:29:27 UTC (rev 6185)
+++ trunk/MgDev/Server/src/Core/serverconfig.ini	2011-10-28 09:59:32 UTC (rev 6186)
@@ -69,6 +69,7 @@
 #                                  kilobytes (KB)
 #                                       0 < Value <= 2000000
 # MaxLogFileSizeEnabled            0 = max size disabled, 1 = max size enabled
+# MentorDictionaryPath             The path where the CS-Map Coordinate System Dictionaries are installed
 # PreCacheMaps                     The list of maps to precache at server startup.
 #                                       Value = Map resource name(s) separated by ","
 #                                       Example: Library://Samples/Sheboygan/Maps/Sheboygan.MapDefinition
@@ -95,6 +96,7 @@
 MachineIp                          = 127.0.0.1
 MaxLogFileSize                     = 1024
 MaxLogFileSizeEnabled              = 0
+MentorDictionaryPath               = ../../../Oem/CsMap/Dictionaries/
 PreCacheMaps                       =
 Renderer                           = AGG
 ResourcesPath                      = Resources/

Modified: trunk/MgDev/Server/src/UnitTesting/TestCoordinateSystem.cpp
===================================================================
--- trunk/MgDev/Server/src/UnitTesting/TestCoordinateSystem.cpp	2011-10-26 06:29:27 UTC (rev 6185)
+++ trunk/MgDev/Server/src/UnitTesting/TestCoordinateSystem.cpp	2011-10-28 09:59:32 UTC (rev 6186)
@@ -82,6 +82,10 @@
 void TestCoordinateSystem::TestStart()
 {
     ACE_DEBUG((LM_INFO, ACE_TEXT("\nRunning Coordinate System tests. (Mentor)\n")));
+    Ptr<MgCoordinateSystemFactory> csFactory = new MgCoordinateSystemFactory();
+    Ptr<MgCoordinateSystemCatalog> csCatalog = csFactory->GetCatalog();
+    STRING dictPath = csCatalog->GetDictionaryDir();
+    ACE_DEBUG((LM_INFO, ACE_TEXT("\nCoordinate System Dictionary Path is: %W\n"), dictPath.c_str()));
 //    memset(&state, 0, sizeof(_CrtMemState));
 //    _CrtMemCheckpoint(&state);
 }

Modified: trunk/MgDev/Web/src/WebSupport/InitializeWebTier.cpp
===================================================================
--- trunk/MgDev/Web/src/WebSupport/InitializeWebTier.cpp	2011-10-26 06:29:27 UTC (rev 6185)
+++ trunk/MgDev/Web/src/WebSupport/InitializeWebTier.cpp	2011-10-28 09:59:32 UTC (rev 6186)
@@ -70,6 +70,33 @@
         ACE_OS::mkdir(MG_WCHAR_TO_TCHAR(path));
     }
 
+    Ptr<MgCoordinateSystemFactory> csFactory = new MgCoordinateSystemFactory();
+    Ptr<MgCoordinateSystemCatalog> csCatalog = csFactory->GetCatalog();
+
+    STRING mentorDictPath;
+    config->GetStringValue(MgConfigProperties::GeneralPropertiesSection, MgConfigProperties::GeneralPropertyMentorDictionaryPath, mentorDictPath, MgConfigProperties::DefaultGeneralPropertyMentorDictionaryPath);
+
+    //Check catalog
+    if (NULL == csCatalog.p)
+    {
+        throw new MgCoordinateSystemInitializationFailedException(
+            L"MgInitializeWebTierInternal", __LINE__, __WFILE__, NULL, L"", NULL);
+    }
+
+    if (!mentorDictPath.empty())
+    {
+        MgFileUtil::AppendSlashToEndOfPath(mentorDictPath);
+        csCatalog->SetDictionaryDir(mentorDictPath);
+    }
+    
+    //Check lib status
+    LibraryStatus status = csCatalog->GetLibraryStatus();
+    if(lsInitialized != status)
+    {
+        throw new MgCoordinateSystemInitializationFailedException(
+            L"MgInitializeWebTierInternal", __LINE__, __WFILE__, NULL, L"", NULL);
+    }
+
     m_bInitialized = true;
 
     MG_CATCH_AND_THROW(L"MgInitializeWebTierInternal")

Modified: trunk/MgDev/Web/src/WebSupport/WebSupport.vcproj
===================================================================
--- trunk/MgDev/Web/src/WebSupport/WebSupport.vcproj	2011-10-26 06:29:27 UTC (rev 6185)
+++ trunk/MgDev/Web/src/WebSupport/WebSupport.vcproj	2011-10-28 09:59:32 UTC (rev 6186)
@@ -64,10 +64,10 @@
 			/>
 			<Tool
 				Name="VCLinkerTool"
-				AdditionalDependencies="ACEd.lib"
+				AdditionalDependencies="ACEd.lib MgGeometryd.lib"
 				OutputFile="$(OutDir)\MgWebSupportd.dll"
 				LinkIncremental="2"
-				AdditionalLibraryDirectories="..\..\..\Oem\ACE\ACE_wrappers\lib"
+				AdditionalLibraryDirectories="..\..\..\Oem\ACE\ACE_wrappers\lib;..\..\..\Common\lib\debug"
 				GenerateDebugInformation="true"
 				ProgramDatabaseFile="$(OutDir)\MgWebSupportd.pdb"
 				SubSystem="2"
@@ -143,10 +143,10 @@
 			/>
 			<Tool
 				Name="VCLinkerTool"
-				AdditionalDependencies="ACEd.lib"
+				AdditionalDependencies="ACEd.lib MgGeometryd.lib"
 				OutputFile="$(OutDir)\MgWebSupportd.dll"
 				LinkIncremental="2"
-				AdditionalLibraryDirectories="..\..\..\Oem\ACE\ACE_wrappers\lib64"
+				AdditionalLibraryDirectories="..\..\..\Oem\ACE\ACE_wrappers\lib64;..\..\..\Common\lib\debug64"
 				GenerateDebugInformation="true"
 				ProgramDatabaseFile="$(OutDir)\MgWebSupportd.pdb"
 				SubSystem="2"
@@ -221,10 +221,10 @@
 			/>
 			<Tool
 				Name="VCLinkerTool"
-				AdditionalDependencies="ACE.lib"
+				AdditionalDependencies="ACE.lib MgGeometry.lib"
 				OutputFile="$(OutDir)\MgWebSupport.dll"
 				LinkIncremental="1"
-				AdditionalLibraryDirectories="..\..\..\Oem\ACE\ACE_wrappers\lib"
+				AdditionalLibraryDirectories="..\..\..\Oem\ACE\ACE_wrappers\lib;..\..\..\Common\lib\release"
 				GenerateDebugInformation="true"
 				ProgramDatabaseFile="$(OutDir)\MgWebSupport.pdb"
 				SubSystem="2"
@@ -301,10 +301,10 @@
 			/>
 			<Tool
 				Name="VCLinkerTool"
-				AdditionalDependencies="ACE.lib"
+				AdditionalDependencies="ACE.lib MgGeometry.lib"
 				OutputFile="$(OutDir)\MgWebSupport.dll"
 				LinkIncremental="1"
-				AdditionalLibraryDirectories="..\..\..\Oem\ACE\ACE_wrappers\lib64"
+				AdditionalLibraryDirectories="..\..\..\Oem\ACE\ACE_wrappers\lib64;..\..\..\Common\lib\release64"
 				GenerateDebugInformation="true"
 				ProgramDatabaseFile="$(OutDir)\MgWebSupport.pdb"
 				SubSystem="2"



More information about the mapguide-commits mailing list