Free cookie consent management tool by TermsFeed Policy Generator

source: branches/2924_DotNetCoreMigration/HeuristicLab.PluginInfrastructure/3.3/Interfaces/IApplicationManager.cs @ 17578

Last change on this file since 17578 was 16993, checked in by dpiringe, 6 years ago

#2924:

  • added IEnumerable<T> GetInstances<T>(params object[] args) where T: class and IEnumerable<object> GetInstances(Type type, params object[] args) method to IApplicationManager and implemented them in LightweightApplicationManager -> to instantiate types with specific constructor arguments
  • added RunnerState State { get; } property in IRunnerHost, was already in RunnerHost
  • added user authentication for NativeRunnerHost
  • added optional check for a running docker daemon and available image for type DockerRunnerHost + Exception DockerException
  • added caching of the saved IApplication in ApplicationRunner to prevent a new instance every get call
  • removed System.ServiceModel.Primitives NuGet package
  • lots of formatting
File size: 8.0 KB
Line 
1#region License Information
2/* HeuristicLab
3 * Copyright (C) 2002-2018 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
4 *
5 * This file is part of HeuristicLab.
6 *
7 * HeuristicLab is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
11 *
12 * HeuristicLab is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
19 */
20#endregion
21
22using System;
23using System.Collections.Generic;
24using System.Reflection;
25
26namespace HeuristicLab.PluginInfrastructure {
27  /// <summary>
28  /// Interface for application managers.
29  /// </summary>
30  public interface IApplicationManager {
31    /// <summary>
32    /// Gets all discovered plugins.
33    /// </summary>
34    IEnumerable<IPluginDescription> Plugins { get; }
35
36    /// <summary>
37    /// Gets all discovered applications.
38    /// </summary>
39    IEnumerable<IApplicationDescription> Applications { get; }
40
41    /// <summary>
42    /// Discovers and creates instances of <typeparamref name="T"/> and all types implementing or inheriting <typeparamref name="T"/> (directly and indirectly).
43    /// </summary>
44    /// <typeparam name="T">The type or super-type to discover.</typeparam>
45    /// <returns>An enumerable of instances of the discovered types.</returns>
46    IEnumerable<T> GetInstances<T>() where T : class;
47
48    /// <summary>
49    /// Discovers and creates instances of <typeparamref name="T"/> and all types implementing or inheriting <typeparamref name="T"/> (directly and indirectly).
50    /// </summary>
51    /// <typeparam name="T">The type or super-type to discover.</typeparam>
52    /// <param name="args">Constructor arguments.</param>
53    /// <returns>An enumerable of instances of the discovered types.</returns>
54    IEnumerable<T> GetInstances<T>(params object[] args) where T : class;
55
56    /// <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.</param>
60    /// <returns>An enumerable of instances of the discovered types.</returns>
61    IEnumerable<object> GetInstances(Type type);
62
63    /// <summary>
64    /// Discovers and creates instances of <paramref name="type"/> and all types implementing or inheriting <paramref name="type"/> (directly and indirectly).
65    /// </summary>
66    /// <param name="type">The type or super-type to discover.</param>
67    /// <param name="args">Constructor arguments.</param>
68    /// <returns>An enumerable of instances of the discovered types.</returns>
69    IEnumerable<object> GetInstances(Type type, params object[] args);
70
71    /// <summary>
72    /// Discovers a specific type by its name.
73    /// </summary>
74    /// <param name="typeName">Full name of the type.</param>
75    /// <returns>A type or null, if nothing was found.</returns>
76    Type GetType(string typeName);
77
78    /// <summary>
79    /// Discovers all types implementing or inheriting <paramref name="type"/> (directly and indirectly).
80    /// </summary>
81    /// <param name="type">The type to discover.</param>
82    /// <param name="onlyInstantiable">Return only types that are instantiable (instance, abstract... are not returned)</param>
83    /// <returns>An enumerable of discovered types.</returns>
84    IEnumerable<Type> GetTypes(Type type, bool onlyInstantiable = true, bool includeGenericTypeDefinitions = false);
85
86    /// <summary>
87    /// Discovers all types implementing or inheriting all or any type in <paramref name="types"/> (directly and indirectly).
88    /// </summary>
89    /// <param name="types">The types to discover.</param>
90    /// <param name="onlyInstantiable">Return only types that are instantiable (instance, abstract... are not returned)</param>
91    /// <param name="assignableToAllTypes">Specifies if discovered types must implement or inherit all given <paramref name="types"/>.</param>
92    /// <returns>An enumerable of discovered types.</returns>
93    IEnumerable<Type> GetTypes(IEnumerable<Type> types, bool onlyInstantiable = true, bool includeGenericTypeDefinitions = false, bool assignableToAllTypes = true);
94
95    /// <summary>
96    /// Discovers all types implementing or inheriting <paramref name="type"/> (directly and indirectly) that are declared in any assembly of <paramref name="plugin"/>.
97    /// </summary>
98    /// <param name="type">The type to discover.</param>
99    /// <param name="plugin">The declaring plugin.</param>
100    /// <param name="onlyInstantiable">Return only types that are instantiable (instance, abstract... are not returned)</param>
101    /// <returns>An enumerable of discovered types.</returns>
102    IEnumerable<Type> GetTypes(Type type, IPluginDescription plugin, bool onlyInstantiable = true, bool includeGenericTypeDefinitions = false);
103
104    /// <summary>
105    /// Discovers all types implementing or inheriting all or any type in <paramref name="types"/> (directly and indirectly) that are declared in any assembly of <paramref name="plugin"/>.
106    /// </summary>
107    /// <param name="types">The types to discover.</param>
108    /// <param name="plugin">The declaring plugin.</param>
109    /// <param name="onlyInstantiable">Return only types that are instantiable (instance, abstract... are not returned)</param>
110    /// /// <param name="assignableToAllTypes">Specifies if discovered types must implement or inherit all given <paramref name="types"/>.</param>
111    /// <returns>An enumerable of discovered types.</returns>
112    IEnumerable<Type> GetTypes(IEnumerable<Type> types, IPluginDescription plugin, bool onlyInstantiable = true, bool includeGenericTypeDefinitions = false, bool assignableToAllTypes = true);
113
114
115    /// <summary>
116    /// Discovers all types implementing or inheriting <paramref name="type"/> (directly and indirectly) that are declared in the<paramref name="assembly"/>.
117    /// </summary>
118    /// <param name="type">The type to discover.</param>
119    /// <param name="assembly">The declaring assembly.</param>
120    /// <param name="onlyInstantiable">Return only types that are instantiable (instance, abstract... are not returned)</param>
121    /// <returns>An enumerable of discovered types.</returns>
122    IEnumerable<Type> GetTypes(Type type, Assembly assembly, bool onlyInstantiable = true, bool includeGenericTypeDefinitions = false);
123
124    /// <summary>
125    /// Discovers all types implementing or inheriting all or any type in <paramref name="types"/> (directly and indirectly) that are declaed in any assembly of <paramref name="plugin"/>.
126    /// </summary>
127    /// <param name="types">The types to discover.</param>
128    /// <param name="assembly">The declaring assembly.</param>
129    /// <param name="onlyInstantiable">Return only types that are instantiable (instance, abstract... are not returned)</param>
130    /// /// <param name="assignableToAllTypes">Specifies if discovered types must implement or inherit all given <paramref name="types"/>.</param>
131    /// <returns>An enumerable of discovered types.</returns>
132    IEnumerable<Type> GetTypes(IEnumerable<Type> types, Assembly assembly, bool onlyInstantiable = true, bool includeGenericTypeDefinitions = false, bool assignableToAllTypes = true);
133
134    /// <summary>
135    /// Finds the plugin that declares the <paramref name="type">type</paramref>.
136    /// </summary>
137    /// <param name="type">The type of interest.</param>
138    /// <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>
139    IPluginDescription GetDeclaringPlugin(Type type);
140  }
141}
Note: See TracBrowser for help on using the repository browser.