[mapguide-commits] r1383 - in trunk/MgDev/Server/src: Common/Manager Services/Resource UnitTesting

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Tue Mar 27 13:21:14 EDT 2007


Author: brucedechant
Date: 2007-03-27 13:21:14 -0400 (Tue, 27 Mar 2007)
New Revision: 1383

Modified:
   trunk/MgDev/Server/src/Common/Manager/FdoConnectionManager.cpp
   trunk/MgDev/Server/src/Common/Manager/ServiceManager.cpp
   trunk/MgDev/Server/src/Services/Resource/ResourceContentManager.cpp
   trunk/MgDev/Server/src/Services/Resource/ServerResourceService.cpp
   trunk/MgDev/Server/src/UnitTesting/TestCoordinateSystem.cpp
Log:
Update to feature source and FDO connection caching.

Modified: trunk/MgDev/Server/src/Common/Manager/FdoConnectionManager.cpp
===================================================================
--- trunk/MgDev/Server/src/Common/Manager/FdoConnectionManager.cpp	2007-03-27 16:39:53 UTC (rev 1382)
+++ trunk/MgDev/Server/src/Common/Manager/FdoConnectionManager.cpp	2007-03-27 17:21:14 UTC (rev 1383)
@@ -1042,19 +1042,6 @@
                                 SAFE_RELEASE(e);
                             }
 
-                            // Remove Feature Source cache entry
-                            FeatureSourceCache::iterator iterFeatureSource = m_FeatureSourceCache.find(key);
-                            if(m_FeatureSourceCache.end() != iterFeatureSource)
-                            {
-                                MdfModel::FeatureSource* featureSource = iterFeatureSource->second;
-                                if(featureSource)
-                                {
-                                    delete featureSource;
-                                }
-
-                                m_FeatureSourceCache.erase(iterFeatureSource);
-                            }
-
                             fdoConnectionCache->erase(iter++);
 
                             connectionsRemoved++;
@@ -1088,6 +1075,19 @@
         iterFdoConnectionCacheCollection++;
     }
 
+    // Remove Feature Source cache entry
+    FeatureSourceCache::iterator iterFeatureSource = m_FeatureSourceCache.find(key);
+    if(m_FeatureSourceCache.end() != iterFeatureSource)
+    {
+        MdfModel::FeatureSource* featureSource = iterFeatureSource->second;
+        if(featureSource)
+        {
+            delete featureSource;
+        }
+
+        m_FeatureSourceCache.erase(iterFeatureSource);
+    }
+
     MG_FDOCONNECTION_MANAGER_CATCH_AND_THROW(L"MgFdoConnectionManager.RemoveCachedFdoConnection")
 
     return (connections == connectionsRemoved);

Modified: trunk/MgDev/Server/src/Common/Manager/ServiceManager.cpp
===================================================================
--- trunk/MgDev/Server/src/Common/Manager/ServiceManager.cpp	2007-03-27 16:39:53 UTC (rev 1382)
+++ trunk/MgDev/Server/src/Common/Manager/ServiceManager.cpp	2007-03-27 17:21:14 UTC (rev 1383)
@@ -392,6 +392,15 @@
 ///
 void MgServiceManager::NotifyResourcesChanged(MgSerializableCollection* resources)
 {
+    // Remove the Feature Service cache entries associated with the changed resources
+    Ptr<MgServerFeatureService> featureService = dynamic_cast<MgServerFeatureService*>(
+        RequestLocalService(MgServiceType::FeatureService));
+
+    if (featureService != NULL)
+    {
+        featureService->RemoveFeatureServiceCacheEntries(resources);
+    }
+
     if (m_loadBalanceManager->m_localServerInfo->IsServiceEnabled(
         MgServiceType::TileService))
     {
@@ -433,15 +442,6 @@
                 resourceService->EnumerateParentMapDefinitions(changedResources);
 
             m_loadBalanceManager->DispatchResourceChangeNotifications(changedMaps);
-
-            // Remove the Feature Service cache entries associated with the changed resources
-            Ptr<MgServerFeatureService> featureService = dynamic_cast<MgServerFeatureService*>(
-                RequestLocalService(MgServiceType::FeatureService));
-
-            if (featureService != NULL)
-            {
-                featureService->RemoveFeatureServiceCacheEntries(changedResources);
-            }
         }
     }
 

