[mapguide-commits] r6907 - in branches/2.4/MgDev/Desktop: MgAppLayout MgDesktop MgDesktop/Services MgDesktop/Services/Feature MgDesktop/System UnitTest

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Tue Jul 17 10:54:48 PDT 2012


Author: jng
Date: 2012-07-17 10:54:48 -0700 (Tue, 17 Jul 2012)
New Revision: 6907

Modified:
   branches/2.4/MgDev/Desktop/MgAppLayout/Program.cs
   branches/2.4/MgDev/Desktop/MgDesktop/MgDesktop.vcproj
   branches/2.4/MgDev/Desktop/MgDesktop/Services/Feature/FdoConnectionPool.cpp
   branches/2.4/MgDev/Desktop/MgDesktop/Services/Feature/FdoConnectionPool.h
   branches/2.4/MgDev/Desktop/MgDesktop/Services/Feature/FeatureConnection.cpp
   branches/2.4/MgDev/Desktop/MgDesktop/Services/FeatureService.cpp
   branches/2.4/MgDev/Desktop/MgDesktop/System/PlatformInit.cpp
   branches/2.4/MgDev/Desktop/UnitTest/TestProfilingService.cpp
   branches/2.4/MgDev/Desktop/UnitTest/main.cpp
Log:
mg-desktop: fixes for debug mode

Modified: branches/2.4/MgDev/Desktop/MgAppLayout/Program.cs
===================================================================
--- branches/2.4/MgDev/Desktop/MgAppLayout/Program.cs	2012-07-16 03:09:00 UTC (rev 6906)
+++ branches/2.4/MgDev/Desktop/MgAppLayout/Program.cs	2012-07-17 17:54:48 UTC (rev 6907)
@@ -65,11 +65,12 @@
             ((Shell)frm).Initialize(layout, provider);
             Application.ApplicationExit += new EventHandler(OnAppExit);
             Application.Run((Shell)frm);
+            MgPlatform.Terminate();
         }
 
         static void OnAppExit(object sender, EventArgs e)
         {
-            MgPlatform.Terminate();
+            
         }
 
         static void Application_ThreadException(object sender, System.Threading.ThreadExceptionEventArgs e)

Modified: branches/2.4/MgDev/Desktop/MgDesktop/MgDesktop.vcproj
===================================================================
--- branches/2.4/MgDev/Desktop/MgDesktop/MgDesktop.vcproj	2012-07-16 03:09:00 UTC (rev 6906)
+++ branches/2.4/MgDev/Desktop/MgDesktop/MgDesktop.vcproj	2012-07-17 17:54:48 UTC (rev 6907)
@@ -66,7 +66,7 @@
 			/>
 			<Tool
 				Name="VCLinkerTool"
-				AdditionalDependencies="FDO.lib FDOCommon.lib FDOGeometry.lib ExpressionEngine.lib ACEd.lib MgFoundationd.lib MgGeometryd.lib MgMdfModeld.lib MgMdfParserd.lib MgPlatformBased.lib MgRenderersd.lib MgStylizationd.lib MgGwsCommond.lib MgGwsQueryEngined.lib xerces-c_3mgD.lib dwfcore_wt.1.1.1.lib dwftk_wt.7.1.1.lib whiptk_wt.7.7.601.lib MgSecurity.lib"
+				AdditionalDependencies="FDO.lib FDOCommon.lib FDOGeometry.lib ExpressionEngine.lib ACEd.lib MgFoundationd.lib MgGeometryd.lib MgMdfModeld.lib MgMdfParserd.lib MgPlatformBased.lib MgRenderersd.lib MgStylizationd.lib MgGwsCommond.lib MgGwsQueryEngined.lib xerces-c_3mgD.lib dwfcore_wt.1.1.1.lib dwftk_wt.7.1.1.lib whiptk_wt.7.7.601.lib MgSecurityd.lib"
 				ShowProgress="0"
 				OutputFile="$(OutDir)\MgDesktopd.dll"
 				LinkIncremental="1"

Modified: branches/2.4/MgDev/Desktop/MgDesktop/Services/Feature/FdoConnectionPool.cpp
===================================================================
--- branches/2.4/MgDev/Desktop/MgDesktop/Services/Feature/FdoConnectionPool.cpp	2012-07-16 03:09:00 UTC (rev 6906)
+++ branches/2.4/MgDev/Desktop/MgDesktop/Services/Feature/FdoConnectionPool.cpp	2012-07-17 17:54:48 UTC (rev 6907)
@@ -3,6 +3,9 @@
 #include "FdoConnectionPool.h"
 #include "FdoConnectionUtil.h"
 
+INT64 MgFdoConnectionPool::sm_nConnectionsRequested = 0L;
+INT64 MgFdoConnectionPool::sm_nConnectionsReturned = 0L;
+
 //connection pool record -- contains database pointer
 //plus extra timing information/status
 struct PoolRec
@@ -100,6 +103,8 @@
 
     MG_FEATURE_SERVICE_CATCH_AND_THROW(L"MgFdoConnectionPool::GetConnection")
 
+    sm_nConnectionsRequested++;
+
     return conn.Detach();
 }
 
@@ -110,8 +115,11 @@
     ScopedLock scc(g_pool.mutex);
     STRING providerName = conn->GetProviderName();
     FdoPtr<FdoIConnection> fdoConn = conn->GetConnection();
+    
+    STRING fsIdStr;
     Ptr<MgResourceIdentifier> fsId = conn->GetFeatureSource();
