[mapguide-commits] r5829 - in sandbox/adsk/2.2gp: Common/Foundation/System Server/src/Common/Manager Server/src/Services/Resource

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Sun May 22 22:06:35 EDT 2011


Author: hubu
Date: 2011-05-22 19:06:35 -0700 (Sun, 22 May 2011)
New Revision: 5829

Modified:
   sandbox/adsk/2.2gp/Common/Foundation/System/Util.cpp
   sandbox/adsk/2.2gp/Common/Foundation/System/Util.h
   sandbox/adsk/2.2gp/Server/src/Common/Manager/Connection.cpp
   sandbox/adsk/2.2gp/Server/src/Common/Manager/LogEntryData.cpp
   sandbox/adsk/2.2gp/Server/src/Common/Manager/LogManager.cpp
   sandbox/adsk/2.2gp/Server/src/Services/Resource/DbEnvironment.cpp
   sandbox/adsk/2.2gp/Server/src/Services/Resource/DbEnvironment.h
Log:
Fix Ticket: https://trac.osgeo.org/mapguide/ticket/1687 and http://trac.osgeo.org/mapguide/ticket/1423/
back porting the fix from trunk.


Modified: sandbox/adsk/2.2gp/Common/Foundation/System/Util.cpp
===================================================================
--- sandbox/adsk/2.2gp/Common/Foundation/System/Util.cpp	2011-05-21 14:19:17 UTC (rev 5828)
+++ sandbox/adsk/2.2gp/Common/Foundation/System/Util.cpp	2011-05-23 02:06:35 UTC (rev 5829)
@@ -576,7 +576,7 @@
 /// \brief
 /// Replace an existing text pattern with a new text pattern in a string.
 ///
-STRING MgUtil::ReplaceString(CREFSTRING str, const wchar_t* oldValue, const wchar_t* newValue)
+STRING MgUtil::ReplaceString(STRING str, const wchar_t* oldValue, const wchar_t* newValue)
 {
     if (NULL == oldValue || NULL == newValue)
     {
@@ -584,7 +584,7 @@
             __LINE__, __WFILE__, NULL, L"", NULL);
     }
 
-    STRING newStr = str;
+    STRING newStr = str.c_str();
 
     ReplaceString(oldValue, newValue, newStr, -1);
 

Modified: sandbox/adsk/2.2gp/Common/Foundation/System/Util.h
===================================================================
--- sandbox/adsk/2.2gp/Common/Foundation/System/Util.h	2011-05-21 14:19:17 UTC (rev 5828)
+++ sandbox/adsk/2.2gp/Common/Foundation/System/Util.h	2011-05-23 02:06:35 UTC (rev 5829)
@@ -411,7 +411,7 @@
     /// \return
     /// Modified string
     ///
-    static STRING ReplaceString(CREFSTRING str, const wchar_t* oldValue, const wchar_t* newValue);
+    static STRING ReplaceString(STRING str, const wchar_t* oldValue, const wchar_t* newValue);
 
     ///////////////////////////////////////////////////////////////////////////
     /// \brief

Modified: sandbox/adsk/2.2gp/Server/src/Common/Manager/Connection.cpp
===================================================================
--- sandbox/adsk/2.2gp/Server/src/Common/Manager/Connection.cpp	2011-05-21 14:19:17 UTC (rev 5828)
+++ sandbox/adsk/2.2gp/Server/src/Common/Manager/Connection.cpp	2011-05-23 02:06:35 UTC (rev 5829)
@@ -207,7 +207,7 @@
 
 void MgConnection::SetClientAgent(CREFSTRING agent)
 {
-    m_clientAgent = agent;
+    m_clientAgent = agent.c_str();
 }
 
 void MgConnection::SetClientIp(CREFSTRING ip)
@@ -216,19 +216,19 @@
     // Note that MgIpUtil::ValidateAddress is not used here because
     // an IP look up will affect peformance.
     MgUtil::CheckXss(ip);
