Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
11/20/09 16:35:13 (15 years ago)
Author:
gkronber
Message:

Worked on plugin installation manager and update location service. #799

Location:
branches/PluginInfrastructure Refactoring/HeuristicLab.PluginInfrastructure/Manager
Files:
1 added
4 edited

Legend:

Unmodified
Added
Removed
  • branches/PluginInfrastructure Refactoring/HeuristicLab.PluginInfrastructure/Manager/ApplicationDescription.cs

    r2504 r2517  
    3737    public string Name {
    3838      get { return name; }
    39       set { name = value; }
     39      internal set { name = value; }
    4040    }
    4141    private Version version;
     
    5353    /// Gets or sets the description of the application.
    5454    /// </summary>
    55     public string Description {
     55    internal string Description {
    5656      get { return description; }
    5757      set { description = value; }
  • branches/PluginInfrastructure Refactoring/HeuristicLab.PluginInfrastructure/Manager/DefaultApplicationManager.cs

    r2504 r2517  
    8080    private void LoadPlugins(IEnumerable<PluginDescription> plugins) {
    8181      // load all loadable plugins (all dependencies available) into the execution context
    82       foreach (var desc in PluginDescriptionIterator.IterateInDependencyOrder(plugins.Where(x => x.PluginState != PluginState.Disabled))) {
     82      foreach (var desc in PluginDescriptionIterator.IterateDependenciesBottomUp(plugins.Where(x => x.PluginState != PluginState.Disabled))) {
    8383        foreach (string assembly in desc.Assemblies) {
    8484          var asm = Assembly.LoadFrom(assembly);
     
    105105          plugin.OnUnload();
    106106        }
    107         foreach (var desc in PluginDescriptionIterator.IterateInDependencyOrder(plugins.Where(x => x.PluginState != PluginState.Disabled))) {
     107        foreach (var desc in PluginDescriptionIterator.IterateDependenciesBottomUp(plugins.Where(x => x.PluginState != PluginState.Disabled))) {
    108108          desc.Unload();
    109109          OnPluginUnloaded(new PluginInfrastructureEventArgs("Plugin unloaded", desc));
     
    134134    /// <typeparam name="T">Most general type.</typeparam>
    135135    /// <returns>Enumerable of the created instances.</returns>
    136     public IEnumerable<T> GetInstances<T>(IPluginDescription plugin) where T : class {
     136    public static IEnumerable<T> GetInstances<T>(IPluginDescription plugin) where T : class {
    137137      return from t in GetTypes(typeof(T), plugin)
    138138             where !t.IsAbstract && !t.IsInterface && !t.HasElementType
     
    155155    /// <typeparam name="T">Most general type.</typeparam>
    156156    /// <returns>Enumerable of the created instances.</returns>
    157     public IEnumerable<T> GetInstances<T>() where T : class {
     157    public static IEnumerable<T> GetInstances<T>() where T : class {
    158158      return from i in GetInstances(typeof(T))
    159159             select (T)i;
     
    165165    /// <typeparam name="type">Most general type.</typeparam>
    166166    /// <returns>Enumerable of the created instances.</returns>
    167     public IEnumerable<object> GetInstances(Type type) {
     167    public static IEnumerable<object> GetInstances(Type type) {
    168168      return from t in GetTypes(type)
    169169             where !t.IsAbstract && !t.IsInterface && !t.HasElementType
     
    176176    /// <param name="type">Most general type for which to find matching types.</param>
    177177    /// <returns>Enumerable of the discovered types.</returns>
    178     public IEnumerable<Type> GetTypes(Type type) {
     178    public static IEnumerable<Type> GetTypes(Type type) {
    179179      return from asm in AppDomain.CurrentDomain.GetAssemblies()
    180180             from t in GetTypes(type, asm)
     
    189189    /// <param name="plugin">The plugin the subtypes must be part of.</param>
    190190    /// <returns>Enumerable of the discovered types.</returns>
    191     public IEnumerable<Type> GetTypes(Type type, IPluginDescription pluginDescription) {
     191    public static IEnumerable<Type> GetTypes(Type type, IPluginDescription pluginDescription) {
    192192      PluginDescription pluginDesc = (PluginDescription)pluginDescription;
    193193      return from asm in AppDomain.CurrentDomain.GetAssemblies()
     
    225225      return null;
    226226    }
     227
     228    #region IApplicationManager Members
     229
     230
     231    IEnumerable<T> IApplicationManager.GetInstances<T>(IPluginDescription plugin) {
     232      return GetInstances<T>(plugin);
     233    }
     234
     235    IEnumerable<T> IApplicationManager.GetInstances<T>() {
     236      return GetInstances<T>();
     237    }
     238
     239    IEnumerable<Type> IApplicationManager.GetTypes(Type type) {
     240      return GetTypes(type);
     241    }
     242
     243    IEnumerable<Type> IApplicationManager.GetTypes(Type type, IPluginDescription plugin) {
     244      return GetTypes(type, plugin);
     245    }
     246
     247    #endregion
    227248  }
    228249}
  • branches/PluginInfrastructure Refactoring/HeuristicLab.PluginInfrastructure/Manager/PluginDescription.cs

    r2513 r2517  
    3030  /// </summary>
    3131  [Serializable]
    32   internal sealed class PluginDescription : IPluginDescription {
     32  public sealed class PluginDescription : IPluginDescription {
    3333    private int nTimesLoaded;
    3434
     
    4646    /// Gets or sets the description of the plugin.
    4747    /// </summary>
    48     public string Description {
     48    internal string Description {
    4949      get { return description; }
    50       internal set { description = value; }
     50      set { description = value; }
    5151    }
    5252    private Version version;
  • branches/PluginInfrastructure Refactoring/HeuristicLab.PluginInfrastructure/Manager/PluginValidator.cs

    r2513 r2517  
    218218
    219219      // minimal sanity check of the attribute values
    220       if (!string.IsNullOrEmpty(pluginName) && !string.IsNullOrEmpty(pluginDescription) &&
     220      if (!string.IsNullOrEmpty(pluginName) &&
    221221          pluginFiles.Count > 0 &&
    222222          pluginAssemblies.Count > 0 &&
     
    250250          var matchingDescriptions = pluginDescriptions.Where(x => x.Name == pluginName);
    251251          if (matchingDescriptions.Count() > 0) {
    252             desc.AddDependency(matchingDescriptions.First());
     252            desc.AddDependency(matchingDescriptions.Single());
    253253          } else {
    254254            // no plugin description that matches the dependency name is available => plugin is disabled
    255255            desc.Disable();
    256             break; // stop processing more dependencies
    257256          }
    258257        }
     
    279278    private void LoadPlugins(IEnumerable<PluginDescription> pluginDescriptions) {
    280279      // load all loadable plugins (all dependencies available) into the execution context
    281       foreach (var desc in PluginDescriptionIterator.IterateInDependencyOrder(pluginDescriptions
     280      foreach (var desc in PluginDescriptionIterator.IterateDependenciesBottomUp(pluginDescriptions
    282281                                                                                .Where(x => x.PluginState != PluginState.Disabled))) {
    283282        List<Type> types = new List<Type>();
Note: See TracChangeset for help on using the changeset viewer.