-    STRING fsIdStr = fsId->ToString();
+    if (NULL != fsId.p)
+        fsIdStr = fsId->ToString();
 
     bool bReturned = false;
     bool bProviderExcluded = false;
@@ -153,10 +161,15 @@
     logDetail.Create();
 
     MG_FEATURE_SERVICE_CATCH_AND_THROW(L"MgFdoConnectionPool::ReturnConnection")
+
+    sm_nConnectionsReturned++;
 }
 
 void MgFdoConnectionPool::Initialize(MgConfiguration* pConfiguration)
 {
+    sm_nConnectionsRequested = 0L;
+    sm_nConnectionsReturned = 0L;
+
     MG_FEATURE_SERVICE_TRY()
 
     bool bDataConnectionPoolEnabled = MgConfigProperties::DefaultFeatureServicePropertyDataConnectionPoolEnabled;
@@ -210,9 +223,17 @@
 {
     MG_FEATURE_SERVICE_TRY()
 
-    MG_LOG_TRACE_ENTRY(L"MgFdoConnectionPool::Cleanup()");
+    ScopedLock scc(g_pool.mutex);
 
-    ScopedLock scc(g_pool.mutex);
+    MgLogDetail logDetail(MgServiceType::FeatureService, MgLogDetail::InternalTrace, L"MgFdoConnectionPool::Cleanup", mgStackParams);
+    logDetail.AddInt64(L"ConnectionsRequested", sm_nConnectionsRequested);
+    logDetail.AddInt64(L"ConnectionsReturned", sm_nConnectionsReturned);
+    logDetail.Create();
+
+    if (sm_nConnectionsRequested != sm_nConnectionsReturned)
+    {
+        ACE_DEBUG((LM_INFO, ACE_TEXT("[WARNING] %d connections have leaked for this session (ie. not returned)\n"), (sm_nConnectionsRequested - sm_nConnectionsReturned)));
+    }
     
     for (ConnPool::iterator it = g_pool.freePool.begin(); it != g_pool.freePool.end(); ++it)
     {

Modified: branches/2.4/MgDev/Desktop/MgDesktop/Services/Feature/FdoConnectionPool.h
===================================================================
--- branches/2.4/MgDev/Desktop/MgDesktop/Services/Feature/FdoConnectionPool.h	2012-07-16 03:09:00 UTC (rev 6906)
+++ branches/2.4/MgDev/Desktop/MgDesktop/Services/Feature/FdoConnectionPool.h	2012-07-17 17:54:48 UTC (rev 6907)
@@ -36,6 +36,8 @@
     static void GetCacheInfo(std::vector<PoolCacheEntry*>& entries); //Caller responsible for cleanup of contents
 
 private:
+    static INT64 sm_nConnectionsRequested;
+    static INT64 sm_nConnectionsReturned;
     static bool StringStartsWith(CREFSTRING haystack, CREFSTRING needle);
 };
 

Modified: branches/2.4/MgDev/Desktop/MgDesktop/Services/Feature/FeatureConnection.cpp
===================================================================
--- branches/2.4/MgDev/Desktop/MgDesktop/Services/Feature/FeatureConnection.cpp	2012-07-16 03:09:00 UTC (rev 6906)
+++ branches/2.4/MgDev/Desktop/MgDesktop/Services/Feature/FeatureConnection.cpp	2012-07-17 17:54:48 UTC (rev 6907)
@@ -68,13 +68,7 @@
     #ifdef DEBUG_FDO_CONNECTION_POOL
         ACE_DEBUG((LM_INFO, ACE_TEXT("MgFeatureConnection::Close()\n")));
     #endif
-        //Ones initialized with a resource id are poolable and thus must be
-        //returned
-        if (m_bIsCreatedFromFeatureSource)
-            MgFdoConnectionPool::ReturnConnection(this);
-        else
-            m_fdoConn->Close();
-
+        MgFdoConnectionPool::ReturnConnection(this);
         m_fdoConn = NULL;
     }
 }

Modified: branches/2.4/MgDev/Desktop/MgDesktop/Services/FeatureService.cpp
===================================================================
--- branches/2.4/MgDev/Desktop/MgDesktop/Services/FeatureService.cpp	2012-07-16 03:09:00 UTC (rev 6906)
+++ branches/2.4/MgDev/Desktop/MgDesktop/Services/FeatureService.cpp	2012-07-17 17:54:48 UTC (rev 6907)
@@ -159,6 +159,8 @@
 
     MG_FEATURE_SERVICE_TRY()
 
+    CHECK_FEATURE_SOURCE_ARGUMENT(resource, L"MgdFeatureService::TestConnection");
+
     MG_LOG_OPERATION_MESSAGE_INIT(MG_API_VERSION(1, 0, 0), 1);
     MG_LOG_OPERATION_MESSAGE_PARAMETERS_START();
     MG_LOG_OPERATION_MESSAGE_ADD_STRING((NULL == resource) ? L"MgResourceIdentifier" : resource->ToString().c_str());
@@ -166,8 +168,6 @@
 
     MG_LOG_TRACE_ENTRY(L"MgdFeatureService::TestConnection()");
 
-    CHECK_FEATURE_SOURCE_ARGUMENT(resource, L"MgdFeatureService::TestConnection");
-
 	Ptr<MgFeatureConnection> conn = new MgFeatureConnection(resource);
 	ok = conn->IsConnectionOpen();
 
@@ -274,6 +274,9 @@
 
     MG_FEATURE_SERVICE_TRY()
 
