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

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Sat Jan 30 14:20:33 EST 2010


Author: ksgeograf
Date: 2010-01-30 14:20:33 -0500 (Sat, 30 Jan 2010)
New Revision: 4562

Modified:
   trunk/Tools/Maestro/MaestroAPI/HttpServerConnection.cs
   trunk/Tools/Maestro/MaestroAPI/LocalNativeConnection.cs
   trunk/Tools/Maestro/MaestroAPI/RequestBuilder.cs
   trunk/Tools/Maestro/MaestroAPI/ServerConnectionBase.cs
Log:
Maestro:
Fixed issue #1244

Modified: trunk/Tools/Maestro/MaestroAPI/HttpServerConnection.cs
===================================================================
--- trunk/Tools/Maestro/MaestroAPI/HttpServerConnection.cs	2010-01-30 19:07:03 UTC (rev 4561)
+++ trunk/Tools/Maestro/MaestroAPI/HttpServerConnection.cs	2010-01-30 19:20:33 UTC (rev 4562)
@@ -1329,7 +1329,23 @@
             return m_cachedGroupList;
         }
 
+        public override bool ResourceExists(string resourceid)
+        {
+            try
+            {
+                string req = m_reqBuilder.ResourceExists(resourceid);
+                using (System.IO.Stream s = this.OpenRead(req))
+                using (System.IO.StreamReader sr = new System.IO.StreamReader(s))
+                    return sr.ReadToEnd().Trim().Equals("true", StringComparison.InvariantCultureIgnoreCase);
+            }
+            catch (Exception ex)
+            {
+                try { return base.ResourceExists(resourceid); }
+                catch { throw ex; } //Throw original error
+            }
+        }
 
+
         #region IDisposable Members
 
         public override void Dispose()

Modified: trunk/Tools/Maestro/MaestroAPI/LocalNativeConnection.cs
===================================================================
--- trunk/Tools/Maestro/MaestroAPI/LocalNativeConnection.cs	2010-01-30 19:07:03 UTC (rev 4561)
+++ trunk/Tools/Maestro/MaestroAPI/LocalNativeConnection.cs	2010-01-30 19:20:33 UTC (rev 4562)
@@ -788,6 +788,21 @@
             //ts.GetTile(new MgResourceIdentifier(mapdefinition), baselayergroup, col, row, scaleindex)
         }
 
+        public override bool ResourceExists(string resourceid)
+        {
+            try
+            {
+                MgResourceService res = this.Con.CreateService(MgServiceType.ResourceService) as MgResourceService;
+                return res.ResourceExists(new MgResourceIdentifier(resourceid));
+            }
+            catch (Exception ex)
+            {
+                try { return base.ResourceExists(resourceid); }
+                catch { throw ex; } //Throw original error
+            }
+            
+        }
+
 		#endregion
 
         #region IDisposable Members

Modified: trunk/Tools/Maestro/MaestroAPI/RequestBuilder.cs
===================================================================
--- trunk/Tools/Maestro/MaestroAPI/RequestBuilder.cs	2010-01-30 19:07:03 UTC (rev 4561)
+++ trunk/Tools/Maestro/MaestroAPI/RequestBuilder.cs	2010-01-30 19:20:33 UTC (rev 4562)
@@ -1199,6 +1199,23 @@
             return req;
         }
 
+        public string ResourceExists(string resourceId)
+        {
+            NameValueCollection param = new NameValueCollection();
+            param.Add("OPERATION", "RESOURCEEXISTS");
+            param.Add("VERSION", "1.0.0");
+            param.Add("SESSION", m_sessionID);
+            param.Add("FORMAT", "text/xml");
+            param.Add("CLIENTAGENT", m_userAgent);
+
+            if (m_locale != null)
+                param.Add("LOCALE", m_locale);
+
+            param.Add("RESOURCEID", resourceId);
+
+            return m_hosturi + "?" + EncodeParameters(param);
+        }
+
         public string UserAgent
         {
             get { return m_userAgent; }

Modified: trunk/Tools/Maestro/MaestroAPI/ServerConnectionBase.cs
===================================================================
--- trunk/Tools/Maestro/MaestroAPI/ServerConnectionBase.cs	2010-01-30 19:07:03 UTC (rev 4561)
+++ trunk/Tools/Maestro/MaestroAPI/ServerConnectionBase.cs	2010-01-30 19:20:33 UTC (rev 4562)
@@ -594,7 +594,7 @@
 		/// </summary>
 		/// <param name="resourceid">The resource to look for</param>
 		/// <returns>True if the resource exists false otherwise. Also returns false on error.</returns>
-		public bool ResourceExists(string resourceid)
+		public virtual bool ResourceExists(string resourceid)
 		{
 			try
 			{



More information about the mapguide-commits mailing list