-    m_clientIp = ip;
+    m_clientIp = ip.c_str();
 }
 
 void MgConnection::SetUserName(CREFSTRING user)
 {
     MgUtil::CheckXss(user);
-    m_userName = user;
+    m_userName = user.c_str();
 }
 
 void MgConnection::SetSessionId(CREFSTRING sessionId)
 {
     MgUtil::CheckXss(sessionId);
-    m_sessionId = sessionId;
+    m_sessionId = sessionId.c_str();
 }
 
 ///////////////////////////////////////////////////////////////////////////////

Modified: sandbox/adsk/2.2gp/Server/src/Common/Manager/LogEntryData.cpp
===================================================================
--- sandbox/adsk/2.2gp/Server/src/Common/Manager/LogEntryData.cpp	2011-05-21 14:19:17 UTC (rev 5828)
+++ sandbox/adsk/2.2gp/Server/src/Common/Manager/LogEntryData.cpp	2011-05-23 02:06:35 UTC (rev 5829)
@@ -28,7 +28,7 @@
 //  </summary>
 MgLogEntryData::MgLogEntryData( enum MgLogType logType, CREFSTRING message, ACE_Log_Priority logPriority ) :
     m_logType(logType),
-    m_message(message),
+    m_message(message.c_str()),
     m_logPriority(logPriority)
 {
 };

Modified: sandbox/adsk/2.2gp/Server/src/Common/Manager/LogManager.cpp
===================================================================
--- sandbox/adsk/2.2gp/Server/src/Common/Manager/LogManager.cpp	2011-05-21 14:19:17 UTC (rev 5828)
+++ sandbox/adsk/2.2gp/Server/src/Common/Manager/LogManager.cpp	2011-05-23 02:06:35 UTC (rev 5829)
@@ -345,7 +345,7 @@
             __LINE__, __WFILE__, &arguments, L"MgStringContainsReservedCharacters", &whyArguments);
     }
 
-    return filename;
+    return (STRING)filename.c_str();
 }
 
 void MgLogManager::SetAccessLogInfo(bool bEnabled, CREFSTRING filename, CREFSTRING parameters)
@@ -395,7 +395,7 @@
 {
     ACE_MT (ACE_GUARD_RETURN (ACE_Recursive_Thread_Mutex, ace_mon, m_mutex, STRING(L"")));
 
-    return m_AccessLogFileName;
+    return (STRING)m_AccessLogFileName.c_str();
 }
 
 void MgLogManager::SetAccessLogFileName(CREFSTRING filename)
@@ -411,7 +411,7 @@
 {
     ACE_MT (ACE_GUARD_RETURN (ACE_Recursive_Thread_Mutex, ace_mon, m_mutex, STRING(L"")));
 
-    return m_AccessLogParameters;
+    return (STRING)m_AccessLogParameters.c_str();
 }
 
 void MgLogManager::SetAccessLogParameters(CREFSTRING parameters)
@@ -424,7 +424,7 @@
     {
         ArchiveLog(mltAccess);
     }
-    m_AccessLogParameters = parameters;
+    m_AccessLogParameters = parameters.c_str();
 
     MG_LOGMANAGER_CATCH_AND_THROW(L"MgLogManager.SetAccessLogParameters")
 }
@@ -566,7 +566,7 @@
 {
     ACE_MT (ACE_GUARD_RETURN (ACE_Recursive_Thread_Mutex, ace_mon, m_mutex, STRING(L"")));
 
-    return m_AdminLogFileName;
+    return (STRING)m_AdminLogFileName.c_str();
 }
 
 void MgLogManager::SetAdminLogFileName(CREFSTRING filename)
@@ -582,7 +582,7 @@
 {
     ACE_MT (ACE_GUARD_RETURN (ACE_Recursive_Thread_Mutex, ace_mon, m_mutex, STRING(L"")));
 
-    return m_AdminLogParameters;
+    return (STRING)m_AdminLogParameters.c_str();
 }
 
 void MgLogManager::SetAdminLogParameters(CREFSTRING parameters)
@@ -595,7 +595,7 @@
     {
         ArchiveLog(mltAdmin);
     }
-    m_AdminLogParameters = parameters;
+    m_AdminLogParameters = parameters.c_str();
 
     MG_LOGMANAGER_CATCH_AND_THROW(L"MgLogManager.SetAdminLogParameters")
 }