+    CHECK_FEATURE_SOURCE_ARGUMENT(resource, L"MgdFeatureService::ApplySchema");
+    CHECKARGUMENTNULL(schema, L"MgdFeatureService::ApplySchema");
+
     MG_LOG_OPERATION_MESSAGE_INIT(MG_API_VERSION(1, 0, 0), 2);
     MG_LOG_OPERATION_MESSAGE_PARAMETERS_START();
     MG_LOG_OPERATION_MESSAGE_ADD_STRING((NULL == resource) ? L"MgResourceIdentifier" : resource->ToString().c_str());
@@ -283,9 +286,6 @@
 
     MG_LOG_TRACE_ENTRY(L"MgdFeatureService::ApplySchema()");
 
-    CHECK_FEATURE_SOURCE_ARGUMENT(resource, L"MgdFeatureService::ApplySchema");
-    CHECKARGUMENTNULL(schema, L"MgdFeatureService::ApplySchema");
-
     MgApplySchema apply;
     apply.ApplySchema(resource, schema);
 
@@ -316,7 +316,9 @@
     MG_LOG_OPERATION_MESSAGE(L"DescribeSchema");
 
     MG_FEATURE_SERVICE_TRY()
-
+    
+    CHECK_FEATURE_SOURCE_ARGUMENT(resource, L"MgdFeatureService::DescribeSchema");
+    
     MG_LOG_OPERATION_MESSAGE_INIT(MG_API_VERSION(1, 0, 0), 3);
     MG_LOG_OPERATION_MESSAGE_PARAMETERS_START();
     MG_LOG_OPERATION_MESSAGE_ADD_STRING((NULL == resource) ? L"MgResourceIdentifier" : resource->ToString().c_str());
@@ -423,6 +425,8 @@
 
     MG_FEATURE_SERVICE_TRY()
 
+    CHECK_FEATURE_SOURCE_ARGUMENT(resource, L"MgdFeatureService::DescribeSchema");
+
     MG_LOG_OPERATION_MESSAGE_INIT(MG_API_VERSION(1, 0, 0), 2);
     MG_LOG_OPERATION_MESSAGE_PARAMETERS_START();
     MG_LOG_OPERATION_MESSAGE_ADD_STRING((NULL == resource) ? L"MgResourceIdentifier" : resource->ToString().c_str());
@@ -464,6 +468,8 @@
 
     MG_FEATURE_SERVICE_TRY()
 
+    CHECK_FEATURE_SOURCE_ARGUMENT(resource, L"MgdFeatureService::DescribeSchemaAsXml");
+
     MG_LOG_OPERATION_MESSAGE_INIT(MG_API_VERSION(1, 0, 0), 3);
     MG_LOG_OPERATION_MESSAGE_PARAMETERS_START();
     MG_LOG_OPERATION_MESSAGE_ADD_STRING((NULL == resource) ? L"MgResourceIdentifier" : resource->ToString().c_str());
@@ -475,8 +481,6 @@
 
     MG_LOG_TRACE_ENTRY(L"MgdFeatureService::DescribeSchemaAsXml()");
 
-	CHECK_FEATURE_SOURCE_ARGUMENT(resource, L"MgdFeatureService::DescribeSchemaAsXml");
-
     MgDescribeSchema describe;
     describe.DescribeSchemaAsXml(resource, schemaName, classNames);
 
@@ -508,6 +512,8 @@
 
     MG_FEATURE_SERVICE_TRY()
 
+    CHECK_FEATURE_SOURCE_ARGUMENT(resource, L"MgdFeatureService:DescribeSchemaAsXml");
+
     MG_LOG_OPERATION_MESSAGE_INIT(MG_API_VERSION(1, 0, 0), 2);
     MG_LOG_OPERATION_MESSAGE_PARAMETERS_START();
     MG_LOG_OPERATION_MESSAGE_ADD_STRING((NULL == resource) ? L"MgResourceIdentifier" : resource->ToString().c_str());
@@ -626,6 +632,8 @@
 
     MG_FEATURE_SERVICE_TRY()
 
+    CHECK_FEATURE_SOURCE_ARGUMENT(resource, L"MgdFeatureService::SelectFeatures");
+
     MG_LOG_OPERATION_MESSAGE_INIT(MG_API_VERSION(1, 0, 0), 3);
     MG_LOG_OPERATION_MESSAGE_PARAMETERS_START();
     MG_LOG_OPERATION_MESSAGE_ADD_STRING((NULL == resource) ? L"MgResourceIdentifier" : resource->ToString().c_str());
@@ -675,6 +683,8 @@
 
     MG_FEATURE_SERVICE_TRY()
 
+    CHECK_FEATURE_SOURCE_ARGUMENT(resource, L"MgdFeatureService::SelectFeatures");
+
     MG_LOG_OPERATION_MESSAGE_INIT(MG_API_VERSION(1, 0, 0), 4);
     MG_LOG_OPERATION_MESSAGE_PARAMETERS_START();
     MG_LOG_OPERATION_MESSAGE_ADD_STRING((NULL == resource) ? L"MgResourceIdentifier" : resource->ToString().c_str());
@@ -771,6 +781,8 @@
 
     MG_FEATURE_SERVICE_TRY()
 
+    CHECK_FEATURE_SOURCE_ARGUMENT(resource, L"MgdFeatureService::SelectFeatureExtended");
+
     MG_LOG_OPERATION_MESSAGE_INIT(MG_API_VERSION(1, 0, 0), 3);
     MG_LOG_OPERATION_MESSAGE_PARAMETERS_START();
     MG_LOG_OPERATION_MESSAGE_ADD_STRING((NULL == resource) ? L"MgResourceIdentifier" : resource->ToString().c_str());
