Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
05/30/08 13:41:27 (16 years ago)
Author:
gkronber
Message:

merged changesets r219:r228, r240, r241:258, r263:265, r267,r268, r269 from trunk into the HL3 stable branch

Location:
branches/3.0/sources/HeuristicLab.PluginInfrastructure
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • branches/3.0/sources/HeuristicLab.PluginInfrastructure/ApplicationInfo.cs

    r2 r279  
    4646    }
    4747
     48    private bool autoRestart;
     49    public bool AutoRestart {
     50      get { return autoRestart; }
     51      set { autoRestart = value; }
     52    }
     53
    4854    private string pluginAssembly;
    4955    /// <summary>
    5056    /// Name of the assembly that contains the IApplication type.
    51     /// NEEDED?
    5257    /// </summary>
    5358    public string PluginAssembly {
     
    5964    /// <summary>
    6065    /// Name of the type that implements the interface IApplication.
    61     /// NEEDED?
    6266    /// </summary>
    6367    public string PluginType {
  • branches/3.0/sources/HeuristicLab.PluginInfrastructure/BaseClasses/ApplicationBase.cs

    r8 r279  
    3030    private Version version;
    3131    private string description;
    32    
     32    private bool autoRestart;
     33
    3334    public ApplicationBase() {
    3435      ReadAttributes();
     
    4546      // after the assertion we are sure that the array access will not fail
    4647      ClassInfoAttribute pluginAttribute = (ClassInfoAttribute)pluginAttributes[0];
     48      if(pluginAttribute != null) {
     49        // if the plugin name is not explicitly set in the attribute then the default plugin name is the FullName of the type
     50        if(pluginAttribute.Name != null) {
     51          this.name = pluginAttribute.Name;
     52        } else {
     53          this.name = this.GetType().FullName;
     54        }
    4755
    48       // if the plugin name is not explicitly set in the attribute then the default plugin name is the FullName of the type
    49       if(pluginAttribute != null && pluginAttribute.Name != null) {
    50         this.name = pluginAttribute.Name;
    51       } else {
    52         this.name = this.GetType().FullName;
    53       }
     56        // if the version is not explicitly set in the attribute then the version of the assembly is used as default
     57        if(pluginAttribute.Version != null) {
     58          this.version = new Version(pluginAttribute.Version);
     59        } else {
     60          this.version = this.GetType().Assembly.GetName().Version;
     61        }
    5462
    55       // if the version is not explicitly set in the attribute then the version of the assembly is used as default
    56       if(pluginAttribute != null && pluginAttribute.Version != null) {
    57         this.version = new Version(pluginAttribute.Version);
    58       } else {
    59         this.version = this.GetType().Assembly.GetName().Version;
    60       }
     63        // if the description is not explicitly set in the attribute then the name of name of the application is used as default
     64        if(pluginAttribute.Description != null) {
     65          this.description = pluginAttribute.Description;
     66        } else {
     67          this.description = name;
     68        }
    6169
    62       // if the description is not explicitly set in the attribute then the name of name of the application is used as default
    63       if(pluginAttribute != null && pluginAttribute.Description != null) {
    64         this.description = pluginAttribute.Description;
    65       } else {
    66         this.description = name;
     70        this.autoRestart = pluginAttribute.AutoRestart;
    6771      }
    6872    }
     
    8387    }
    8488
    85     public abstract void Run() ;
     89    public bool AutoRestart {
     90      get { return autoRestart; }
     91    }
     92
     93    public abstract void Run();
    8694
    8795    #endregion
  • branches/3.0/sources/HeuristicLab.PluginInfrastructure/ClassInfoAttribute.cs

    r91 r279  
    5252    }
    5353
     54    private bool autoRestart;
     55    public bool AutoRestart {
     56      get { return autoRestart; }
     57      set { autoRestart = value; }
     58    }
     59
    5460    public ClassInfoAttribute() {}
    5561  }
  • branches/3.0/sources/HeuristicLab.PluginInfrastructure/Interfaces/IApplication.cs

    r2 r279  
    2929    Version Version { get; }
    3030    string Description { get;}
     31    bool AutoRestart { get; }
    3132    void Run();
    3233  }
  • branches/3.0/sources/HeuristicLab.PluginInfrastructure/Loader.cs

    r91 r279  
    120120        info.Version = application.Version;
    121121        info.Description = application.Description;
     122        info.AutoRestart = application.AutoRestart;
    122123        info.PluginAssembly = application.GetType().Assembly.GetName().Name;
    123124        info.PluginType = application.GetType().Namespace + "." + application.GetType().Name;
  • branches/3.0/sources/HeuristicLab.PluginInfrastructure/PluginManager.cs

    r29 r279  
    103103      setup.PrivateBinPath = pluginDir;
    104104      AppDomain applicationDomain = AppDomain.CreateDomain(appInfo.Name + " AppDomain", null, setup);
    105 
    106       Runner remoteRunner = (Runner)applicationDomain.CreateInstanceAndUnwrap("HeuristicLab.PluginInfrastructure", "HeuristicLab.PluginInfrastructure.Runner");
    107       NotifyListeners(PluginManagerAction.Initializing, "All plugins");
    108       remoteRunner.LoadPlugins(remoteLoader.ActivePlugins);
    109       NotifyListeners(PluginManagerAction.Initialized, "All plugins");
    110       remoteRunner.Run(appInfo);
    111 
    112       AppDomain.Unload(applicationDomain);
     105      try {
     106        Runner remoteRunner = (Runner)applicationDomain.CreateInstanceAndUnwrap("HeuristicLab.PluginInfrastructure", "HeuristicLab.PluginInfrastructure.Runner");
     107        NotifyListeners(PluginManagerAction.Initializing, "All plugins");
     108        remoteRunner.LoadPlugins(remoteLoader.ActivePlugins);
     109        NotifyListeners(PluginManagerAction.Initialized, "All plugins");
     110        remoteRunner.Run(appInfo);
     111      } catch(Exception ex) {
     112        // can't handle exception here -> rethrow
     113        throw new ApplicationException("Exception in "+appInfo.Name, ex);
     114      } finally {
     115        // make sure domain is unloaded in all cases
     116        AppDomain.Unload(applicationDomain);
     117      }
    113118    }
    114119
Note: See TracChangeset for help on using the changeset viewer.