[mapguide-commits] r6862 - in trunk/Tools/Maestro: Maestro.Base/Commands/SiteExplorer Maestro.Base/Properties OSGeo.MapGuide.MaestroAPI OSGeo.MapGuide.MaestroAPI/Capability OSGeo.MapGuide.MaestroAPI.Local

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Fri Jul 6 07:58:34 PDT 2012


Author: jng
Date: 2012-07-06 07:58:34 -0700 (Fri, 06 Jul 2012)
New Revision: 6862

Modified:
   trunk/Tools/Maestro/Maestro.Base/Commands/SiteExplorer/EditResourceHeaderCommand.cs
   trunk/Tools/Maestro/Maestro.Base/Commands/SiteExplorer/RepointCommand.cs
   trunk/Tools/Maestro/Maestro.Base/Commands/SiteExplorer/ResourcePropertiesCommand.cs
   trunk/Tools/Maestro/Maestro.Base/Properties/Resources.Designer.cs
   trunk/Tools/Maestro/Maestro.Base/Properties/Resources.resx
   trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI.Local/LocalCapabilities.cs
   trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/Capability/ConnectionCapabilities.cs
   trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/IConnectionCapabilities.cs
Log:
Guard the local connection against commands that that require capabilities that this connection does not provide.

Modified: trunk/Tools/Maestro/Maestro.Base/Commands/SiteExplorer/EditResourceHeaderCommand.cs
===================================================================
--- trunk/Tools/Maestro/Maestro.Base/Commands/SiteExplorer/EditResourceHeaderCommand.cs	2012-07-06 13:47:48 UTC (rev 6861)
+++ trunk/Tools/Maestro/Maestro.Base/Commands/SiteExplorer/EditResourceHeaderCommand.cs	2012-07-06 14:58:34 UTC (rev 6862)
@@ -37,6 +37,12 @@
             {
                 var connMgr = ServiceRegistry.GetService<ServerConnectionManager>();
                 var conn = connMgr.GetConnection(exp.ConnectionName);
+                if (!IsValid(conn))
+                {
+                    MessageService.ShowError(Properties.Resources.ConnectionDoesNotSupportRequiredInterfaces);
+                    return;
+                }
+
                 var item = exp.SelectedItems[0];
                 var diag = new ResourceHeaderXmlDialog(item.ResourceId, conn.ResourceService);
                 if (item.IsFolder)
@@ -52,5 +58,10 @@
                 diag.ShowDialog();
             }
         }
+
+        private bool IsValid(OSGeo.MapGuide.MaestroAPI.IServerConnection conn)
+        {
+            return conn.Capabilities.SupportsResourceHeaders;
+        }
     }
 }

Modified: trunk/Tools/Maestro/Maestro.Base/Commands/SiteExplorer/RepointCommand.cs
===================================================================
--- trunk/Tools/Maestro/Maestro.Base/Commands/SiteExplorer/RepointCommand.cs	2012-07-06 13:47:48 UTC (rev 6861)
+++ trunk/Tools/Maestro/Maestro.Base/Commands/SiteExplorer/RepointCommand.cs	2012-07-06 14:58:34 UTC (rev 6862)
@@ -41,6 +41,12 @@
             var exp = wb.ActiveSiteExplorer;
             var connMgr = ServiceRegistry.GetService<ServerConnectionManager>();
             var conn = connMgr.GetConnection(exp.ConnectionName);
+            if (!IsValid(conn))
+            {
+                MessageService.ShowError(Properties.Resources.ConnectionDoesNotSupportRequiredInterfaces);
+                return;
+            }
+
             if (exp.SelectedItems.Length == 1)
             {
                 var selected = exp.SelectedItems[0];
@@ -60,6 +66,11 @@
             }
         }
 
+        private bool IsValid(IServerConnection conn)
+        {
+            return conn.Capabilities.SupportsResourceReferences;
+        }
+
         private void DoRepointMap(Workbench wb, OSGeo.MapGuide.MaestroAPI.IServerConnection conn, ResourceIdentifier resId)
         {
             var diag = new RepointerDialog(resId, conn.ResourceService);

Modified: trunk/Tools/Maestro/Maestro.Base/Commands/SiteExplorer/ResourcePropertiesCommand.cs
===================================================================
--- trunk/Tools/Maestro/Maestro.Base/Commands/SiteExplorer/ResourcePropertiesCommand.cs	2012-07-06 13:47:48 UTC (rev 6861)
+++ trunk/Tools/Maestro/Maestro.Base/Commands/SiteExplorer/ResourcePropertiesCommand.cs	2012-07-06 14:58:34 UTC (rev 6862)
@@ -35,6 +35,12 @@
             var connMgr = ServiceRegistry.GetService<ServerConnectionManager>();
             var conn = connMgr.GetConnection(wb.ActiveSiteExplorer.ConnectionName);
 
+            if (!IsValid(conn))
+            {
+                MessageService.ShowError(Properties.Resources.ConnectionDoesNotSupportRequiredInterfaces);
+                return;
+            }
+
             //Can only show properties of one selected item
             if (items.Length == 1)
             {
@@ -43,5 +49,14 @@
                 dlg.ShowDialog(wb);
             }
         }
+
+        private bool IsValid(OSGeo.MapGuide.MaestroAPI.IServerConnection conn)
+        {
+            return conn.Capabilities.SupportsResourceHeaders &&
+                   conn.Capabilities.SupportsResourceReferences &&
+                   conn.Capabilities.SupportsResourceSecurity &&
+                   conn.Capabilities.SupportsWfsPublishing &&
+                   conn.Capabilities.SupportsWmsPublishing;
+        }
     }
 }