@@ -821,6 +833,9 @@
 
     MG_FEATURE_SERVICE_TRY()
 
+    CHECK_FEATURE_SOURCE_ARGUMENT(resource, L"MgdFeatureService::SelectAggregate");
+	CHECKARGUMENTNULL(options, L"MgdFeatureService::SelectAggregate");
+
     MG_LOG_OPERATION_MESSAGE_INIT(MG_API_VERSION(1, 0, 0), 3);
     MG_LOG_OPERATION_MESSAGE_PARAMETERS_START();
     MG_LOG_OPERATION_MESSAGE_ADD_STRING((NULL == resource) ? L"MgResourceIdentifier" : resource->ToString().c_str());
@@ -836,9 +851,6 @@
     logDetail.AddObject(L"Options", options);
     logDetail.Create();
 
-	CHECK_FEATURE_SOURCE_ARGUMENT(resource, L"MgdFeatureService::SelectAggregate");
-	CHECKARGUMENTNULL(options, L"MgdFeatureService::SelectAggregate");
-    
     MgSelectFeatures select;
     reader = dynamic_cast<MgDataReader*>(select.SelectFeatures(resource, className, options, true));
     CHECKNULL(reader.p, L"MgdFeatureService::SelectAggregate");
@@ -872,6 +884,9 @@
 
     MG_FEATURE_SERVICE_TRY()
 
+    CHECK_FEATURE_SOURCE_ARGUMENT(resource, L"MgdFeatureService::UpdateFeatures");
+    CHECKARGUMENTNULL(commands, L"MgdFeatureService::UpdateFeatures");
+
     MG_LOG_OPERATION_MESSAGE_INIT(MG_API_VERSION(1, 0, 0), 3);
     MG_LOG_OPERATION_MESSAGE_PARAMETERS_START();
     MG_LOG_OPERATION_MESSAGE_ADD_STRING((NULL == resource) ? L"MgResourceIdentifier" : resource->ToString().c_str());
@@ -883,9 +898,6 @@
 
     MG_LOG_TRACE_ENTRY(L"MgdFeatureService::UpdateFeatures()");
 
-	CHECK_FEATURE_SOURCE_ARGUMENT(resource, L"MgdFeatureService::UpdateFeatures");
-    CHECKARGUMENTNULL(commands, L"MgdFeatureService::UpdateFeatures");
-
     MgUpdateFeaturesCommand cmd;
     result = cmd.Execute(resource, commands, useTransaction);
 
@@ -918,6 +930,8 @@
 
     MG_FEATURE_SERVICE_TRY()
 
+    CHECK_FEATURE_SOURCE_ARGUMENT(resource, L"MgdFeatureService::UpdateFeatures");
+
     MG_LOG_OPERATION_MESSAGE_INIT(MG_API_VERSION(1, 0, 0), 3);
     MG_LOG_OPERATION_MESSAGE_PARAMETERS_START();
     MG_LOG_OPERATION_MESSAGE_ADD_STRING((NULL == resource) ? L"MgResourceIdentifier" : resource->ToString().c_str());
@@ -962,6 +976,8 @@
 
     MG_FEATURE_SERVICE_TRY()
 
+    CHECK_FEATURE_SOURCE_ARGUMENT(resource, L"MgdFeatureService::InsertFeatures");
+
     MG_LOG_OPERATION_MESSAGE_INIT(MG_API_VERSION(1, 0, 0), 3);
     MG_LOG_OPERATION_MESSAGE_PARAMETERS_START();
     MG_LOG_OPERATION_MESSAGE_ADD_STRING((NULL == resource) ? L"MgResourceIdentifier" : resource->ToString().c_str());
@@ -1003,6 +1019,8 @@
 
     MG_FEATURE_SERVICE_TRY()
 
+    CHECK_FEATURE_SOURCE_ARGUMENT(resource, L"MgdFeatureService::InsertFeatures");
+
     MG_LOG_OPERATION_MESSAGE_INIT(MG_API_VERSION(1, 0, 0), 4);
     MG_LOG_OPERATION_MESSAGE_PARAMETERS_START();
     MG_LOG_OPERATION_MESSAGE_ADD_STRING((NULL == resource) ? L"MgResourceIdentifier" : resource->ToString().c_str());
@@ -1046,6 +1064,8 @@
 
     MG_FEATURE_SERVICE_TRY()
 
+    CHECK_FEATURE_SOURCE_ARGUMENT(resource, L"MgdFeatureService::InsertFeatures");
+
     MG_LOG_OPERATION_MESSAGE_INIT(MG_API_VERSION(1, 0, 0), 3);
     MG_LOG_OPERATION_MESSAGE_PARAMETERS_START();
     MG_LOG_OPERATION_MESSAGE_ADD_STRING((NULL == resource) ? L"MgResourceIdentifier" : resource->ToString().c_str());
@@ -1086,6 +1106,8 @@
 
     MG_FEATURE_SERVICE_TRY()
 
+    CHECK_FEATURE_SOURCE_ARGUMENT(resource, L"MgdFeatureService::InsertFeatures");
+
     MG_LOG_OPERATION_MESSAGE_INIT(MG_API_VERSION(1, 0, 0), 4);
     MG_LOG_OPERATION_MESSAGE_PARAMETERS_START();
     MG_LOG_OPERATION_MESSAGE_ADD_STRING((NULL == resource) ? L"MgResourceIdentifier" : resource->ToString().c_str());
@@ -1128,6 +1150,8 @@
 
     MG_FEATURE_SERVICE_TRY()
 
