List:Commits« Previous MessageNext Message »
From:Iggy Galarza Date:June 23 2011 7:06pm
Subject:bzr commit into wex-installer-1.0 branch (iggy:517) Bug#61612
View as plain text  
#At file:///C:/src/bzr.mysql/wex/installer/ based on revid:iggy@stripped

  517 Iggy Galarza	2011-06-23
      Bug #61612 - ExamplesConfigurationController Added a check for installed servers in PostAction. Configuration is only required when an installed server is found.

    modified:
      StandardPlugins/Examples/ConfigurationController.cs
      WexInstaller.Core/ProductConfigurationController.cs
      WexInstaller/InstallWizard/AllConfigOverview.cs
=== modified file 'StandardPlugins/Examples/ConfigurationController.cs'
--- a/StandardPlugins/Examples/ConfigurationController.cs	2011-06-02 22:41:33 +0000
+++ b/StandardPlugins/Examples/ConfigurationController.cs	2011-06-23 19:06:57 +0000
@@ -22,8 +22,11 @@ namespace WexInstaller.Plugins
     string connectionString;
     List<SampleDatabase> databasesToInstall = null;
 
-    public List<ServerProductConfigurationController> Servers = new List<ServerProductConfigurationController>();
-        
+    public ExamplesConfigurationController()
+    {
+      CurrentState = ConfigState.ConfigurationUnnecessary;
+    }
+
     public override int NumPages
     {
       get { return 0; }
@@ -54,12 +57,7 @@ namespace WexInstaller.Plugins
         return;
       }
 
-      // load up our owning catalogs
-      if (!GetOwningCatalogsAndRelatedServerProducts())
-        return;
-
-      if (!GetInstalledServers())
-        return;
+      // Make sure server is running.
       if (!GetRunningServers())
         return;
 
@@ -77,6 +75,19 @@ namespace WexInstaller.Plugins
       RunDatabaseScripts();
     }
 
+    public override void PostAction()
+    {
+      // load up our owning catalogs
+      if (!GetOwningCatalogsAndRelatedServerProducts())
+        return;
+
+      // check for installed servers.
+      if (!GetInstalledServers())
+        return;
+
+      CurrentState = ConfigState.ConfigurationRequired;
+    }
+
     private void GetRelatedServers()
     {
       if (relatedServers != null)
@@ -213,30 +224,21 @@ namespace WexInstaller.Plugins
         installedServers.Add(p);
       }
       if (installedServers == null || installedServers.Count == 0)
-      {
-        ReportStatus(ConfigurationEventType.Error, "", Resources.ConfigErrorServerNotInstalled, 100);
         return false;
-      }
+
       return true;
     }
 
     private bool GetOwningCatalogsAndRelatedServerProducts()
     {
       GetOwningCatalogs();
-
       if (owningCatalogs == null || owningCatalogs.Count == 0)
-      {
-        ReportStatus(ConfigurationEventType.Info, "SERVER_PRODUCT",
-          "Unable to determine server product as we are not in a catalog", 100);
         return false;
-      }
 
       GetRelatedServers();
       if (relatedServers == null || relatedServers.Count == 0)
-      {
-        ReportStatus(ConfigurationEventType.Error, "", "Unable to configure as there is no server product available", 100);
         return false;
-      }
+
       return true;
     }
 
@@ -246,16 +248,11 @@ namespace WexInstaller.Plugins
         return;
 
       // find out what catalog our owner belongs to
-      ReportStatus(ConfigurationEventType.Info, "CATALOG", "Determining product catalog", 0);
-
       owningCatalogs = new List<ProductCatalog>();
       foreach (ProductCatalog catalog in ProductManager.Catalogs)
         foreach (CatalogProduct catalogProduct in catalog.Products)
           if (catalogProduct.ReferencedProduct == Owner) 
-          {
-            ReportStatus(ConfigurationEventType.Success, "CATALOG", "Found containing catalog", 10);
             owningCatalogs.Add(catalog);
-          }
     }
   }
 