@@ -737,7 +737,7 @@
 {
     ACE_MT (ACE_GUARD_RETURN (ACE_Recursive_Thread_Mutex, ace_mon, m_mutex, STRING(L"")));
 
-    return m_AuthenticationLogFileName;
+    return (STRING)m_AuthenticationLogFileName.c_str();
 }
 
 void MgLogManager::SetAuthenticationLogFileName(CREFSTRING filename)
@@ -753,7 +753,7 @@
 {
     ACE_MT (ACE_GUARD_RETURN (ACE_Recursive_Thread_Mutex, ace_mon, m_mutex, STRING(L"")));
 
-    return m_AuthenticationLogParameters;
+    return (STRING)m_AuthenticationLogParameters.c_str();
 }
 
 void MgLogManager::SetAuthenticationLogParameters(CREFSTRING parameters)
@@ -766,7 +766,7 @@
     {
         ArchiveLog(mltAuthentication);
     }
-    m_AuthenticationLogParameters = parameters;
+    m_AuthenticationLogParameters = parameters.c_str();
 
     MG_LOGMANAGER_CATCH_AND_THROW(L"MgLogManager.SetAuthenticationLogParameters")
 }
@@ -909,7 +909,7 @@
 {
     ACE_MT (ACE_GUARD_RETURN (ACE_Recursive_Thread_Mutex, ace_mon, m_mutex, STRING(L"")));
 
-    return m_ErrorLogFileName;
+    return (STRING)m_ErrorLogFileName.c_str();
 }
 
 void MgLogManager::SetErrorLogFileName(CREFSTRING filename)
@@ -925,7 +925,7 @@
 {
     ACE_MT (ACE_GUARD_RETURN (ACE_Recursive_Thread_Mutex, ace_mon, m_mutex, STRING(L"")));
 
-    return m_ErrorLogParameters;
+    return (STRING)m_ErrorLogParameters.c_str();
 }
 
 void MgLogManager::SetErrorLogParameters(CREFSTRING parameters)
@@ -938,7 +938,7 @@
     {
         ArchiveLog(mltError);
     }
-    m_ErrorLogParameters = parameters;
+    m_ErrorLogParameters = parameters.c_str();
 
     MG_LOGMANAGER_CATCH_AND_THROW(L"MgLogManager.SetErrorLogParameters")
 }
@@ -1080,7 +1080,7 @@
 {
     ACE_MT (ACE_GUARD_RETURN (ACE_Recursive_Thread_Mutex, ace_mon, m_mutex, STRING(L"")));
 
-    return m_PerformanceLogFileName;
+    return (STRING)m_PerformanceLogFileName.c_str();
 }
 
 void MgLogManager::SetPerformanceLogFileName(CREFSTRING filename)
@@ -1096,7 +1096,7 @@
 {
     ACE_MT (ACE_GUARD_RETURN (ACE_Recursive_Thread_Mutex, ace_mon, m_mutex, STRING(L"")));
 
-    return m_PerformanceLogParameters;
+    return (STRING)m_PerformanceLogParameters.c_str();
 }
 
 void MgLogManager::SetPerformanceLogParameters(CREFSTRING parameters)
@@ -1109,7 +1109,7 @@
     {
         ArchiveLog(mltPerformance);
     }
-    m_PerformanceLogParameters = parameters;
+    m_PerformanceLogParameters = parameters.c_str();
 
     MG_LOGMANAGER_CATCH_AND_THROW(L"MgLogManager.SetPerformanceLogParameters")
 }
@@ -1251,7 +1251,7 @@
 {
     ACE_MT (ACE_GUARD_RETURN (ACE_Recursive_Thread_Mutex, ace_mon, m_mutex, STRING(L"")));
 
-    return m_SessionLogFileName;
+    return (STRING)m_SessionLogFileName.c_str();
 }
 
 void MgLogManager::SetSessionLogFileName(CREFSTRING filename)
@@ -1267,7 +1267,7 @@
 {
     ACE_MT (ACE_GUARD_RETURN (ACE_Recursive_Thread_Mutex, ace_mon, m_mutex, STRING(L"")));
 
-    return m_SessionLogParameters;
+    return (STRING)m_SessionLogParameters.c_str();
 }
 
 void MgLogManager::SetSessionLogParameters(CREFSTRING parameters)