+    CHECK_FEATURE_SOURCE_ARGUMENT(resource, L"MgdFeatureService::UpdateFeatures");
+
     MG_LOG_OPERATION_MESSAGE_INIT(MG_API_VERSION(1, 0, 0), 4);
     MG_LOG_OPERATION_MESSAGE_PARAMETERS_START();
     MG_LOG_OPERATION_MESSAGE_ADD_STRING((NULL == resource) ? L"MgResourceIdentifier" : resource->ToString().c_str());
@@ -1169,6 +1193,8 @@
 
     MG_FEATURE_SERVICE_TRY()
 
+    CHECK_FEATURE_SOURCE_ARGUMENT(resource, L"MgdFeatureService::UpdateFeatures");
+
     MG_LOG_OPERATION_MESSAGE_INIT(MG_API_VERSION(1, 0, 0), 5);
     MG_LOG_OPERATION_MESSAGE_PARAMETERS_START();
     MG_LOG_OPERATION_MESSAGE_ADD_STRING((NULL == resource) ? L"MgResourceIdentifier" : resource->ToString().c_str());
@@ -1214,6 +1240,8 @@
 
     MG_FEATURE_SERVICE_TRY()
 
+    CHECK_FEATURE_SOURCE_ARGUMENT(resource, L"MgdFeatureService::DeleteFeatures");
+
     MG_LOG_OPERATION_MESSAGE_INIT(MG_API_VERSION(1, 0, 0), 3);
     MG_LOG_OPERATION_MESSAGE_PARAMETERS_START();
     MG_LOG_OPERATION_MESSAGE_ADD_STRING((NULL == resource) ? L"MgResourceIdentifier" : resource->ToString().c_str());
@@ -1254,6 +1282,8 @@
 
     MG_FEATURE_SERVICE_TRY()
 
+    CHECK_FEATURE_SOURCE_ARGUMENT(resource, L"MgdFeatureService::DeleteFeatures");
+
     MG_LOG_OPERATION_MESSAGE_INIT(MG_API_VERSION(1, 0, 0), 4);
     MG_LOG_OPERATION_MESSAGE_PARAMETERS_START();
     MG_LOG_OPERATION_MESSAGE_ADD_STRING((NULL == resource) ? L"MgResourceIdentifier" : resource->ToString().c_str());
@@ -1296,6 +1326,8 @@
 
     MG_FEATURE_SERVICE_TRY()
 
+    CHECK_FEATURE_SOURCE_ARGUMENT(resource, L"MgdFeatureService::PurgeCache");
+
     MG_LOG_OPERATION_MESSAGE_INIT(MG_API_VERSION(1, 0, 0), 1);
     MG_LOG_OPERATION_MESSAGE_PARAMETERS_START();
     MG_LOG_OPERATION_MESSAGE_ADD_STRING((NULL == resource) ? L"MgResourceIdentifier" : resource->ToString().c_str());
@@ -1334,6 +1366,8 @@
 
     MG_FEATURE_SERVICE_TRY()
 
+    CHECK_FEATURE_SOURCE_ARGUMENT(resource, L"MgdFeatureService::GetLockedFeatures");
+
     MG_LOG_OPERATION_MESSAGE_INIT(MG_API_VERSION(1, 0, 0), 3);
     MG_LOG_OPERATION_MESSAGE_PARAMETERS_START();
     MG_LOG_OPERATION_MESSAGE_ADD_STRING((NULL == resource) ? L"MgResourceIdentifier" : resource->ToString().c_str());
@@ -1376,6 +1410,8 @@
 
     MG_FEATURE_SERVICE_TRY()
 
+    CHECK_FEATURE_SOURCE_ARGUMENT(resource, L"MgdFeatureService::BeginTransaction");
+
     MG_LOG_OPERATION_MESSAGE_INIT(MG_API_VERSION(1, 0, 0), 1);
     MG_LOG_OPERATION_MESSAGE_PARAMETERS_START();
     MG_LOG_OPERATION_MESSAGE_ADD_STRING((NULL == resource) ? L"MgResourceIdentifier" : resource->ToString().c_str());
@@ -1383,8 +1419,6 @@
 
     MG_LOG_TRACE_ENTRY(L"MgdFeatureService::BeginTransaction()");
 
-	CHECK_FEATURE_SOURCE_ARGUMENT(resource, L"MgdFeatureService::BeginTransaction");
-
     Ptr<MgFeatureConnection> conn = new MgFeatureConnection(resource);
     trans = new MgdTransaction(conn, resource);
 
@@ -1415,6 +1449,10 @@
 
     MG_FEATURE_SERVICE_TRY()
 
+    CHECK_FEATURE_SOURCE_ARGUMENT(resource, L"MgdFeatureService::ExecuteSqlQuery");
+    if (sqlStatement.empty())
+        throw new MgInvalidArgumentException(L"MgdFeatureService::ExecuteSqlQuery", __LINE__, __WFILE__, NULL, L"", NULL);
+
     MG_LOG_OPERATION_MESSAGE_INIT(MG_API_VERSION(1, 0, 0), 2);
     MG_LOG_OPERATION_MESSAGE_PARAMETERS_START();
     MG_LOG_OPERATION_MESSAGE_ADD_STRING((NULL == resource) ? L"MgResourceIdentifier" : resource->ToString().c_str());
@@ -1424,10 +1462,6 @@
 
     MG_LOG_TRACE_ENTRY(L"MgdFeatureService::ExecuteSqlQuery()");
 