=== modified file 'WexInstaller.Core/ProductConfigurationController.cs'
--- a/WexInstaller.Core/ProductConfigurationController.cs	2011-05-17 15:40:12 +0000
+++ b/WexInstaller.Core/ProductConfigurationController.cs	2011-06-23 19:06:57 +0000
@@ -11,131 +11,132 @@ using System.Diagnostics;
 
 namespace WexInstaller.Core
 {
-    public abstract class ProductConfigurationController
+  public abstract class ProductConfigurationController
+  {
+    private BackgroundWorker bgw;
+
+    public abstract int NumPages { get; }
+    public abstract UserControl[] Pages { get; }
+
+    public ConfigState CurrentState { get; protected set; }
+    public Product Owner { get; set; }
+
+    /// <summary>
+    /// Virtual methods controllers can override
+    /// </summary>
+    public virtual void Configure()
     {
-        private BackgroundWorker bgw;
+      CurrentState = ConfigState.ConfigurationInProgress;
+      Debug.Assert(bgw == null);
+      bgw = new BackgroundWorker();
+      bgw.WorkerReportsProgress = true;
+      bgw.WorkerSupportsCancellation = false;
+      bgw.DoWork += new DoWorkEventHandler(BackgroundConfigure);
+      bgw.RunWorkerCompleted += new RunWorkerCompletedEventHandler(BackgroundConfigureCompleted);
+      bgw.ProgressChanged += new ProgressChangedEventHandler(BackgroundConfigureProgressChanged);
+      bgw.RunWorkerAsync();
+    }
+
+    public abstract void SetConfigurationValue(string[] pair);
+
+    protected virtual void ReportProgress(int percent, ConfigurationEventArgs args)
+    {
+      if (bgw != null)
+        bgw.ReportProgress(percent, args);
+    }
+
+    protected virtual void BackgroundConfigure(object sender, DoWorkEventArgs e) { }
+
+    protected virtual void BackgroundConfigureProgressChanged(object sender, ProgressChangedEventArgs e)
+    {
+      OnConfigured(e.UserState as ConfigurationEventArgs);
+    }
+
+    protected virtual void BackgroundConfigureCompleted(object sender, RunWorkerCompletedEventArgs e)
+    {
+      bgw.Dispose();
+      bgw = null;
+      if (CurrentState != ConfigState.ConfigurationError)
+        CurrentState = ConfigState.ConfigurationComplete;
+
+      ConfigurationEventArgs ce = new ConfigurationEventArgs(ConfigurationEventType.Finished, "CONFIGURE_COMPLETE");
+      ce.PercentComplete = 100;
+      ce.Details = "Product configuration controller finished configuration.";
+      OnConfigured(ce);
+    }
+
+    public virtual void Initialize(bool afterInstallation) { }
+    public virtual void PreAction() { }
+    public virtual void PostAction() { }
+    protected virtual void ReportConfigStatus(ConfigurationEventArgs args) { }
 
-        public abstract int NumPages { get; }
-        public abstract UserControl[] Pages { get; }
+    protected void ReportStatus(ConfigurationEventType type, string action, string details, int progress)
+    {
+      ConfigurationEventArgs args = new ConfigurationEventArgs(type, action);
+      args.Details = details;
+      args.PercentComplete = progress;
+      bgw.ReportProgress(progress, args);
+    }
 
-        public ConfigState CurrentState { get; protected set; }
-        public Product Owner { get; set; }
-
-        /// <summary>
-        /// Virtual methods controllers can override
-        /// </summary>
-        public virtual void Configure()
-        {
-            CurrentState = ConfigState.ConfigurationInProgress;
-            Debug.Assert(bgw == null);
-            bgw = new BackgroundWorker();
-            bgw.WorkerReportsProgress = true;
-            bgw.WorkerSupportsCancellation = false;
-            bgw.DoWork += new DoWorkEventHandler(BackgroundConfigure);
-            bgw.RunWorkerCompleted += new RunWorkerCompletedEventHandler(BackgroundConfigureCompleted);
-            bgw.ProgressChanged += new ProgressChangedEventHandler(BackgroundConfigureProgressChanged);
-            bgw.RunWorkerAsync();
-        }
-
-        public abstract void SetConfigurationValue(string[] pair);
-
-        protected virtual void ReportProgress(int percent, ConfigurationEventArgs args)
-        {
-            if (bgw != null)
-                bgw.ReportProgress(percent, args);
-        }
-
-        protected virtual void BackgroundConfigure(object sender, DoWorkEventArgs e) { }
-
-        protected virtual void BackgroundConfigureProgressChanged(object sender, ProgressChangedEventArgs e)
-        {
-            OnConfigured(e.UserState as ConfigurationEventArgs);
-        }
-
-        protected virtual void BackgroundConfigureCompleted(object sender, RunWorkerCompletedEventArgs e)
-        {
-            bgw.Dispose();
-            bgw = null;
-            if (CurrentState != ConfigState.ConfigurationError)
-                CurrentState = ConfigState.ConfigurationComplete;
-
-            ConfigurationEventArgs ce = new ConfigurationEventArgs(ConfigurationEventType.Finished, "CONFIGURE_COMPLETE");
-            ce.PercentComplete = 100;
-            ce.Details = "Product configuration controller finished configuration.";
-            OnConfigured(ce);
-        }
-
-        public virtual void Initialize(bool afterInstallation) { }
-        public virtual void PreAction() { }
-        public virtual void PostAction() { }
-        protected virtual void ReportConfigStatus(ConfigurationEventArgs args) { }
-
-        protected void ReportStatus(ConfigurationEventType type, string action, string details, int progress)
-        {
-            ConfigurationEventArgs args = new ConfigurationEventArgs(type, action);
-            args.Details = details;
-            args.PercentComplete = progress;
-            bgw.ReportProgress(progress, args);
-        }
-
-        protected void ReportError(string action, string details)
-        {
-            CurrentState = ConfigState.ConfigurationError;
-            ReportStatus(ConfigurationEventType.Error, action, details, 100);
-        }
-
-        public event ConfigurationEventHandler Configured;
-        private void OnConfigured(ConfigurationEventArgs args)
-        {
-            if (Configured != null)
-                Configured(this, args);
-        }
-    }
-
-    public class ProductConfigurationAttribute : Attribute
-    {
-        public ProductConfigurationAttribute(string productName, int version)
-        {
-            ProductName = productName;
-            Version = version;
-        }
-
-        public string ProductName { get; set; }
-        public int Version { get; set; }
-    }
-
-    public enum ConfigurationEventType
-    {
-        Info,
-        Success,
-        Error,
-        Finished
-    }
-
-    public class ConfigurationEventArgs : EventArgs
-    {
-        public ConfigurationEventArgs(ConfigurationEventType type, string action)
-        {
-            Type = type;
-            Action = action;
-            Details = String.Empty;
-            PercentComplete = 0;
-        }
-
-        public ConfigurationEventType Type { get; set; }
-        public string Action { get; set; }
-        public string Details { get; set; }
-        public int PercentComplete { get; set; }
-    }
-
-    public delegate void ConfigurationEventHandler(object sender, ConfigurationEventArgs ce);
-
-    public enum ConfigState
-    {
-        Unknown = -1,
-        ConfigurationRequired = 1,
-        ConfigurationInProgress = 2,
-        ConfigurationComplete = 3,
-        ConfigurationError = 4
+    protected void ReportError(string action, string details)
+    {
+      CurrentState = ConfigState.ConfigurationError;
+      ReportStatus(ConfigurationEventType.Error, action, details, 100);
     }
+
+    public event ConfigurationEventHandler Configured;
+    private void OnConfigured(ConfigurationEventArgs args)
+    {
+      if (Configured != null)
+        Configured(this, args);
+    }
+  }
+
+  public class ProductConfigurationAttribute : Attribute
+  {
+    public ProductConfigurationAttribute(string productName, int version)
+    {
+      ProductName = productName;
+      Version = version;
+    }
+
+    public string ProductName { get; set; }
+    public int Version { get; set; }
+  }
+
+  public enum ConfigurationEventType
+  {
+    Info,
+    Success,
+    Error,
+    Finished
+  }
+
+  public class ConfigurationEventArgs : EventArgs
+  {
+    public ConfigurationEventArgs(ConfigurationEventType type, string action)
+    {
+      Type = type;
+      Action = action;
+      Details = String.Empty;
+      PercentComplete = 0;
+    }
+
+    public ConfigurationEventType Type { get; set; }
+    public string Action { get; set; }
+    public string Details { get; set; }
+    public int PercentComplete { get; set; }
+  }
+
+  public delegate void ConfigurationEventHandler(object sender, ConfigurationEventArgs ce);
+
+  public enum ConfigState
+  {
+    Unknown = -1,
+    ConfigurationRequired = 1,
+    ConfigurationInProgress = 2,
+    ConfigurationComplete = 3,
+    ConfigurationError = 4,
+    ConfigurationUnnecessary = 5
+  }
 }

=== modified file 'WexInstaller/InstallWizard/AllConfigOverview.cs'
--- a/WexInstaller/InstallWizard/AllConfigOverview.cs	2011-06-06 12:33:14 +0000
+++ b/WexInstaller/InstallWizard/AllConfigOverview.cs	2011-06-23 19:06:57 +0000
@@ -27,7 +27,7 @@ namespace WexInstaller
         {
           foreach (Product p in pc.Products)
           {
-            if (p.CurrentState == ProductState.InstallSuccess && p.Controller != null)
+            if (p.CurrentState == ProductState.InstallSuccess && p.Controller != null && p.Controller.CurrentState != ConfigState.ConfigurationUnnecessary)
             {
               ListViewItem item = new ListViewItem(String.Empty);
               item.Name = p.Title;


Attachment: [text/bzr-bundle] bzr/iggy@mysql.com-20110623190657-pz5k2w6pbncd74w1.bundle
Thread
bzr commit into wex-installer-1.0 branch (iggy:517) Bug#61612Iggy Galarza23 Jun