@@ -1280,7 +1280,7 @@
     {
         ArchiveLog(mltSession);
     }
-    m_SessionLogParameters = parameters;
+    m_SessionLogParameters = parameters.c_str();
 
     MG_LOGMANAGER_CATCH_AND_THROW(L"MgLogManager.SetSessionLogParameters")
 }
@@ -1422,7 +1422,7 @@
 {
     ACE_MT (ACE_GUARD_RETURN (ACE_Recursive_Thread_Mutex, ace_mon, m_mutex, STRING(L"")));
 
-    return m_TraceLogFileName;
+    return (STRING)m_TraceLogFileName.c_str();
 }
 
 void MgLogManager::SetTraceLogFileName(CREFSTRING filename)
@@ -1438,7 +1438,7 @@
 {
     ACE_MT (ACE_GUARD_RETURN (ACE_Recursive_Thread_Mutex, ace_mon, m_mutex, STRING(L"")));
 
-    return m_TraceLogParameters;
+    return(STRING) m_TraceLogParameters.c_str();
 }
 
 void MgLogManager::SetTraceLogParameters(CREFSTRING parameters)
@@ -1451,7 +1451,7 @@
     {
         ArchiveLog(mltTrace);
     }
-    m_TraceLogParameters = parameters;
+    m_TraceLogParameters = parameters.c_str();
 
     MG_LOGMANAGER_CATCH_AND_THROW(L"MgLogManager.SetTraceLogParameters")
 }
@@ -2359,7 +2359,7 @@
         DisableLog(logType);
     }
 
-    MgFileUtil::DeleteFile(m_path+fileName);
+    MgFileUtil::DeleteFile((STRING)m_path.c_str()+(STRING)fileName.c_str());
 
     if(bInUse)
     {
@@ -3250,12 +3250,12 @@
 
     newFilename = RemoveArchiveFrequencySpecifier(newFilename);
 
-    return (m_path + newFilename);
+    return ((STRING)m_path.c_str() + (STRING)newFilename.c_str());
 }
 
 STRING MgLogManager::BuildFileNameFromDateTime(CREFSTRING filename, MgDateTime* date)
 {
-    STRING newFilename = filename;
+    STRING newFilename = filename.c_str();
     STRING replacer;
     wchar_t buff[3];
 
@@ -3302,7 +3302,7 @@
     }
     newFilename = MgUtil::ReplaceString(newFilename, L"%d", replacer.c_str());
 
-    return (m_path + newFilename);
+    return ((STRING)m_path.c_str() + (STRING)newFilename.c_str());
 }
 
 bool MgLogManager::IsMoreThan24HourDiff(MgDateTime* fromDate, MgDateTime* toDate)
@@ -3546,19 +3546,19 @@
 void MgLogManager::AddString(REFSTRING entry, CREFSTRING value)
 {
     AddDelimiter(entry);
-    entry += value;
+    entry += value.c_str();
 }
 
 void MgLogManager::AddClient(REFSTRING entry, CREFSTRING client)
 {
     AddDelimiter(entry);
-    entry += client;
+    entry += client.c_str();
 }
 
 void MgLogManager::AddClientIp(REFSTRING entry, CREFSTRING clientIp)
 {
     AddDelimiter(entry);
-    entry += clientIp;
+    entry += clientIp.c_str();
 }
 
 void MgLogManager::AddError(REFSTRING entry, CREFSTRING error, CREFSTRING type)
@@ -3637,7 +3637,7 @@
 void MgLogManager::AddInfo(REFSTRING entry, CREFSTRING info)
 {
     AddDelimiter(entry);
-    entry += info;
+    entry += info.c_str();
 }
 
 void MgLogManager::AddOpId(REFSTRING entry, CREFSTRING opId)
@@ -3659,7 +3659,7 @@
 void MgLogManager::AddUserName(REFSTRING entry, CREFSTRING userName)
 {
     AddDelimiter(entry);
-    entry += userName;
+    entry += userName.c_str();
 }
 
 bool MgLogManager::IsMaxSizeExceeded(CREFSTRING logFileName)