-	CHECK_FEATURE_SOURCE_ARGUMENT(resource, L"MgdFeatureService::ExecuteSqlQuery");
-    if (sqlStatement.empty())
-        throw new MgInvalidArgumentException(L"MgdFeatureService::ExecuteSqlQuery", __LINE__, __WFILE__, NULL, L"", NULL);
-
 	MgSqlCommand cmd;
     reader = cmd.ExecuteQuery(resource, sqlStatement, NULL, NULL);
 
@@ -1461,6 +1495,8 @@
 
     MG_FEATURE_SERVICE_TRY()
 
+    CHECK_FEATURE_SOURCE_ARGUMENT(resource, L"MgdFeatureService::ExecuteSqlQuery");
+
     MG_LOG_OPERATION_MESSAGE_INIT(MG_API_VERSION(1, 0, 0), 4);
     MG_LOG_OPERATION_MESSAGE_PARAMETERS_START();
     MG_LOG_OPERATION_MESSAGE_ADD_STRING((NULL == resource) ? L"MgResourceIdentifier" : resource->ToString().c_str());
@@ -1529,6 +1565,10 @@
 
     MG_FEATURE_SERVICE_TRY()
 
+    CHECK_FEATURE_SOURCE_ARGUMENT(resource, L"MgdFeatureService::ExecuteSqlNonQuery");
+    if (sqlNonSelectStatement.empty())
+        throw new MgInvalidArgumentException(L"MgdFeatureService::ExecuteSqlNonQuery", __LINE__, __WFILE__, NULL, L"", NULL);
+
     MG_LOG_OPERATION_MESSAGE_INIT(MG_API_VERSION(1, 0, 0), 4);
     MG_LOG_OPERATION_MESSAGE_PARAMETERS_START();
     MG_LOG_OPERATION_MESSAGE_ADD_STRING((NULL == resource) ? L"MgResourceIdentifier" : resource->ToString().c_str());
@@ -1542,10 +1582,6 @@
 
     MG_LOG_TRACE_ENTRY(L"MgdFeatureService::ExecuteSqlNonQuery()");
 
-    CHECK_FEATURE_SOURCE_ARGUMENT(resource, L"MgdFeatureService::ExecuteSqlNonQuery");
-    if (sqlNonSelectStatement.empty())
-        throw new MgInvalidArgumentException(L"MgdFeatureService::ExecuteSqlNonQuery", __LINE__, __WFILE__, NULL, L"", NULL);
-
     CHECKARGUMENTNULL(params, L"MgdFeatureService::ExecuteSqlQuery");
     CHECKARGUMENTNULL(trans, L"MgdFeatureService::ExecuteSqlQuery");
 
@@ -1579,6 +1615,10 @@
 
     MG_FEATURE_SERVICE_TRY()
 
+    CHECK_FEATURE_SOURCE_ARGUMENT(resource, L"MgdFeatureService::ExecuteSqlNonQuery");
+    if (sqlNonSelectStatement.empty())
+        throw new MgInvalidArgumentException(L"MgdFeatureService::ExecuteSqlNonQuery", __LINE__, __WFILE__, NULL, L"", NULL);
+
     MG_LOG_OPERATION_MESSAGE_INIT(MG_API_VERSION(1, 0, 0), 2);
     MG_LOG_OPERATION_MESSAGE_PARAMETERS_START();
     MG_LOG_OPERATION_MESSAGE_ADD_STRING((NULL == resource) ? L"MgResourceIdentifier" : resource->ToString().c_str());
@@ -1588,10 +1628,6 @@
 
     MG_LOG_TRACE_ENTRY(L"MgdFeatureService::ExecuteSqlNonQuery()");
 
-	CHECK_FEATURE_SOURCE_ARGUMENT(resource, L"MgdFeatureService::ExecuteSqlNonQuery");
-    if (sqlNonSelectStatement.empty())
-        throw new MgInvalidArgumentException(L"MgdFeatureService::ExecuteSqlNonQuery", __LINE__, __WFILE__, NULL, L"", NULL);
-
     MgSqlCommand cmd;
     ret = cmd.ExecuteNonQuery(resource, sqlNonSelectStatement, NULL, NULL);
 
@@ -1622,6 +1658,8 @@
 
     MG_FEATURE_SERVICE_TRY()
 
+    CHECK_FEATURE_SOURCE_ARGUMENT(resId, L"MgdResourceService::GetSpatialContext");
+
     MG_LOG_OPERATION_MESSAGE_INIT(MG_API_VERSION(1, 0, 0), 2);
     MG_LOG_OPERATION_MESSAGE_PARAMETERS_START();
     MG_LOG_OPERATION_MESSAGE_ADD_STRING((NULL == resId) ? L"MgResourceIdentifier" : resId->ToString().c_str());
@@ -1666,6 +1704,8 @@
     MG_LOG_OPERATION_MESSAGE(L"GetLongTransactions");
 
     MG_FEATURE_SERVICE_TRY()
+    
+    CHECK_FEATURE_SOURCE_ARGUMENT(resource, L"MgdFeatureService::GetLongTransactions");
 
     MG_LOG_OPERATION_MESSAGE_INIT(MG_API_VERSION(1, 0, 0), 2);
     MG_LOG_OPERATION_MESSAGE_PARAMETERS_START();
@@ -1674,8 +1714,6 @@
     MG_LOG_OPERATION_MESSAGE_ADD_BOOL(bActiveOnly);
     MG_LOG_OPERATION_MESSAGE_PARAMETERS_END();
 
-	CHECK_FEATURE_SOURCE_ARGUMENT(resource, L"MgdFeatureService::GetLongTransactions");
-	
     MgGetLongTransactions getTrans;
     reader = getTrans.GetLongTransactions(resource, bActiveOnly);
 