Modified: trunk/MgDev/Server/src/Services/Resource/ResourceContentManager.cpp
===================================================================
--- trunk/MgDev/Server/src/Services/Resource/ResourceContentManager.cpp	2007-03-27 16:39:53 UTC (rev 1382)
+++ trunk/MgDev/Server/src/Services/Resource/ResourceContentManager.cpp	2007-03-27 17:21:14 UTC (rev 1383)
@@ -266,9 +266,6 @@
     const size_t sourcePathLength = sourcePathname.length();
     XmlValue xmlValue;
 
-    MgFdoConnectionManager* fdoConnectionManager = MgFdoConnectionManager::GetInstance();
-    ACE_ASSERT(NULL != fdoConnectionManager);
-
     while (results.next(xmlValue))
     {
         XmlDocument currDoc = xmlValue.asDocument();
@@ -277,28 +274,6 @@
 
         CheckParentPermission(currResource, MgResourcePermission::ReadWrite);
 
-        STRING resourceType = currResource.GetResourceType();
-        if(MgResourceType::FeatureSource == resourceType)
-        {
-            // Need to check the FDO connection manager to see if there is a cached
-            // connection to this data and remove it if possible.
-            // If there is and it is not in use then we can remove it from the cache
-            // and allow the copy.
-            if (NULL != fdoConnectionManager)
-            {
-                if(!fdoConnectionManager->RemoveCachedFdoConnection(currResource.ToString()))
-                {
-                    // Could not remove the cached FDO connection because it is in use.
-                    MgStringCollection arguments;
-                    arguments.Add(currResource.ToString());
-
-                    throw new MgResourceBusyException(
-                        L"MgResourceContentManager.MoveResource",
-                        __LINE__, __WFILE__, &arguments, L"", NULL);
-                }
-            }
-        }
-
         if (sourceResourceIsFolder)
         {
             currPathname.replace(0, sourcePathLength, destPathname);
@@ -436,9 +411,6 @@
     const size_t sourcePathLength = sourcePathname.length();
     XmlValue xmlValue;
 
-    MgFdoConnectionManager* fdoConnectionManager = MgFdoConnectionManager::GetInstance();
-    ACE_ASSERT(NULL != fdoConnectionManager);
-
     while (results.next(xmlValue))
     {
         const XmlDocument& currDoc = xmlValue.asDocument();
@@ -447,28 +419,6 @@
 
         sourceResourceContentMan->CheckPermission(currResource, MgResourcePermission::ReadOnly);
 
-        STRING resourceType = currResource.GetResourceType();
-        if(MgResourceType::FeatureSource == resourceType)
-        {
-            // Need to check the FDO connection manager to see if there is a cached
-            // connection to this data and remove it if possible.
-            // If there is and it is not in use then we can remove it from the cache
-            // and allow the copy.
-            if (NULL != fdoConnectionManager)
-            {
-                if(!fdoConnectionManager->RemoveCachedFdoConnection(currResource.ToString()))
-                {
-                    // Could not remove the cached FDO connection because it is in use.
-                    MgStringCollection arguments;
-                    arguments.Add(currResource.ToString());
-
-                    throw new MgResourceBusyException(
-                        L"MgResourceContentManager.CopyResource",
-                        __LINE__, __WFILE__, &arguments, L"", NULL);
-                }
-            }
-        }
-
         if (sourceResourceIsFolder)
         {
             currPathname.replace(0, sourcePathLength, destPathname);

Modified: trunk/MgDev/Server/src/Services/Resource/ServerResourceService.cpp
===================================================================
--- trunk/MgDev/Server/src/Services/Resource/ServerResourceService.cpp	2007-03-27 16:39:53 UTC (rev 1382)
+++ trunk/MgDev/Server/src/Services/Resource/ServerResourceService.cpp	2007-03-27 17:21:14 UTC (rev 1383)
@@ -2192,9 +2192,26 @@
     {
         ACE_MT(ACE_GUARD(ACE_Recursive_Thread_Mutex, ace_mon, sm_mutex));
 
+        // Need to clear the FDO connection cache
+        MgFdoConnectionManager* fdoConnectionManager = MgFdoConnectionManager::GetInstance();
+        ACE_ASSERT(NULL != fdoConnectionManager);
+
         for (set<STRING>::const_iterator i = resources.begin(); 
             i != resources.end(); ++i)
         {
+            Ptr<MgResourceIdentifier> resource = new MgResourceIdentifier(*i);
+
+            STRING resourceType = resource->GetResourceType();
+            if(MgResourceType::FeatureSource == resourceType)
+            {
+                // Need to check the FDO connection manager to see if there is a cached
+                // connection to this data and remove it if possible.
+                if (NULL != fdoConnectionManager)
+                {
+                    fdoConnectionManager->RemoveCachedFdoConnection(*i);
+                }
+            }
+
             sm_changedResources.insert(*i);
         }
     }

Modified: trunk/MgDev/Server/src/UnitTesting/TestCoordinateSystem.cpp
===================================================================
--- trunk/MgDev/Server/src/UnitTesting/TestCoordinateSystem.cpp	2007-03-27 16:39:53 UTC (rev 1382)
+++ trunk/MgDev/Server/src/UnitTesting/TestCoordinateSystem.cpp	2007-03-27 17:21:14 UTC (rev 1383)
@@ -46,7 +46,7 @@
 const STRING Projected_UTM18_NAD83 = L"PROJCS[\"UTM Zone 18, Northern Hemisphere\",GEOGCS[\"GRS 1980(IUGG, 1980)\",DATUM[\"unknown\",SPHEROID[\"GRS80\",6378137,298.257222101]],PRIMEM[\"Greenwich\",0],UNIT[\"degree\",0.0174532925199433]],PROJECTION[\"Transverse_Mercator\"],PARAMETER[\"latitude_of_origin\",0],PARAMETER[\"central_meridian\",-75],PARAMETER[\"scale_factor\",0.9996],PARAMETER[\"false_easting\",500000],PARAMETER[\"false_northing\",0],UNIT[\"Meter\",1]]";
 
 const STRING EPSG_4326_Wkt     = L"GEOGCS[\"WGS 84\",DATUM[\"WGS_1984\",SPHEROID[\"WGS 84\",6378137,298.257223563,AUTHORITY[\"EPSG\",\"7030\"]],TOWGS84[0,0,0,0,0,0,0],AUTHORITY[\"EPSG\",\"6326\"]],PRIMEM[\"Greenwich\",0,AUTHORITY[\"EPSG\",\"8901\"]],UNIT[\"degree\",0.0174532925199433,AUTHORITY[\"EPSG\",\"9108\"]],AXIS[\"Lat\",NORTH],AXIS[\"Long\",EAST],AUTHORITY[\"EPSG\",\"4326\"]]";
-const STRING EPSG_4326_Wkt_Alt = L"GEOGCS[\"WGS 84\",DATUM[\"WGS_1984\",SPHEROID[\"WGS 84\",6378137,298.257223563,AUTHORITY[\"EPSG\",\"7030\"]],TOWGS84[0,0,0,0,0,0,0],AUTHORITY[\"EPSG\",\"6326\"]],PRIMEM[\"Greenwich\",0,AUTHORITY[\"EPSG\",\"8901\"]],UNIT[\"degree\",0.01745329251994328,AUTHORITY[\"EPSG\",\"9122\"]],AUTHORITY[\"EPSG\",\"4326\"]]";
+const STRING EPSG_4326_Wkt_Alt = L"GEOGCS[\"WGS 84\",DATUM[\"WGS_1984\",SPHEROID[\"WGS 84\",6378137,298.257223563,AUTHORITY[\"EPSG\",\"7030\"]],AUTHORITY[\"EPSG\",\"6326\"]],PRIMEM[\"Greenwich\",0,AUTHORITY[\"EPSG\",\"8901\"]],UNIT[\"degree\",0.01745329251994328,AUTHORITY[\"EPSG\",\"9122\"]],AUTHORITY[\"EPSG\",\"4326\"]]";
 
 const STRING TEST_LOCALE = L"en";
 



More information about the mapguide-commits mailing list