Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
07/08/15 15:32:12 (9 years ago)
Author:
dglaser
Message:

#2388: Merged trunk into HiveStatistics branch

Location:
branches/HiveStatistics/sources
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/HiveStatistics/sources

  • branches/HiveStatistics/sources/HeuristicLab.Clients.Hive/3.3/Util/PluginUtil.cs

    r12012 r12689  
    2626using System.Security.Cryptography;
    2727using System.ServiceModel;
     28using HeuristicLab.Core;
    2829using HeuristicLab.PluginInfrastructure;
    2930
     
    3940    /// <param name="neededPlugins">List of plugins which need to be uploaded</param>
    4041    /// <returns></returns>
    41     public static List<Guid> GetPluginDependencies(IHiveService service, List<Plugin> onlinePlugins, List<Plugin> alreadyUploadedPlugins, IEnumerable<IPluginDescription> neededPlugins) {
     42    public static List<Guid> GetPluginDependencies(IHiveService service, List<Plugin> onlinePlugins, List<Plugin> alreadyUploadedPlugins,
     43                                                   IEnumerable<IPluginDescription> neededPlugins) {
    4244      var pluginIds = new List<Guid>();
    4345      Dictionary<IPluginDescription, byte[]> checksumsNeededPlugins = CalcChecksumsForPlugins(neededPlugins);
     
    6163              alreadyUploadedPlugins.Add(p);
    6264              pluginIds.Add(p.Id);
    63             }
    64             catch (FaultException<PluginAlreadyExistsFault> fault) {
     65            } catch (FaultException<PluginAlreadyExistsFault> fault) {
    6566              onlinePlugins.Add(service.GetPlugin(fault.Detail.Id));
    6667            }
     
    7980    }
    8081
    81     public static Plugin CreatePlugin(IPluginDescription plugin) {
    82       return new Plugin() { Name = plugin.Name, Version = plugin.Version };
    83     }
    84 
    8582    public static List<PluginData> CreatePluginDatas(IPluginDescription plugin) {
    8683      List<PluginData> pluginDatas = new List<PluginData>();
     
    9693    }
    9794
    98     public static void CollectDeclaringPlugins(List<IPluginDescription> plugins, IEnumerable<Type> usedTypes) {
     95    public static List<IPluginDescription> GetPluginsForTask(IEnumerable<Type> usedTypes, object task) {
     96      if (usedTypes.Any(x => typeof(IProgrammableItem).IsAssignableFrom(x))) {
     97        //when a programmable item is used all plugins that are currently loaded need to be sent to Hive
     98        return ApplicationManager.Manager.Plugins.ToList();
     99      } else {
     100        return CollectDeclaringPlugins(usedTypes);
     101      }
     102    }
     103
     104    private static List<IPluginDescription> CollectDeclaringPlugins(IEnumerable<Type> usedTypes) {
     105      List<IPluginDescription> plugins = new List<IPluginDescription>();
    99106      foreach (Type type in usedTypes) {
    100107        var plugin = ApplicationManager.Manager.GetDeclaringPlugin(type);
     
    104111        }
    105112      }
     113      return plugins;
    106114    }
    107115
    108     public static void CollectPluginDependencies(List<IPluginDescription> plugins, IPluginDescription plugin) {
     116    private static void CollectPluginDependencies(List<IPluginDescription> plugins, IPluginDescription plugin) {
    109117      if (plugin == null) return;
    110118      foreach (var dependency in plugin.Dependencies) {
Note: See TracChangeset for help on using the changeset viewer.