@@ -1706,6 +1744,10 @@
 
     MG_FEATURE_SERVICE_TRY()
 
+    CHECK_FEATURE_SOURCE_ARGUMENT(resource, L"MgdFeatureService::SetLongTransaction");
+    if (longTransactionName.empty())
+        throw new MgNullArgumentException(L"MgdFeatureService::SetLongTransaction", __LINE__, __WFILE__, NULL, L"", NULL);
+
     MG_LOG_OPERATION_MESSAGE_INIT(MG_API_VERSION(1, 0, 0), 2);
     MG_LOG_OPERATION_MESSAGE_PARAMETERS_START();
     MG_LOG_OPERATION_MESSAGE_ADD_STRING((NULL == resource) ? L"MgResourceIdentifier" : resource->ToString().c_str());
@@ -1713,10 +1755,6 @@
     MG_LOG_OPERATION_MESSAGE_ADD_STRING(longTransactionName.c_str());
     MG_LOG_OPERATION_MESSAGE_PARAMETERS_END();
 
-	CHECK_FEATURE_SOURCE_ARGUMENT(resource, L"MgdFeatureService::SetLongTransaction");
-    if (longTransactionName.empty())
-        throw new MgNullArgumentException(L"MgdFeatureService::SetLongTransaction", __LINE__, __WFILE__, NULL, L"", NULL);
-
 	Ptr<MgFeatureConnection> connWrap = new MgFeatureConnection(resource);
 	FdoPtr<FdoIConnection> conn = connWrap->GetConnection();
 	FdoPtr<FdoIActivateLongTransaction> activate = (FdoIActivateLongTransaction*)conn->CreateCommand(FdoCommandType_ActivateLongTransaction);
@@ -1751,13 +1789,13 @@
 
     MG_FEATURE_SERVICE_TRY()
 
+    CHECK_FEATURE_SOURCE_ARGUMENT(resource, L"MgdFeatureService::GetSchemas");
+
     MG_LOG_OPERATION_MESSAGE_INIT(MG_API_VERSION(1, 0, 0), 1);
     MG_LOG_OPERATION_MESSAGE_PARAMETERS_START();
     MG_LOG_OPERATION_MESSAGE_ADD_STRING((NULL == resource) ? L"MgResourceIdentifier" : resource->ToString().c_str());
     MG_LOG_OPERATION_MESSAGE_PARAMETERS_END();
 
-	CHECK_FEATURE_SOURCE_ARGUMENT(resource, L"MgdFeatureService::GetSchemas");
-
     MgDescribeSchema describe;
     schemaNames = describe.GetSchemas(resource);
 
@@ -1787,6 +1825,8 @@
     MG_LOG_OPERATION_MESSAGE(L"GetClasses");
 
     MG_FEATURE_SERVICE_TRY()
+    
+    CHECK_FEATURE_SOURCE_ARGUMENT(resource, L"MgdFeatureService::GetClasses");
 
     MG_LOG_OPERATION_MESSAGE_INIT(MG_API_VERSION(1, 0, 0), 2);
     MG_LOG_OPERATION_MESSAGE_PARAMETERS_START();
@@ -1795,8 +1835,6 @@
     MG_LOG_OPERATION_MESSAGE_ADD_STRING(schemaName.c_str());
     MG_LOG_OPERATION_MESSAGE_PARAMETERS_END();
 
-	CHECK_FEATURE_SOURCE_ARGUMENT(resource, L"MgdFeatureService::GetClasses");
-	
     MgDescribeSchema describe;
     classNames = describe.GetClasses(resource, schemaName);
 
@@ -1829,6 +1867,8 @@
 
     MG_FEATURE_SERVICE_TRY()
 
+    CHECK_FEATURE_SOURCE_ARGUMENT(resource, L"MgdFeatureService::GetClassDefinition");
+
     MG_LOG_OPERATION_MESSAGE_INIT(MG_API_VERSION(1, 0, 0), 3);
     MG_LOG_OPERATION_MESSAGE_PARAMETERS_START();
     MG_LOG_OPERATION_MESSAGE_ADD_STRING((NULL == resource) ? L"MgResourceIdentifier" : resource->ToString().c_str());
@@ -1898,6 +1938,9 @@
 
     MG_FEATURE_SERVICE_TRY()
 
+    CHECK_FEATURE_SOURCE_ARGUMENT(resource, L"MgdFeatureService::CreateFeatureSource");
+    CHECKARGUMENTNULL(sourceParams, L"MgdFeatureService::CreateFeatureSource");
+
     MG_LOG_OPERATION_MESSAGE_INIT(MG_API_VERSION(1, 0, 0), 2);
     MG_LOG_OPERATION_MESSAGE_PARAMETERS_START();
     MG_LOG_OPERATION_MESSAGE_ADD_STRING((NULL == resource) ? L"MgResourceIdentifier" : resource->ToString().c_str());
@@ -1905,9 +1948,6 @@
     MG_LOG_OPERATION_MESSAGE_ADD_STRING(L"MgFeatureSourceParams");
     MG_LOG_OPERATION_MESSAGE_PARAMETERS_END();
 
-    CHECK_FEATURE_SOURCE_ARGUMENT(resource, L"MgdFeatureService::CreateFeatureSource");
-    CHECKARGUMENTNULL(sourceParams, L"MgdFeatureService::CreateFeatureSource");
-
     Ptr<MgCreateFeatureSource> creator = new MgCreateFeatureSource();
     creator->CreateFeatureSource(resource, sourceParams);
 
