Changeset 1189
- Timestamp:
- 01/30/09 12:46:32 (16 years ago)
- Location:
- trunk/sources/HeuristicLab.PluginInfrastructure
- Files:
-
- 16 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.PluginInfrastructure/ApplicationInfo.cs
r242 r1189 25 25 26 26 namespace HeuristicLab.PluginInfrastructure { 27 /// <summary> 28 /// Class that provides information about an application. 29 /// </summary> 27 30 [Serializable] 28 31 public class ApplicationInfo { 29 32 private string name; 30 33 34 /// <summary> 35 /// Gets or sets the name of the application. 36 /// </summary> 31 37 public string Name { 32 38 get { return name; } … … 35 41 private Version version; 36 42 43 /// <summary> 44 /// Gets or sets the version of the application. 45 /// </summary> 37 46 public Version Version { 38 47 get { return version; } … … 41 50 private string description; 42 51 52 /// <summary> 53 /// Gets or sets the description of the application. 54 /// </summary> 43 55 public string Description { 44 56 get { return description; } … … 47 59 48 60 private bool autoRestart; 61 /// <summary> 62 /// Gets or sets the boolean flag if the application should be automatically restarted. 63 /// </summary> 49 64 public bool AutoRestart { 50 65 get { return autoRestart; } … … 54 69 private string pluginAssembly; 55 70 /// <summary> 56 /// Name of the assembly that contains the IApplication type.71 /// Gets or sets the name of the assembly that contains the IApplication type. 57 72 /// </summary> 58 73 public string PluginAssembly { … … 63 78 private string pluginType; 64 79 /// <summary> 65 /// Name of the type that implements the interface IApplication.80 /// Gets or sets the name of the type that implements the interface IApplication. 66 81 /// </summary> 67 82 public string PluginType { -
trunk/sources/HeuristicLab.PluginInfrastructure/AssemblyBuildDateAttribute.cs
r91 r1189 26 26 27 27 namespace HeuristicLab.PluginInfrastructure { 28 /// <summary> 29 /// Attribute of an assembly when it was built. 30 /// </summary> 28 31 [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = false)] 29 32 public class AssemblyBuildDateAttribute : Attribute { 30 33 private DateTime buildDate; 34 /// <summary> 35 /// Gets or sets the date when the assembly has been built. 36 /// </summary> 31 37 public DateTime BuildDate { 32 38 get { return buildDate; } 33 39 set { buildDate = value; } 34 40 } 41 /// <summary> 42 /// Initializes a new instance of <see cref="AssemblyBuildDateAttribute"/> with the given 43 /// <paramref name="timeStamp"/> as build date. 44 /// </summary> 45 /// <exception cref="FormatException">Thrown when the time stamp could not be parsed as build date.</exception> 46 /// <param name="timeStamp">The build date of the assembly.</param> 35 47 public AssemblyBuildDateAttribute(string timeStamp) 36 48 : base() { -
trunk/sources/HeuristicLab.PluginInfrastructure/BaseClasses/ApplicationBase.cs
r242 r1189 26 26 27 27 namespace HeuristicLab.PluginInfrastructure { 28 /// <summary> 29 /// Default implementation for the IApplication interface. 30 /// </summary> 28 31 public abstract class ApplicationBase : IApplication { 29 32 private string name; … … 32 35 private bool autoRestart; 33 36 37 /// <summary> 38 /// Initializes a new instance of <see cref="ApplicationBase"/>. 39 /// </summary> 34 40 public ApplicationBase() { 35 41 ReadAttributes(); … … 75 81 #region IApplication Members 76 82 83 /// <summary> 84 /// Gets the name of the application. 85 /// </summary> 77 86 public string Name { 78 87 get { return name; } 79 88 } 80 89 90 /// <summary> 91 /// Gets the version of the application. 92 /// </summary> 81 93 public Version Version { 82 94 get { return version; } 83 95 } 84 96 97 /// <summary> 98 /// Gets the description of the application. 99 /// </summary> 85 100 public string Description { 86 101 get { return description; } 87 102 } 88 103 104 /// <summary> 105 /// Gets the boolean flag whether the application should automatically get restarted. 106 /// </summary> 89 107 public bool AutoRestart { 90 108 get { return autoRestart; } 91 109 } 92 110 111 /// <summary> 112 /// Runs the application. 113 /// </summary> 93 114 public abstract void Run(); 94 115 -
trunk/sources/HeuristicLab.PluginInfrastructure/BaseClasses/PluginBase.cs
r8 r1189 36 36 private string description; 37 37 38 /// <summary> 39 /// Initializes a new instance of <see cref="PluginBase"/>. 40 /// </summary> 38 41 public PluginBase() { 39 42 ReadAttributes(); … … 84 87 85 88 #region IPlugin Members 89 /// <summary> 90 /// Gets the name of the plugin. 91 /// </summary> 86 92 public string Name { 87 93 get { … … 90 96 } 91 97 98 /// <summary> 99 /// Gets the version of the plugin. 100 /// </summary> 92 101 public Version Version { 93 102 get { … … 96 105 } 97 106 107 /// <summary> 108 /// Gets the description of the plugin. 109 /// </summary> 98 110 public string Description { 99 111 get { … … 102 114 } 103 115 116 /// <inheritdoc/> 104 117 public string[] Files { 105 118 get { … … 108 121 } 109 122 123 /// <inheritdoc/> 110 124 public virtual void OnInstall() { 111 125 } 112 126 127 /// <inheritdoc/> 113 128 public virtual void OnDelete() { 114 129 } 115 130 131 /// <inheritdoc/> 116 132 public virtual void OnPreUpdate() { 117 133 } 118 134 135 /// <inheritdoc/> 119 136 public virtual void OnPostUpdate() { 120 137 } -
trunk/sources/HeuristicLab.PluginInfrastructure/ClassInfoAttribute.cs
r242 r1189 33 33 private string name; 34 34 /// <summary> 35 /// Name of the plugin to which the assembly belongs to.35 /// Gets or sets the name of the plugin to which the assembly belongs to. 36 36 /// </summary> 37 37 public string Name { … … 41 41 42 42 private string version; 43 /// <summary> 44 /// Gets or sets the version of the plugin. 45 /// </summary> 43 46 public string Version { 44 47 get { return version; } … … 47 50 48 51 private string description; 52 /// <summary> 53 /// Gets or sets the description of the plugin. 54 /// </summary> 49 55 public string Description { 50 56 get { return description; } … … 53 59 54 60 private bool autoRestart; 61 /// <summary> 62 /// Gets or sets the boolean flag whether the plugin should be automatically restarted. 63 /// </summary> 55 64 public bool AutoRestart { 56 65 get { return autoRestart; } … … 58 67 } 59 68 69 /// <summary> 70 /// Initializes a new instance of <see cref="ClassInfoAttribute"/>. 71 /// </summary> 60 72 public ClassInfoAttribute() {} 61 73 } -
trunk/sources/HeuristicLab.PluginInfrastructure/DependencyAttribute.cs
r2 r1189 33 33 34 34 /// <summary> 35 /// Name of the plugin that is needed to load the assembly.35 /// Gets or sets the name of the plugin that is needed to load the assembly. 36 36 /// </summary> 37 37 public string Dependency { … … 40 40 } 41 41 42 /// <summary> 43 /// Initializes a new instance of <see cref="DependencyAttribute"/>. 44 /// </summary> 42 45 public DependencyAttribute() { 43 46 } -
trunk/sources/HeuristicLab.PluginInfrastructure/DiscoveryService.cs
r927 r1189 40 40 41 41 /// <summary> 42 /// Findall types that are subtypes or equal to the specified type.42 /// Finds all types that are subtypes or equal to the specified type. 43 43 /// </summary> 44 44 /// <param name="type">Most general type for which to find matching types.</param> 45 /// <returns> </returns>45 /// <returns>The found types as array.</returns> 46 46 public Type[] GetTypes(Type type) { 47 47 Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies(); … … 56 56 57 57 /// <summary> 58 /// Create an instance of all types that are subtypes or the same type of the specified type58 /// Creates an instance of all types that are subtypes or the same type of the specified type 59 59 /// </summary> 60 60 /// <typeparam name="T">Most general type.</typeparam> 61 /// <returns> </returns>61 /// <returns>The created instances as array.</returns> 62 62 public T[] GetInstances<T>() where T : class { 63 63 Type[] types = GetTypes(typeof(T)); … … 71 71 } 72 72 73 /// <summary> 74 /// Finds all types that are subtypes or equal to the specified type if they are part of the given 75 /// <paramref name="plugin"/>. 76 /// </summary> 77 /// <param name="type">Most general type for which to find matching types.</param> 78 /// <param name="plugin">The plugin the subtypes must be part of.</param> 79 /// <returns>The found types as array.</returns> 73 80 public Type[] GetTypes(Type type, PluginInfo plugin) { 74 81 Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies(); … … 86 93 87 94 /// <summary> 88 /// Get instances of all types that implement the specified interface only in the given assembly.95 /// Gets instances of all types that implement the specified interface only in the given assembly. 89 96 /// </summary> 90 97 /// <typeparam name="T">Interface type.</typeparam> 91 98 /// <param name="assembly">Assembly that should be searched for types.</param> 92 /// <returns> </returns>99 /// <returns>The found instances as array.</returns> 93 100 internal T[] GetInstances<T>(Assembly assembly) { 94 101 Type[] types = GetTypes(typeof(T), assembly); … … 103 110 104 111 /// <summary> 105 /// Get types that are assignable (same of subtype) to the specified type only from the given assembly.112 /// Gets types that are assignable (same of subtype) to the specified type only from the given assembly. 106 113 /// </summary> 107 114 /// <param name="type">Most general type we want to find.</param> 108 115 /// <param name="assembly">Assembly that should be searched for types.</param> 109 /// <returns> </returns>116 /// <returns>The found types as array.</returns> 110 117 internal Type[] GetTypes(Type type, Assembly assembly) { 111 118 List<Type> types = new List<Type>(); … … 118 125 } 119 126 127 /// <summary> 128 /// Gets the plugin of the given <paramref name="type"/>. 129 /// </summary> 130 /// <param name="type"></param> 131 /// <returns>The found plugin or <c>null</c>.</returns> 120 132 public PluginInfo GetDeclaringPlugin(Type type) { 121 133 foreach(PluginInfo info in PluginManager.Manager.LoadedPlugins) { -
trunk/sources/HeuristicLab.PluginInfrastructure/Interfaces/IControl.cs
r2 r1189 25 25 26 26 namespace HeuristicLab.PluginInfrastructure { 27 /// <summary> 28 /// Interface for controls. 29 /// </summary> 27 30 public interface IControl { } 28 31 } -
trunk/sources/HeuristicLab.PluginInfrastructure/Interfaces/IControlManager.cs
r2 r1189 26 26 27 27 namespace HeuristicLab.PluginInfrastructure { 28 /// <summary> 29 /// Interface for control managers. 30 /// </summary> 28 31 public interface IControlManager { 32 /// <summary> 33 /// Shows the given <paramref name="control"/>. 34 /// </summary> 35 /// <param name="control">The control to display.</param> 29 36 void ShowControl(IControl control); 30 37 } -
trunk/sources/HeuristicLab.PluginInfrastructure/InvalidPluginException.cs
r96 r1189 25 25 26 26 namespace HeuristicLab.PluginInfrastructure { 27 /// <summary> 28 /// Exception class for invalid plugins. 29 /// </summary> 27 30 class InvalidPluginException : Exception { 28 31 } -
trunk/sources/HeuristicLab.PluginInfrastructure/Loader.cs
r535 r1189 30 30 namespace HeuristicLab.PluginInfrastructure { 31 31 internal class Loader : MarshalByRefObject { 32 /// <summary> 33 /// Event handler for loaded plugins. 34 /// </summary> 35 /// <param name="pluginName">The plugin that has been loaded.</param> 32 36 public delegate void PluginLoadedEventHandler(string pluginName); 37 33 38 public delegate void PluginLoadFailedEventHandler(string pluginName, string args); 34 39 … … 91 96 /// list of assemblies of an plugin and the list of dependencies for each of those assemblies 92 97 /// </summary> 98 /// <exception cref="FileLoadException">Thrown when the file could not be loaded.</exception> 93 99 internal void Init() { 94 100 AppDomain.CurrentDomain.ReflectionOnlyAssemblyResolve += delegate(object sender, ResolveEventArgs args) { … … 386 392 } 387 393 388 // infinite lease time 394 /// <summary> 395 /// Initializes the life time service with an infinte lease time. 396 /// </summary> 397 /// <returns><c>null</c>.</returns> 389 398 public override object InitializeLifetimeService() { 390 399 return null; -
trunk/sources/HeuristicLab.PluginInfrastructure/PluginFileAttribute.cs
r5 r1189 25 25 26 26 namespace HeuristicLab.PluginInfrastructure { 27 /// <summary> 28 /// Enumerator of available file types for a plugin. 29 /// </summary> 27 30 public enum PluginFileType { 28 31 Assembly, … … 32 35 }; 33 36 37 /// <summary> 38 /// Attribute for plugins providing information about their corresponding files. 39 /// </summary> 34 40 [AttributeUsage(AttributeTargets.Class, AllowMultiple=true)] 35 41 public class PluginFileAttribute : System.Attribute { 36 42 private string filename; 37 43 44 /// <summary> 45 /// Gets or sets the filename of the plugin. 46 /// </summary> 38 47 public string Filename { 39 48 get { return filename; } … … 43 52 private PluginFileType filetype = PluginFileType.Data; 44 53 54 /// <summary> 55 /// Gets or sets the filetype of the plugin file. 56 /// </summary> 45 57 public PluginFileType Filetype { 46 58 get { return filetype; } … … 48 60 } 49 61 62 /// <summary> 63 /// Initializes a new instance of <see cref="PluginFileAttribute"/>. 64 /// </summary> 50 65 public PluginFileAttribute() { } 51 66 } -
trunk/sources/HeuristicLab.PluginInfrastructure/PluginInfo.cs
r91 r1189 32 32 public class PluginInfo { 33 33 private string name; 34 /// <summary> 35 /// Gets or sets the name of the plugin. 36 /// </summary> 34 37 public string Name { 35 38 get { return name; } … … 37 40 } 38 41 private Version version; 42 /// <summary> 43 /// Gets or sets the version of the plugin. 44 /// </summary> 39 45 public Version Version { 40 46 get { return version; } … … 42 48 } 43 49 private DateTime buildDate; 50 /// <summary> 51 /// Gets or sets the build date of the plugin. 52 /// </summary> 44 53 public DateTime BuildDate { 45 54 get { return buildDate; } … … 48 57 private List<string> files = new List<string>(); 49 58 /// <summary> 50 /// Names of all files that belong to this plugin.59 /// Gets the names of all files that belong to this plugin. 51 60 /// These files are deleted when the plugin is removed or updated. 52 61 /// </summary> … … 56 65 57 66 private List<PluginInfo> dependencies = new List<PluginInfo>(); 67 /// <summary> 68 /// Gets all dependencies of the plugin. 69 /// </summary> 58 70 public List<PluginInfo> Dependencies { 59 71 get { return dependencies; } … … 61 73 private List<string> assemblies = new List<string>(); 62 74 /// <summary> 63 /// Names of the assemblies that belong to this plugin.75 /// Gets the names of the assemblies that belong to this plugin. 64 76 /// </summary> 65 77 public List<string> Assemblies { … … 68 80 } 69 81 private string message; 82 /// <summary> 83 /// Gets or sets the message. 84 /// </summary> 70 85 public string Message { 71 86 get { return message; } 72 87 set { message = value; } 73 88 } 89 /// <summary> 90 /// Gets the string representation of the plugin. 91 /// </summary> 92 /// <returns>The name of the plugin.</returns> 74 93 public override string ToString() { 75 94 return Name; 76 95 } 96 77 97 // equals and hashcode have to be implemented because we want to compare PluginDescriptions from 78 98 // different AppDomains and serialization destroys reference equality 99 /// <summary> 100 /// Checks whether the given object is equal to the current plugin. 101 /// </summary> 102 /// <param name="obj">The object to compare.</param> 103 /// <returns><c>true</c> if it is equal, <c>false</c> otherwise.</returns> 79 104 public override bool Equals(object obj) { 80 105 if(!(obj is PluginInfo)) … … 84 109 return other.Name == this.Name && other.Version == this.Version; 85 110 } 111 /// <summary> 112 /// Gets the hash code of the current plugin. 113 /// </summary> 114 /// <returns>The hash code of the plugin.</returns> 86 115 public override int GetHashCode() { 87 116 if(version != null) { -
trunk/sources/HeuristicLab.PluginInfrastructure/PluginManager.cs
r997 r1189 31 31 32 32 // must extend MarshalByRefObject because of event passing between Loader and PluginManager (each in it's own AppDomain) 33 /// <summary> 34 /// Class to manage different plugins. 35 /// </summary> 33 36 public class PluginManager : MarshalByRefObject { 34 37 35 38 // singleton: only one manager allowed in each AppDomain 36 39 private static PluginManager manager = new PluginManager(); 40 /// <summary> 41 /// Gets the plugin manager (is a singleton). 42 /// </summary> 37 43 public static PluginManager Manager { 38 44 get { return manager; } … … 41 47 // singleton: only one control manager allowed in each applicatoin (i.e. AppDomain) 42 48 private static IControlManager controlManager; 49 /// <summary> 50 /// Gets or sets the control manager (is a singleton). 51 /// </summary> 43 52 public static IControlManager ControlManager { 44 53 get { return controlManager; } … … 46 55 } 47 56 57 /// <summary> 58 /// Event handler for actions in the plugin manager. 59 /// </summary> 48 60 public event PluginManagerActionEventHandler Action; 49 61 … … 58 70 } 59 71 72 /// <summary> 73 /// Gets all installed plugins. 74 /// </summary> 75 /// <remarks>This information is provided by a <see cref="Loader"/>.</remarks> 60 76 public ICollection<PluginInfo> InstalledPlugins { 61 77 get { return remoteLoader.InstalledPlugins; } 62 78 } 63 79 80 /// <summary> 81 /// Gets all disabled plugins. 82 /// </summary> 83 /// <remarks>This information is provided by a <see cref="Loader"/>.</remarks> 64 84 public ICollection<PluginInfo> DisabledPlugins { 65 85 get { return remoteLoader.DisabledPlugins; } 66 86 } 67 87 88 /// <summary> 89 /// Gets all active plugins. 90 /// </summary> 91 /// <remarks>This information is provided by a <see cref="Loader"/>.</remarks> 68 92 public ICollection<PluginInfo> ActivePlugins { 69 93 get { return remoteLoader.ActivePlugins; } 70 94 } 71 95 96 /// <summary> 97 /// Gets all installed applications. 98 /// </summary> 99 /// <remarks>This information is provided by a <see cref="Loader"/>.</remarks> 72 100 public ICollection<ApplicationInfo> InstalledApplications { 73 101 get { return remoteLoader.InstalledApplications; } … … 75 103 76 104 private ICollection<PluginInfo> loadedPlugins; 105 /// <summary> 106 /// Gets or (internally) sets the loaded plugins. 107 /// </summary> 77 108 public ICollection<PluginInfo> LoadedPlugins { 78 109 get { return loadedPlugins; } … … 138 169 139 170 /// <summary> 140 /// Creates a new AppDomain with all plugins preloaded and Sandboxing capability 171 /// Creates a new AppDomain with all plugins preloaded and Sandboxing capability. 141 172 /// </summary> 142 173 /// <param name="assembly">Assembly reference</param> … … 202 233 /// Calculates a set of plugins that directly or transitively depend on the plugin given in the argument. 203 234 /// </summary> 204 /// <param name="pluginInfo"> </param>235 /// <param name="pluginInfo">The plugin the other depend on.</param> 205 236 /// <returns>a list of plugins that are directly of transitively dependent.</returns> 206 237 public List<PluginInfo> GetDependentPlugins(PluginInfo pluginInfo) { … … 223 254 } 224 255 256 /// <summary> 257 /// Unloads all plugins. 258 /// </summary> 225 259 public void UnloadAllPlugins() { 226 260 AppDomain.Unload(pluginDomain); 227 261 } 228 262 263 /// <summary> 264 /// Loads all plugins. 265 /// </summary> 229 266 public void LoadAllPlugins() { 230 267 Initialize(); 231 268 } 232 269 270 /// <inheritdoc cref="Loader.OnDelete"/> 233 271 public void OnDelete(PluginInfo pluginInfo) { 234 272 remoteLoader.OnDelete(pluginInfo); 235 273 } 236 274 275 /// <inheritdoc cref="Loader.OnInstall"/> 237 276 public void OnInstall(PluginInfo pluginInfo) { 238 277 remoteLoader.OnInstall(pluginInfo); 239 278 } 240 279 280 /// <inheritdoc cref="Loader.OnPreUpdate"/> 241 281 public void OnPreUpdate(PluginInfo pluginInfo) { 242 282 remoteLoader.OnPreUpdate(pluginInfo); 243 283 } 244 284 285 /// <inheritdoc cref="Loader.OnPostUpdate"/> 245 286 public void OnPostUpdate(PluginInfo pluginInfo) { 246 287 remoteLoader.OnPostUpdate(pluginInfo); -
trunk/sources/HeuristicLab.PluginInfrastructure/PluginManagerActionEventArgs.cs
r2 r1189 25 25 26 26 namespace HeuristicLab.PluginInfrastructure { 27 /// <summary> 28 /// Enum for all possible actions the plugin manager can execute. 29 /// </summary> 27 30 public enum PluginManagerAction { Initializing, InitializingPlugin, InitializedPlugin, Initialized, Starting } 31 /// <summary> 32 /// Event handler for all action events of the plugin manager. 33 /// </summary> 34 /// <param name="sender">The sender of the action event.</param> 35 /// <param name="e">The event arguments.</param> 28 36 public delegate void PluginManagerActionEventHandler(object sender, PluginManagerActionEventArgs e); 29 37 30 38 // this class must be serializable because EventArgs are transmitted over AppDomain boundaries 39 /// <summary> 40 /// Class for the event arguments of plugin manager action events. 41 /// </summary> 31 42 [Serializable] 32 43 public class PluginManagerActionEventArgs { 33 44 private PluginManagerAction action; 45 /// <summary> 46 /// Gets or sets the action that has been performed. 47 /// </summary> 34 48 public PluginManagerAction Action { 35 49 get { return action; } … … 37 51 } 38 52 private string id; 53 /// <summary> 54 /// Gets or sets the id of the action event arguments. 55 /// </summary> 39 56 public string Id { 40 57 get { return id; } … … 42 59 } 43 60 61 /// <summary> 62 /// Initializes a new instance of <see cref="PluginManagerActionEventArgs"/> with the given 63 /// <paramref name="id"/> and <paramref name="action"/>. 64 /// </summary> 65 /// <param name="id">The id of the action event arguments.</param> 66 /// <param name="action">The action of the plugin manager.</param> 44 67 public PluginManagerActionEventArgs(string id, PluginManagerAction action) { 45 68 this.Id = id; -
trunk/sources/HeuristicLab.PluginInfrastructure/Runner.cs
r997 r1189 48 48 49 49 // infinite lease time 50 /// <summary> 51 /// Initializes the life time service with infinite lease time. 52 /// </summary> 53 /// <returns><c>null</c>.</returns> 50 54 public override object InitializeLifetimeService() { 51 55 return null;
Note: See TracChangeset
for help on using the changeset viewer.