Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
01/05/10 11:07:21 (15 years ago)
Author:
gkronber
Message:

Merged missing changes (r2587, r2589) in plugin infrastructure from branch to trunk. #799

Location:
trunk/sources/HeuristicLab.PluginInfrastructure
Files:
7 edited
3 copied

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.PluginInfrastructure/ApplicationManager.cs

    r2527 r2592  
    138138    /// </summary>
    139139    /// <param name="plugins">bytearray of all assemblies that should be loaded</param>
    140     public void LoadAssemblies(IEnumerable<byte[]> assemblies) {
     140    internal void LoadAssemblies(IEnumerable<byte[]> assemblies) {
    141141      foreach (byte[] asm in assemblies) {
    142142        Assembly loadedAsm = Assembly.Load(asm);
     
    156156    /// <typeparam name="T">Most general type.</typeparam>
    157157    /// <returns>Enumerable of the created instances.</returns>
    158     public static IEnumerable<T> GetInstances<T>(IPluginDescription plugin) where T : class {
     158    internal static IEnumerable<T> GetInstances<T>(IPluginDescription plugin) where T : class {
    159159      return from t in GetTypes(typeof(T), plugin)
    160160             select (T)Activator.CreateInstance(t);
     
    175175    /// <typeparam name="T">Most general type.</typeparam>
    176176    /// <returns>Enumerable of the created instances.</returns>
    177     public static IEnumerable<T> GetInstances<T>() where T : class {
     177    internal static IEnumerable<T> GetInstances<T>() where T : class {
    178178      return from i in GetInstances(typeof(T))
    179179             select (T)i;
     
    185185    /// <typeparam name="type">Most general type.</typeparam>
    186186    /// <returns>Enumerable of the created instances.</returns>
    187     public static IEnumerable<object> GetInstances(Type type) {
     187    internal static IEnumerable<object> GetInstances(Type type) {
    188188      return from t in GetTypes(type)
    189189             select Activator.CreateInstance(t);
     
    195195    /// <param name="type">Most general type for which to find matching types.</param>
    196196    /// <returns>Enumerable of the discovered types.</returns>
    197     public static IEnumerable<Type> GetTypes(Type type) {
     197    internal static IEnumerable<Type> GetTypes(Type type) {
    198198      return from asm in AppDomain.CurrentDomain.GetAssemblies()
    199199             from t in GetTypes(type, asm)
     
    208208    /// <param name="plugin">The plugin the subtypes must be part of.</param>
    209209    /// <returns>Enumerable of the discovered types.</returns>
    210     public static IEnumerable<Type> GetTypes(Type type, IPluginDescription pluginDescription) {
     210    internal static IEnumerable<Type> GetTypes(Type type, IPluginDescription pluginDescription) {
    211211      PluginDescription pluginDesc = (PluginDescription)pluginDescription;
    212212      return from asm in AppDomain.CurrentDomain.GetAssemblies()
     
    252252    #region IApplicationManager Members
    253253
    254 
    255254    IEnumerable<T> IApplicationManager.GetInstances<T>(IPluginDescription plugin) {
    256255      return GetInstances<T>(plugin);
     
    261260    }
    262261
     262    IEnumerable<object> IApplicationManager.GetInstances(Type type) {
     263      return GetInstances(type);
     264    }
     265
    263266    IEnumerable<Type> IApplicationManager.GetTypes(Type type) {
    264267      return GetTypes(type);
     
    269272    }
    270273
     274    /// <summary>
     275    /// Finds the plugin that declares the <paramref name="type">type</paramref>.
     276    /// </summary>
     277    /// <param name="type">The type of interest.</param>
     278    /// <returns>The description of the plugin that declares the given type or null if the type has not been declared by a known plugin.</returns>
     279    public IPluginDescription GetDeclaringPlugin(Type type) {
     280      foreach (PluginDescription info in Plugins) {
     281        if (info.Assemblies.Contains(Path.GetFullPath(type.Assembly.Location))) return info;
     282      }
     283      return null;
     284    }
    271285    #endregion
    272286  }
  • trunk/sources/HeuristicLab.PluginInfrastructure/BaseClasses/PluginBase.cs

    r2504 r2592  
    3535    /// Initializes a new instance of <see cref="PluginBase"/>.
    3636    /// </summary>
    37     protected PluginBase() { }
     37    public PluginBase() { }
    3838
    3939    private PluginAttribute PluginAttribute {
  • trunk/sources/HeuristicLab.PluginInfrastructure/HeuristicLab.PluginInfrastructure.csproj

    r2527 r2592  
    149149      <DesignTimeSharedInput>True</DesignTimeSharedInput>
    150150    </Compile>
     151    <Compile Include="Sandboxing\ISandboxManager.cs" />
     152    <Compile Include="Sandboxing\SandboxManager.cs" />
    151153    <Compile Include="Service References\UpdateLocationReference\Reference.cs">
    152154      <AutoGen>True</AutoGen>
  • trunk/sources/HeuristicLab.PluginInfrastructure/Interfaces/IApplicationManager.cs

    r2504 r2592  
    4141
    4242    /// <summary>
    43     /// Dynamically loads assemblies given in binary form.
    44     /// </summary>
    45     /// <param name="assemblies">Assemblies that should be loaded in binary form.</param>
    46     void LoadAssemblies(IEnumerable<byte[]> assemblies);
    47 
    48     /// <summary>
    4943    /// Discovers and creates instances of <typeparamref name="T"/> and all types implementing or inheriting <typeparamref name="T"/> (directly and indirectly) declared in any assembly of <paramref name="plugin"/>.
    5044    /// </summary>
     
    6155
    6256    /// <summary>
     57    /// Discovers and creates instances of <paramref name="type"/> and all types implementing or inheriting <paramref name="type"/> (directly and indirectly).
     58    /// </summary>
     59    /// <param name="type">The type or super-type to discover.</typeparam>
     60    /// <returns>An enumerable of instances of the discovered types.</returns>
     61    IEnumerable<object> GetInstances(Type type);
     62
     63    /// <summary>
    6364    /// Discovers all types implementing or inheriting <paramref name="type"/> (directly and indirectly).
    6465    /// </summary>
     
    7374    /// <returns>An enumerable of discovered types.</returns>
    7475    IEnumerable<Type> GetTypes(Type type, IPluginDescription plugin);
     76    /// <summary>
     77    /// Finds the plugin that declares the <paramref name="type">type</paramref>.
     78    /// </summary>
     79    /// <param name="type">The type of interest.</param>
     80    /// <returns>The description of the plugin that declares the given type or null if the type has not been declared by a known plugin.</returns>
     81    IPluginDescription GetDeclaringPlugin(Type type);
    7582  }
    7683}
  • trunk/sources/HeuristicLab.PluginInfrastructure/Interfaces/IPluginDescription.cs

    r2504 r2592  
    3232    /// </summary>
    3333    string Name { get; }
     34    /// <summary>
     35    /// Gets the version of the plugin.
     36    /// </summary>
     37    Version Version { get; }
     38    /// <summary>
     39    /// Gets the build date of the plugin.
     40    /// </summary>
     41    DateTime BuildDate { get; }
     42    /// <summary>
     43    /// Gets the dependencies of the plugin.
     44    /// </summary>
     45    IEnumerable<IPluginDescription> Dependencies { get; }
     46    /// <summary>
     47    /// Gets the file names of files that are part of the plugin.
     48    /// </summary>
     49    IEnumerable<string> Files { get; }
    3450  }
    3551}
  • trunk/sources/HeuristicLab.PluginInfrastructure/Manager/PluginDescription.cs

    r2517 r2592  
    2323using System.Collections.Generic;
    2424using System.Text;
     25using System.Linq;
    2526
    2627namespace HeuristicLab.PluginInfrastructure.Manager {
     
    3536    private string name;
    3637    /// <summary>
    37     /// Gets or sets the name of the plugin.
     38    /// Gets the name of the plugin.
    3839    /// </summary>
    3940    public string Name {
     
    5253    private Version version;
    5354    /// <summary>
    54     /// Gets or sets the version of the plugin.
     55    /// Gets the version of the plugin.
    5556    /// </summary>
    56     internal Version Version {
     57    public Version Version {
    5758      get { return version; }
    58       set { version = value; }
     59      internal set { version = value; }
    5960    }
    6061    private DateTime buildDate;
    6162    /// <summary>
    62     /// Gets or sets the build date of the plugin.
     63    /// Gets the build date of the plugin.
    6364    /// </summary>
    64     internal DateTime BuildDate {
     65    public DateTime BuildDate {
    6566      get { return buildDate; }
    66       set { buildDate = value; }
     67      internal set { buildDate = value; }
    6768    }
    6869
     
    8182    /// These files are deleted when the plugin is removed or updated.
    8283    /// </summary>
    83     internal IEnumerable<string> Files {
     84    public IEnumerable<string> Files {
    8485      get { return files; }
    8586    }
     
    9091
    9192    private List<PluginDescription> dependencies = new List<PluginDescription>();
     93    internal IEnumerable<PluginDescription> Dependencies {
     94      get { return dependencies; }
     95    }
    9296    /// <summary>
    9397    /// Gets all dependencies of the plugin.
    9498    /// </summary>
    95     internal IEnumerable<PluginDescription> Dependencies {
    96       get { return dependencies; }
     99    IEnumerable<IPluginDescription> IPluginDescription.Dependencies {
     100      get { return dependencies.Cast<IPluginDescription>(); }
    97101    }
    98102
     
    100104      dependencies.Add(dependency);
    101105    }
    102 
    103106
    104107    private List<string> assemblies = new List<string>();
  • trunk/sources/HeuristicLab.PluginInfrastructure/Manager/PluginManager.cs

    r2527 r2592  
    112112
    113113    /// <summary>
    114     /// Starts and application in a separate AppDomain.
    115     /// Loads all enabled plugins and starts the application via a PluginRunner instance activated in the new AppDomain.
     114    /// Starts an application in a separate AppDomain.
     115    /// Loads all enabled plugins and starts the application via an ApplicationManager instance activated in the new AppDomain.
    116116    /// </summary>
    117117    /// <param name="appInfo">application to run</param>
Note: See TracChangeset for help on using the changeset viewer.