[mapguide-commits] r5426 - trunk/Tools/Maestro/MaestroAPI

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Wed Dec 1 06:11:48 EST 2010


Author: jng
Date: 2010-12-01 03:11:48 -0800 (Wed, 01 Dec 2010)
New Revision: 5426

Modified:
   trunk/Tools/Maestro/MaestroAPI/HttpServerConnection.cs
   trunk/Tools/Maestro/MaestroAPI/LocalNativeConnection.cs
Log:
Fix #1536: Force timestamp update on target when CopyResource is called.

Modified: trunk/Tools/Maestro/MaestroAPI/HttpServerConnection.cs
===================================================================
--- trunk/Tools/Maestro/MaestroAPI/HttpServerConnection.cs	2010-12-01 11:01:20 UTC (rev 5425)
+++ trunk/Tools/Maestro/MaestroAPI/HttpServerConnection.cs	2010-12-01 11:11:48 UTC (rev 5426)
@@ -23,6 +23,7 @@
 using System.Collections.Specialized;
 using System.Collections;
 using System.Text;
+using System.IO;
 
 namespace OSGeo.MapGuide.MaestroAPI
 {
@@ -842,6 +843,12 @@
 				resp.ReadByte();
 			//Do nothing... there is no return value
 
+            //HACK: Force timestamp update on target
+            var content = GetResourceXmlData(newpath);
+            using (var ms = new MemoryStream(content))
+            {
+                SetResourceXmlData(newpath, ms);
+            }
 		}
 
 		public override void CopyFolder(string oldpath, string newpath, bool overwrite)

Modified: trunk/Tools/Maestro/MaestroAPI/LocalNativeConnection.cs
===================================================================
--- trunk/Tools/Maestro/MaestroAPI/LocalNativeConnection.cs	2010-12-01 11:01:20 UTC (rev 5425)
+++ trunk/Tools/Maestro/MaestroAPI/LocalNativeConnection.cs	2010-12-01 11:11:48 UTC (rev 5426)
@@ -525,8 +525,14 @@
 
 		public override void CopyResource(string oldpath, string newpath, bool overwrite)
 		{
+            MgResourceIdentifier newId = new MgResourceIdentifier(newpath);
 			MgResourceService res = this.Con.CreateService(MgServiceType.ResourceService) as MgResourceService;
-			res.CopyResource(new MgResourceIdentifier(oldpath), new MgResourceIdentifier(newpath), overwrite);
+			res.CopyResource(new MgResourceIdentifier(oldpath), newId, overwrite);
+
+            //HACK: force timestamp update on target
+            MgByteReader content = res.GetResourceContent(newId);
+            content.Rewind();
+            res.SetResource(newId, content, null);
 		}
 
 		public override void CopyFolder(string oldpath, string newpath, bool overwrite)



More information about the mapguide-commits mailing list