Changeset 279 for branches/3.0/sources/HeuristicLab.PluginInfrastructure
- Timestamp:
- 05/30/08 13:41:27 (16 years ago)
- Location:
- branches/3.0/sources/HeuristicLab.PluginInfrastructure
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/3.0/sources/HeuristicLab.PluginInfrastructure/ApplicationInfo.cs
r2 r279 46 46 } 47 47 48 private bool autoRestart; 49 public bool AutoRestart { 50 get { return autoRestart; } 51 set { autoRestart = value; } 52 } 53 48 54 private string pluginAssembly; 49 55 /// <summary> 50 56 /// Name of the assembly that contains the IApplication type. 51 /// NEEDED?52 57 /// </summary> 53 58 public string PluginAssembly { … … 59 64 /// <summary> 60 65 /// Name of the type that implements the interface IApplication. 61 /// NEEDED?62 66 /// </summary> 63 67 public string PluginType { -
branches/3.0/sources/HeuristicLab.PluginInfrastructure/BaseClasses/ApplicationBase.cs
r8 r279 30 30 private Version version; 31 31 private string description; 32 32 private bool autoRestart; 33 33 34 public ApplicationBase() { 34 35 ReadAttributes(); … … 45 46 // after the assertion we are sure that the array access will not fail 46 47 ClassInfoAttribute pluginAttribute = (ClassInfoAttribute)pluginAttributes[0]; 48 if(pluginAttribute != null) { 49 // if the plugin name is not explicitly set in the attribute then the default plugin name is the FullName of the type 50 if(pluginAttribute.Name != null) { 51 this.name = pluginAttribute.Name; 52 } else { 53 this.name = this.GetType().FullName; 54 } 47 55 48 // if the plugin name is not explicitly set in the attribute then the default plugin name is the FullName of the type49 if(pluginAttribute != null && pluginAttribute.Name!= null) {50 this.name = pluginAttribute.Name;51 } else {52 this.name = this.GetType().FullName;53 }56 // if the version is not explicitly set in the attribute then the version of the assembly is used as default 57 if(pluginAttribute.Version != null) { 58 this.version = new Version(pluginAttribute.Version); 59 } else { 60 this.version = this.GetType().Assembly.GetName().Version; 61 } 54 62 55 // if the version is not explicitly set in the attribute then the version of the assemblyis used as default56 if(pluginAttribute != null && pluginAttribute.Version != null) {57 this.version = new Version(pluginAttribute.Version);58 } else {59 this.version = this.GetType().Assembly.GetName().Version;60 }63 // if the description is not explicitly set in the attribute then the name of name of the application is used as default 64 if(pluginAttribute.Description != null) { 65 this.description = pluginAttribute.Description; 66 } else { 67 this.description = name; 68 } 61 69 62 // if the description is not explicitly set in the attribute then the name of name of the application is used as default 63 if(pluginAttribute != null && pluginAttribute.Description != null) { 64 this.description = pluginAttribute.Description; 65 } else { 66 this.description = name; 70 this.autoRestart = pluginAttribute.AutoRestart; 67 71 } 68 72 } … … 83 87 } 84 88 85 public abstract void Run() ; 89 public bool AutoRestart { 90 get { return autoRestart; } 91 } 92 93 public abstract void Run(); 86 94 87 95 #endregion -
branches/3.0/sources/HeuristicLab.PluginInfrastructure/ClassInfoAttribute.cs
r91 r279 52 52 } 53 53 54 private bool autoRestart; 55 public bool AutoRestart { 56 get { return autoRestart; } 57 set { autoRestart = value; } 58 } 59 54 60 public ClassInfoAttribute() {} 55 61 } -
branches/3.0/sources/HeuristicLab.PluginInfrastructure/Interfaces/IApplication.cs
r2 r279 29 29 Version Version { get; } 30 30 string Description { get;} 31 bool AutoRestart { get; } 31 32 void Run(); 32 33 } -
branches/3.0/sources/HeuristicLab.PluginInfrastructure/Loader.cs
r91 r279 120 120 info.Version = application.Version; 121 121 info.Description = application.Description; 122 info.AutoRestart = application.AutoRestart; 122 123 info.PluginAssembly = application.GetType().Assembly.GetName().Name; 123 124 info.PluginType = application.GetType().Namespace + "." + application.GetType().Name; -
branches/3.0/sources/HeuristicLab.PluginInfrastructure/PluginManager.cs
r29 r279 103 103 setup.PrivateBinPath = pluginDir; 104 104 AppDomain applicationDomain = AppDomain.CreateDomain(appInfo.Name + " AppDomain", null, setup); 105 106 Runner remoteRunner = (Runner)applicationDomain.CreateInstanceAndUnwrap("HeuristicLab.PluginInfrastructure", "HeuristicLab.PluginInfrastructure.Runner"); 107 NotifyListeners(PluginManagerAction.Initializing, "All plugins"); 108 remoteRunner.LoadPlugins(remoteLoader.ActivePlugins); 109 NotifyListeners(PluginManagerAction.Initialized, "All plugins"); 110 remoteRunner.Run(appInfo); 111 112 AppDomain.Unload(applicationDomain); 105 try { 106 Runner remoteRunner = (Runner)applicationDomain.CreateInstanceAndUnwrap("HeuristicLab.PluginInfrastructure", "HeuristicLab.PluginInfrastructure.Runner"); 107 NotifyListeners(PluginManagerAction.Initializing, "All plugins"); 108 remoteRunner.LoadPlugins(remoteLoader.ActivePlugins); 109 NotifyListeners(PluginManagerAction.Initialized, "All plugins"); 110 remoteRunner.Run(appInfo); 111 } catch(Exception ex) { 112 // can't handle exception here -> rethrow 113 throw new ApplicationException("Exception in "+appInfo.Name, ex); 114 } finally { 115 // make sure domain is unloaded in all cases 116 AppDomain.Unload(applicationDomain); 117 } 113 118 } 114 119
Note: See TracChangeset
for help on using the changeset viewer.