Modified: trunk/Tools/Maestro/Maestro.Base/Properties/Resources.Designer.cs
===================================================================
--- trunk/Tools/Maestro/Maestro.Base/Properties/Resources.Designer.cs	2012-07-06 13:47:48 UTC (rev 6861)
+++ trunk/Tools/Maestro/Maestro.Base/Properties/Resources.Designer.cs	2012-07-06 14:58:34 UTC (rev 6862)
@@ -459,6 +459,15 @@
         }
         
         /// <summary>
+        ///   Looks up a localized string similar to The current connection does not support the required interfaces to perform this action.
+        /// </summary>
+        internal static string ConnectionDoesNotSupportRequiredInterfaces {
+            get {
+                return ResourceManager.GetString("ConnectionDoesNotSupportRequiredInterfaces", resourceCulture);
+            }
+        }
+        
+        /// <summary>
         ///   Looks up a localized string similar to Messages.
         /// </summary>
         internal static string Content_Messages {

Modified: trunk/Tools/Maestro/Maestro.Base/Properties/Resources.resx
===================================================================
--- trunk/Tools/Maestro/Maestro.Base/Properties/Resources.resx	2012-07-06 13:47:48 UTC (rev 6861)
+++ trunk/Tools/Maestro/Maestro.Base/Properties/Resources.resx	2012-07-06 14:58:34 UTC (rev 6862)
@@ -2691,4 +2691,7 @@
   <data name="LiveMapEditor" xml:space="preserve">
     <value>Live Map Definition Editor</value>
   </data>
+  <data name="ConnectionDoesNotSupportRequiredInterfaces" xml:space="preserve">
+    <value>The current connection does not support the required interfaces to perform this action</value>
+  </data>
 </root>
\ No newline at end of file

Modified: trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/Capability/ConnectionCapabilities.cs
===================================================================
--- trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/Capability/ConnectionCapabilities.cs	2012-07-06 13:47:48 UTC (rev 6861)
+++ trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/Capability/ConnectionCapabilities.cs	2012-07-06 14:58:34 UTC (rev 6862)
@@ -279,5 +279,45 @@
         {
             return IsSupportedResourceType(resType.ToString());
         }
+
+        /// <summary>
+        /// Gets whether this connection supports publishing resources for WFS
+        /// </summary>
+        public virtual bool SupportsWfsPublishing
+        {
+            get { return true; }
+        }
+
+        /// <summary>
+        /// Gets whether this connection supports publishing resources for WMS
+        /// </summary>
+        public virtual bool SupportsWmsPublishing
+        {
+            get { return true; }
+        }
+
+        /// <summary>
+        /// Gets whether this connection supports resource reference tracking
+        /// </summary>
+        public virtual bool SupportsResourceReferences
+        {
+            get { return true; }
+        }
+
+        /// <summary>
+        /// Gets whether this connection supports resource security
+        /// </summary>
+        public virtual bool SupportsResourceSecurity
+        {
+            get { return true; }
+        }
+
+        /// <summary>
+        /// Gets whether this connection supports the concept of resource headers
+        /// </summary>
+        public virtual bool SupportsResourceHeaders
+        {
+            get { return true; }
+        }
     }
 }

Modified: trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/IConnectionCapabilities.cs
===================================================================
--- trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/IConnectionCapabilities.cs	2012-07-06 13:47:48 UTC (rev 6861)
+++ trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/IConnectionCapabilities.cs	2012-07-06 14:58:34 UTC (rev 6862)
@@ -57,6 +57,31 @@
         bool SupportsResourcePreviews { get; }
 
         /// <summary>
+        /// Gets whether this connection supports publishing resources for WFS
+        /// </summary>
+        bool SupportsWfsPublishing { get; }
+
+        /// <summary>
+        /// Gets whether this connection supports publishing resources for WMS
+        /// </summary>
+        bool SupportsWmsPublishing { get; }
+
+        /// <summary>
+        /// Gets whether this connection supports the concept of resource headers
+        /// </summary>
+        bool SupportsResourceHeaders { get; }
+
+        /// <summary>
+        /// Gets whether this connection supports resource reference tracking
+        /// </summary>
+        bool SupportsResourceReferences { get; }
+
+        /// <summary>
+        /// Gets whether this connection supports resource security
+        /// </summary>
+        bool SupportsResourceSecurity { get; }
+
+        /// <summary>
         /// Indicates if this current connection supports the specified resource type
         /// </summary>
         /// <param name="resType"></param>

Modified: trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI.Local/LocalCapabilities.cs
===================================================================
--- trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI.Local/LocalCapabilities.cs	2012-07-06 13:47:48 UTC (rev 6861)
+++ trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI.Local/LocalCapabilities.cs	2012-07-06 14:58:34 UTC (rev 6862)
@@ -67,5 +67,45 @@
         {
             get { return false; }
         }
+
+        public override bool SupportsResourceReferences
+        {
+            get
+            {
+                return false;
+            }
+        }
+
+        public override bool SupportsResourceSecurity
+        {
+            get
+            {
+                return false;
+            }
+        }
+
+        public override bool SupportsWfsPublishing
+        {
+            get
+            {
+                return false;
+            }
+        }
+
+        public override bool SupportsWmsPublishing
+        {
+            get
+            {
+                return false;
+            }
+        }
+
+        public override bool SupportsResourceHeaders
+        {
+            get
+            {
+                return false;
+            }
+        }
     }
 }



More information about the mapguide-commits mailing list