Modified: sandbox/adsk/2.2gp/Server/src/Services/Resource/DbEnvironment.cpp
===================================================================
--- sandbox/adsk/2.2gp/Server/src/Services/Resource/DbEnvironment.cpp	2011-05-21 14:19:17 UTC (rev 5828)
+++ sandbox/adsk/2.2gp/Server/src/Services/Resource/DbEnvironment.cpp	2011-05-23 02:06:35 UTC (rev 5829)
@@ -42,8 +42,20 @@
     m_dbEnv.set_error_stream(&std::cerr);
 #endif
 
-    m_dbEnv.set_cachesize(0, MG_CACHE_SIZE, 1);
-    m_dbEnv.set_lg_bsize(MG_LOG_BUF_SIZE);
+    // Set the cache size based on the repository type
+    if(MgRepositoryType::Session == repositoryType)
+    {
+        // Session repository
+        m_dbEnv.set_cachesize(0, MG_SESSION_CACHE_SIZE, 1);
+        m_dbEnv.set_lg_bsize(MG_SESSION_LOG_BUF_SIZE);
+    }
+    else
+    {
+        // Library repository
+        m_dbEnv.set_cachesize(0, MG_LIBRARY_CACHE_SIZE, 1);
+        m_dbEnv.set_lg_bsize(MG_LIBRARY_LOG_BUF_SIZE);
+    }
+
     m_dbEnv.set_timeout(MG_DB_ENV_TIMEOUT, DB_SET_LOCK_TIMEOUT);
     m_dbEnv.set_timeout(MG_DB_ENV_TIMEOUT, DB_SET_TXN_TIMEOUT);
     m_dbEnv.set_tx_max(MG_MAX_TRANSACTIONS);

Modified: sandbox/adsk/2.2gp/Server/src/Services/Resource/DbEnvironment.h
===================================================================
--- sandbox/adsk/2.2gp/Server/src/Services/Resource/DbEnvironment.h	2011-05-21 14:19:17 UTC (rev 5828)
+++ sandbox/adsk/2.2gp/Server/src/Services/Resource/DbEnvironment.h	2011-05-23 02:06:35 UTC (rev 5829)
@@ -22,17 +22,19 @@
 
 // All sizes must be in powers-of-two.
 // TODO: Determine the best sizes to improve the Server performance.
-static const u_int32_t MG_KB                = 1024;
-static const u_int32_t MG_MB                = 1048576; // 1024^2
-static const u_int32_t MG_CACHE_SIZE        = 32 * MG_MB;
-static const u_int32_t MG_DB_PAGE_SIZE      = 32 * MG_KB;
-static const u_int32_t MG_DBXML_PAGE_SIZE   = 32 * MG_KB;
-static const u_int32_t MG_LOG_BUF_SIZE      = 12 * MG_MB;
-static const u_int32_t MG_MAX_TRANSACTIONS  = 1000;
-static const u_int32_t MG_SESS_DB_PAGE_SIZE = 2 * MG_KB;
+static const u_int32_t MG_KB                   = 1024;
+static const u_int32_t MG_MB                   = 1048576; // 1024^2
+static const u_int32_t MG_LIBRARY_CACHE_SIZE   = 32 * MG_MB;
+static const u_int32_t MG_SESSION_CACHE_SIZE   = 2 * MG_MB;
+static const u_int32_t MG_DB_PAGE_SIZE         = 32 * MG_KB;
+static const u_int32_t MG_DBXML_PAGE_SIZE      = 32 * MG_KB;
+static const u_int32_t MG_LIBRARY_LOG_BUF_SIZE = 12 * MG_MB;
+static const u_int32_t MG_SESSION_LOG_BUF_SIZE = 1 * MG_MB;
+static const u_int32_t MG_MAX_TRANSACTIONS     = 1000;
+static const u_int32_t MG_SESS_DB_PAGE_SIZE    = 2 * MG_KB;
 static const u_int32_t MG_SESS_DBXML_PAGE_SIZE = 512;
 // Set lock and transaction timeout to 0.2 seconds
-static const u_int32_t MG_DB_ENV_TIMEOUT = 200000;
+static const u_int32_t MG_DB_ENV_TIMEOUT       = 200000;
 
 class MgDatabase;
 



More information about the mapguide-commits mailing list