[mapguide-commits] r6760 - in trunk/Tools/Maestro: Maestro.Base/Commands/SiteExplorer OSGeo.MapGuide.MaestroAPI OSGeo.MapGuide.MaestroAPI.Http OSGeo.MapGuide.MaestroAPI.Local OSGeo.MapGuide.MaestroAPI.Native

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Thu Jun 14 02:07:38 PDT 2012


Author: jng
Date: 2012-06-14 02:07:38 -0700 (Thu, 14 Jun 2012)
New Revision: 6760

Modified:
   trunk/Tools/Maestro/Maestro.Base/Commands/SiteExplorer/TestResourceCompatibilityCommand.cs
   trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI.Http/HttpServerConnection.cs
   trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI.Local/LocalConnection.cs
   trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI.Native/LocalNativeConnection.cs
   trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/IServerConnection.cs
   trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/MgServerConnectionBase.cs
Log:
#2027: Add connection support for broadcasting change of session ids

Modified: trunk/Tools/Maestro/Maestro.Base/Commands/SiteExplorer/TestResourceCompatibilityCommand.cs
===================================================================
--- trunk/Tools/Maestro/Maestro.Base/Commands/SiteExplorer/TestResourceCompatibilityCommand.cs	2012-06-14 02:27:24 UTC (rev 6759)
+++ trunk/Tools/Maestro/Maestro.Base/Commands/SiteExplorer/TestResourceCompatibilityCommand.cs	2012-06-14 09:07:38 UTC (rev 6760)
@@ -298,5 +298,8 @@
         }
 
         public event RequestEventHandler RequestDispatched;
+
+
+        public event EventHandler SessionIDChanged;
     }
 }

Modified: trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/IServerConnection.cs
===================================================================
--- trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/IServerConnection.cs	2012-06-14 02:27:24 UTC (rev 6759)
+++ trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/IServerConnection.cs	2012-06-14 09:07:38 UTC (rev 6760)
@@ -120,6 +120,11 @@
         string SessionID { get; }
 
         /// <summary>
+        /// Raised when the session ID has changed
+        /// </summary>
+        event EventHandler SessionIDChanged;
+
+        /// <summary>
         /// Gets or sets a value indicating if the session should automatically be restarted if it expires
         /// </summary>
         bool AutoRestartSession { get; set; }

Modified: trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/MgServerConnectionBase.cs
===================================================================
--- trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/MgServerConnectionBase.cs	2012-06-14 02:27:24 UTC (rev 6759)
+++ trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/MgServerConnectionBase.cs	2012-06-14 09:07:38 UTC (rev 6760)
@@ -104,13 +104,32 @@
             RestartSession(true);
         }
 
+        public event EventHandler SessionIDChanged;
+
         /// <summary>
         /// Restarts the server session, and creates a new session ID
         /// </summary>
         /// <param name="throwException">If set to true, the call throws an exception if the call failed</param>
         /// <returns>True if the creation succeed, false otherwise</returns>
-        abstract public bool RestartSession(bool throwException);
+        public bool RestartSession(bool throwException)
+        {
+            var oldSessionId = this.SessionID;
+            var ret = RestartSessionInternal(throwException);
+            var newSessionId = this.SessionID;
+            if (!string.IsNullOrEmpty(oldSessionId))
+            {
+                if (oldSessionId != newSessionId)
+                {
+                    var h = this.SessionIDChanged;
+                    if (h != null)
+                        h(this, EventArgs.Empty);
+                }
+            }
+            return ret;
+        }
 
+        protected abstract bool RestartSessionInternal(bool throwException);
+
         #endregion
 
         #region Site

Modified: trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI.Http/HttpServerConnection.cs
===================================================================
--- trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI.Http/HttpServerConnection.cs	2012-06-14 02:27:24 UTC (rev 6759)
+++ trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI.Http/HttpServerConnection.cs	2012-06-14 09:07:38 UTC (rev 6760)
@@ -1145,7 +1145,7 @@
 		/// </summary>
 		/// <param name="throwException">If set to true, the call throws an exception if the call failed</param>
 		/// <returns>True if the creation succeed, false otherwise</returns>
-		public override bool RestartSession(bool throwException)
+		protected override bool RestartSessionInternal(bool throwException)
 		{
 			if (m_username == null || m_password == null)
 				if (throwException)

Modified: trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI.Local/LocalConnection.cs
===================================================================
--- trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI.Local/LocalConnection.cs	2012-06-14 02:27:24 UTC (rev 6759)
+++ trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI.Local/LocalConnection.cs	2012-06-14 09:07:38 UTC (rev 6760)
@@ -45,6 +45,8 @@
                                    //IMappingService,
                                    IDrawingService
     {
+        public event EventHandler SessionIDChanged; //Not used
+
         public static LocalConnection Create(NameValueCollection initParams)
         {
             return new LocalConnection(initParams);

Modified: trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI.Native/LocalNativeConnection.cs
===================================================================
--- trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI.Native/LocalNativeConnection.cs	2012-06-14 02:27:24 UTC (rev 6759)
+++ trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI.Native/LocalNativeConnection.cs	2012-06-14 09:07:38 UTC (rev 6760)
@@ -762,7 +762,7 @@
 		/// </summary>
 		/// <param name="throwException">If set to true, the call throws an exception if the call failed</param>
 		/// <returns>True if the creation succeed, false otherwise</returns>
-		public override bool RestartSession(bool throwException)
+		protected override bool RestartSessionInternal(bool throwException)
 		{
 			if (m_username == null || m_password == null)
 				if (throwException)



More information about the mapguide-commits mailing list