@@ -2138,6 +2178,8 @@
 
     MG_FEATURE_SERVICE_TRY()
 
+    CHECK_FEATURE_SOURCE_ARGUMENT(resource, L"MgdFeatureService::GetIdentityProperties");
+
     MG_LOG_OPERATION_MESSAGE_INIT(MG_API_VERSION(1, 0, 0), 3);
     MG_LOG_OPERATION_MESSAGE_PARAMETERS_START();
     MG_LOG_OPERATION_MESSAGE_ADD_STRING((NULL == resource) ? L"MgResourceIdentifier" : resource->ToString().c_str());
@@ -2147,8 +2189,6 @@
     MG_LOG_OPERATION_MESSAGE_ADD_STRING(className.c_str());
     MG_LOG_OPERATION_MESSAGE_PARAMETERS_END();
 
-    CHECK_FEATURE_SOURCE_ARGUMENT(resource, L"MgdFeatureService::GetIdentityProperties");
-    
     MgDescribeSchema describe;
     Ptr<MgStringCollection> classNames = new MgStringCollection();
     classNames->Add(className);
@@ -2191,6 +2231,8 @@
 
     MG_FEATURE_SERVICE_TRY()
 
+    CHECK_FEATURE_SOURCE_ARGUMENT(resource, L"MgdFeatureService::GetIdentityProperties");
+
     MG_LOG_OPERATION_MESSAGE_INIT(MG_API_VERSION(1, 0, 0), 3);
     MG_LOG_OPERATION_MESSAGE_PARAMETERS_START();
     MG_LOG_OPERATION_MESSAGE_ADD_STRING((NULL == resource) ? L"MgResourceIdentifier" : resource->ToString().c_str());
@@ -2200,8 +2242,6 @@
     MG_LOG_OPERATION_MESSAGE_ADD_STRING((NULL == classNames) ? L"MgStringCollection" : classNames->GetLogString().c_str());
     MG_LOG_OPERATION_MESSAGE_PARAMETERS_END();
 
-    CHECK_FEATURE_SOURCE_ARGUMENT(resource, L"MgdFeatureService::GetIdentityProperties");
-    
     MgDescribeSchema describe;
     classDefs = describe.GetIdentityProperties(resource, schemaName, classNames);
 

Modified: branches/2.4/MgDev/Desktop/MgDesktop/System/PlatformInit.cpp
===================================================================
--- branches/2.4/MgDev/Desktop/MgDesktop/System/PlatformInit.cpp	2012-07-16 03:09:00 UTC (rev 6906)
+++ branches/2.4/MgDev/Desktop/MgDesktop/System/PlatformInit.cpp	2012-07-17 17:54:48 UTC (rev 6907)
@@ -174,16 +174,16 @@
     MG_LOG_TRACE_ENTRY(L"MgPlatform::Terminate()");
     MG_TRY()
 
-    MgFdoConnectionPool::Cleanup();
+    //MgFdoConnectionPool::Cleanup();
 
+    //This is important. Otherwise the process using this library will be left lingering
+    MgLogManager* pLogManager = MgLogManager::GetInstance();
+    pLogManager->StopLogThread();
+
     Ptr<MgServiceFactory> fact = new MgServiceFactory();;
     Ptr<MgdResourceService> resSvc = dynamic_cast<MgdResourceService*>(fact->CreateService(MgServiceType::ResourceService));
     resSvc->DeleteSessionFiles();
 
-    //This is important. Otherwise the process using this library will be left lingering
-    MgLogManager* pLogManager = MgLogManager::GetInstance();
-    pLogManager->StopLogThread();
-
     XMLPlatformUtils::Terminate();
     ACE::fini();
 

Modified: branches/2.4/MgDev/Desktop/UnitTest/TestProfilingService.cpp
===================================================================
--- branches/2.4/MgDev/Desktop/UnitTest/TestProfilingService.cpp	2012-07-16 03:09:00 UTC (rev 6906)
+++ branches/2.4/MgDev/Desktop/UnitTest/TestProfilingService.cpp	2012-07-17 17:54:48 UTC (rev 6907)
@@ -391,14 +391,6 @@
         m_svcResource->DeleteResource(mapres12);
         Ptr<MgResourceIdentifier> wdfres1 = new MgResourceIdentifier(L"Library://UnitTests/Watermarks/PoweredByMapGuide.WatermarkDefinition");
         m_svcResource->DeleteResource(wdfres1);
-
-       #ifdef _DEBUG
-        MgFdoConnectionManager* pFdoConnectionManager = MgFdoConnectionManager::GetInstance();
-        if(pFdoConnectionManager)
-        {
-            pFdoConnectionManager->ShowCache();
-        }
-        #endif
     }
     catch(MgFileIoException* e)
     {

Modified: branches/2.4/MgDev/Desktop/UnitTest/main.cpp
===================================================================
--- branches/2.4/MgDev/Desktop/UnitTest/main.cpp	2012-07-16 03:09:00 UTC (rev 6906)
+++ branches/2.4/MgDev/Desktop/UnitTest/main.cpp	2012-07-17 17:54:48 UTC (rev 6907)
@@ -27,7 +27,7 @@
 #define TEST_COORDINATE_SYSTEM  0
 #define TEST_LOG_MANAGER        1
 #define TEST_RESOURCE_SERVICE   1
-#define TEST_FEATURE_SERVICE    1
+#define TEST_FEATURE_SERVICE    0
 #define TEST_MAPPING_SERVICE    1
 #define TEST_PROFILING_SERVICE  1
 #define TEST_RENDERING_SERVICE  1



More information about the mapguide-commits mailing list